-
Notifications
You must be signed in to change notification settings - Fork 5
/
.irbrc.old
152 lines (119 loc) · 3.53 KB
/
.irbrc.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
require "irb/completion"
require "irb/ext/save-history"
require "benchmark"
require "run_loop"
require "pry"
require "calabash-cucumber/operations"
AwesomePrint.irb!
ARGV.concat [ "--readline",
"--prompt-mode",
"simple"]
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = ".irb-history"
IRB.conf[:AUTO_INDENT] = true
IRB.conf[:PROMPT][:PERMISSIONS] = {
:PROMPT_I => "permissions #{Calabash::Cucumber::VERSION}> ",
:PROMPT_N => "permissions #{Calabash::Cucumber::VERSION}> ",
:PROMPT_S => nil,
:PROMPT_C => "> ",
:AUTO_INDENT => false,
:RETURN => "%s\n"
}
IRB.conf[:PROMPT_MODE] = :PERMISSIONS
Pry.config.history.should_save = false
Pry.config.history.should_load = false
require "pry-nav"
extend Calabash::Cucumber::Operations
def embed(x,y=nil,z=nil)
puts "Screenshot at #{x}"
end
puts ""
puts "# => Useful Methods <= #"
puts "> xcode => Xcode instance"
puts "> instruments => Instruments instance"
puts "> simcontrol => SimControl instance"
puts "> default_sim => Default simulator"
puts "> verbose => turn on DEBUG logging"
puts "> quiet => turn off DEBUG logging"
puts "> make_app => build a new .app from sources"
puts ""
def xcode
@xcode ||= RunLoop::Xcode.new
end
def instruments
@instruments ||= RunLoop::Instruments.new
end
def simcontrol
@simcontrol ||= RunLoop::SimControl.new
end
def default_sim
@default_sim ||= lambda do
name = RunLoop::Core.default_simulator(xcode)
simcontrol.simulators.find do |sim|
sim.instruments_identifier(xcode) == name
end
end.call
end
def verbose
ENV["DEBUG"] = "1"
end
def quiet
ENV["DEBUG"] = "1"
end
motd=["Let's get this done!", "Ready to rumble.", "Enjoy.", "Remember to breathe.",
"Take a deep breath.", "Isn't it time for a break?", "Can I get you a coffee?",
"What is a calabash anyway?", "Smile! You are on camera!", "Let op! Wild Rooster!",
"Don't touch that button!", "I'm gonna take this to 11.", "Console. Engaged.",
"Your wish is my command.", "This console session was created just for you."]
puts "#{motd.sample()}"
if ENV["APP"]
app = ENV["APP"]
else
app = File.expand_path("Products/app/Permissions.app")
ENV["APP"] = app
end
unless File.exist?(app)
raise "Expected app "#{app}" to exist.\nYou can build the app with `make app`"
end
puts "APP => '#{app}'"
def make_app
system("make", "app")
end
def start_en(options={})
sim = default_sim
RunLoop::CoreSimulator.erase(sim)
launch_options = {
:uia_strategy => :preferences,
}.merge(options)
start_test_server_in_background(launch_options)
end
def World(mod)
puts "Worlding module: #{mod}"
include mod
end
load("features/0x/support/2x-bridge.rb")
load("features/0x/support/wait_for_alert.rb")
load("features/0x/support/tap_row.rb")
load("features/support/alerts.rb")
def start_danish(options={})
sim = default_sim
RunLoop::CoreSimulator.erase(sim)
RunLoop::CoreSimulator.set_locale(sim, "da")
RunLoop::CoreSimulator.set_language(sim, "da")
launch_options = {
:uia_strategy => :preferences,
:args => ["-AppleLanguages", "(da)", "-AppleLocale da"],
}.merge(options)
start_test_server_in_background(launch_options)
end
def start_dutch(options={})
sim = default_sim
RunLoop::CoreSimulator.erase(sim)
RunLoop::CoreSimulator.set_locale(sim, "nl")
RunLoop::CoreSimulator.set_language(sim, "nl")
launch_options = {
:uia_strategy => :preferences,
:args => ["-AppleLanguages", "(nl)", "-AppleLocale nl"],
}.merge(options)
start_test_server_in_background(launch_options)
end