geordi 1.4.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +53 -61
- data/Rakefile +12 -10
- data/features/cucumber.feature +20 -1
- data/features/firefox.feature +5 -0
- data/features/server.feature +24 -0
- data/lib/geordi/commands/cucumber.rb +12 -7
- data/lib/geordi/commands/deploy.rb +32 -14
- data/lib/geordi/commands/dump.rb +1 -1
- data/lib/geordi/commands/eurest.rb +1 -1
- data/lib/geordi/commands/firefox.rb +5 -3
- data/lib/geordi/commands/png_optimize.rb +3 -13
- data/lib/geordi/commands/purge_kernels.rb +1 -1
- data/lib/geordi/commands/server.rb +19 -0
- data/lib/geordi/commands/tests.rb +9 -4
- data/lib/geordi/commands/with_rake.rb +2 -1
- data/lib/geordi/firefox_for_selenium.rb +5 -5
- data/lib/geordi/util.rb +6 -0
- data/lib/geordi/version.rb +1 -1
- metadata +4 -3
- data/lib/geordi/commands/devserver.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 353c82b4e3fed11c19b3cf347e50f18d14253ae4
|
4
|
+
data.tar.gz: da71d1156fb486d8fa27218573470c99948cb7de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31362eec0538ed4b3e99a875fe9ec98a6e5e9252a6cfbbc44bb3146fccecd5e7d7a3c47ad1fb46e09d725c37830c6b3a3a2efbb670bda4f566644c0206edb5cf
|
7
|
+
data.tar.gz: f14ae5d1b9fdd7f0e0fda47b4947ba6685ea2422e80d4b037aeae61eefa9b5cc12237475d5bb3449e2aeba294849e86669d0c04eaf34ea00670e1f16a6194695
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,45 +4,47 @@ Geordi
|
|
4
4
|
Geordi is a collection of command line tools we use in our daily work with
|
5
5
|
Ruby, Rails and Linux at [makandra](http://makandra.com/).
|
6
6
|
|
7
|
-
|
7
|
+
Installation:
|
8
8
|
|
9
9
|
gem install geordi
|
10
10
|
|
11
11
|
|
12
|
-
geordi
|
13
|
-
|
12
|
+
`geordi`
|
13
|
+
--------
|
14
14
|
|
15
|
-
The
|
15
|
+
The `geordi` binary holds most of the utility commands. For the few other
|
16
|
+
binaries, see the bottom of this file.
|
16
17
|
|
17
|
-
You may abbreviate commands by typing only
|
18
|
-
|
19
|
-
tests afterwards.
|
18
|
+
You may abbreviate commands by typing only their first letters, e.g. `geordi
|
19
|
+
con` will boot a development console, `geordi set -t` will setup a project and
|
20
|
+
run tests afterwards.
|
20
21
|
|
21
|
-
For details on commands, e.g. supported options,
|
22
|
+
For details on commands, e.g. supported options, you may always run
|
23
|
+
`geordi help <command>`.
|
22
24
|
|
23
|
-
### geordi apache-site VIRTUAL_HOST
|
25
|
+
### `geordi apache-site VIRTUAL_HOST`
|
24
26
|
|
25
27
|
Enable the given virtual host, disabling all others.
|
26
28
|
|
27
29
|
|
28
|
-
### geordi capistrano COMMAND
|
30
|
+
### `geordi capistrano COMMAND`
|
29
31
|
|
30
32
|
Run a capistrano command on all deploy targets.
|
31
33
|
|
32
34
|
Example: `geordi capistrano deploy`
|
33
35
|
|
34
36
|
|
35
|
-
### geordi clean
|
37
|
+
### `geordi clean`
|
36
38
|
|
37
39
|
Remove unneeded files from the current directory.
|
38
40
|
|
39
41
|
|
40
|
-
### geordi commit
|
42
|
+
### `geordi commit`
|
41
43
|
|
42
44
|
Commit using a story title from Pivotal Tracker.
|
43
45
|
|
44
46
|
|
45
|
-
### geordi console [TARGET]
|
47
|
+
### `geordi console [TARGET]`
|
46
48
|
|
47
49
|
Open a Rails console locally or on a Capistrano deploy target.
|
48
50
|
|
@@ -51,7 +53,7 @@ Open a local Rails console: `geordi console`
|
|
51
53
|
Open a Rails console on `staging`: `geordi console staging`
|
52
54
|
|
53
55
|
|
54
|
-
### geordi cucumber [FILES]
|
56
|
+
### `geordi cucumber [FILES and OPTIONS]`
|
55
57
|
|
56
58
|
Run Cucumber features.
|
57
59
|
|
@@ -72,11 +74,11 @@ or `-d`.
|
|
72
74
|
e.g. `--format pretty`.
|
73
75
|
|
74
76
|
|
75
|
-
### geordi deploy [STAGE]
|
77
|
+
### `geordi deploy [STAGE]`
|
76
78
|
|
77
79
|
Guided deployment across branches.
|
78
80
|
|
79
|
-
Example: `geordi deploy
|
81
|
+
Example: `geordi deploy` or `geordi deploy p[roduction]`
|
80
82
|
|
81
83
|
Merge, push and deploy with a single command! There are several scenarios where
|
82
84
|
this command comes in handy:
|
@@ -84,7 +86,7 @@ this command comes in handy:
|
|
84
86
|
1) *Production deploy:* From the master branch, run `geordi deploy production`.
|
85
87
|
This will merge `master` to `production`, push and deploy to production.
|
86
88
|
|
87
|
-
2) *Feature branch deploy:* From
|
89
|
+
2) *Feature branch deploy:* From a feature branch, run `geordi deploy staging`.
|
88
90
|
This will merge the feature branch to `master`, push and deploy to staging.
|
89
91
|
|
90
92
|
3) *Simple deploy:* If the source branch matches the target branch, merging will
|
@@ -93,18 +95,18 @@ this command comes in handy:
|
|
93
95
|
Calling the command without arguments will infer the target stage from the
|
94
96
|
current branch and fall back to master/staging.
|
95
97
|
|
96
|
-
|
97
|
-
|
98
|
-
|
98
|
+
Finds available Capistrano stages by their prefix, e.g. `geordi deploy p` will
|
99
|
+
deploy production, `geordi deploy mak` will deploy a `makandra` stage if there
|
100
|
+
is a file config/deploy/makandra.rb.
|
99
101
|
|
100
|
-
|
102
|
+
When your project is running Capistrano 3, deployment will use `cap deploy`
|
103
|
+
instead of `cap deploy:migrations`. You can force using `deploy` by passing the
|
104
|
+
-M option: `geordi deploy -M staging`.
|
101
105
|
|
102
|
-
Start a development server.
|
103
106
|
|
107
|
+
### `geordi dump [TARGET]`
|
104
108
|
|
105
|
-
|
106
|
-
|
107
|
-
Handle dumps.
|
109
|
+
Handle dumps (see `geordi help dump` for details).
|
108
110
|
|
109
111
|
When called without arguments, dumps the development database with `dumple`.
|
110
112
|
|
@@ -126,14 +128,9 @@ dump into the development database after downloading it.
|
|
126
128
|
geordi dump staging -l
|
127
129
|
|
128
130
|
|
129
|
-
### geordi
|
130
|
-
|
131
|
-
Open the current Eurest cantina menu.
|
131
|
+
### `geordi firefox COMMAND`
|
132
132
|
|
133
|
-
|
134
|
-
### geordi firefox COMMAND
|
135
|
-
|
136
|
-
Run a command with VNC set up (and the test firefox, if present).
|
133
|
+
Run a command with VNC and test browser set up (alias: chrome).
|
137
134
|
|
138
135
|
Example: `geordi firefox b cucumber` or `geordi firefox --setup 24.0`
|
139
136
|
|
@@ -145,12 +142,12 @@ Useful when you need Firefox for Selenium or the VNC set up, but can't use the
|
|
145
142
|
This command is aliased `chrome` for users running Selenium in Chrome.
|
146
143
|
|
147
144
|
|
148
|
-
### geordi help [COMMAND]
|
145
|
+
### `geordi help [COMMAND]`
|
149
146
|
|
150
147
|
Describe available commands or one specific command.
|
151
148
|
|
152
149
|
|
153
|
-
### geordi migrate
|
150
|
+
### `geordi migrate`
|
154
151
|
|
155
152
|
Migrate all databases.
|
156
153
|
|
@@ -161,30 +158,20 @@ environment and `rake parallel:prepare` afterwards. Otherwise, invokes `geordi r
|
|
161
158
|
with `db:migrate`.
|
162
159
|
|
163
160
|
|
164
|
-
### geordi png-optimize PATH
|
161
|
+
### `geordi png-optimize PATH`
|
165
162
|
|
166
163
|
Optimize .png files.
|
167
164
|
|
165
|
+
Example: `geordi png-optimize some/directory`
|
166
|
+
|
168
167
|
- Removes color profiles: cHRM, sRGB, gAMA, ICC, etc.
|
169
168
|
- Eliminates unused colors and reduces bit-depth (if possible)
|
170
169
|
- May reduce PNG file size lossless
|
171
170
|
|
172
|
-
Batch-optimize all `*.png` files in a directory:
|
173
|
-
|
174
|
-
geordi png-optimize directory
|
175
171
|
|
176
|
-
|
172
|
+
### `geordi purge-kernels`
|
177
173
|
|
178
|
-
|
179
|
-
|
180
|
-
Optimize a single file:
|
181
|
-
|
182
|
-
geordi png-optimize input.png
|
183
|
-
|
184
|
-
|
185
|
-
### geordi purge-kernels
|
186
|
-
|
187
|
-
Purge linux kernels older than the current one.
|
174
|
+
[sudo] Purge linux kernels older than the current one.
|
188
175
|
|
189
176
|
Example: `sudo geordi purge-kernels`
|
190
177
|
|
@@ -195,7 +182,7 @@ This script will retrieve and print a list of all current or older kernels. If
|
|
195
182
|
confirmed, it will then purge all kernels older than the current one.
|
196
183
|
|
197
184
|
|
198
|
-
### geordi rake TASK
|
185
|
+
### `geordi rake TASK`
|
199
186
|
|
200
187
|
Run a rake task in several Rails environments.
|
201
188
|
|
@@ -208,12 +195,12 @@ Example: `geordi rake db:migrate`
|
|
208
195
|
- cucumber
|
209
196
|
|
210
197
|
|
211
|
-
### geordi remove-executable-flags
|
198
|
+
### `geordi remove-executable-flags`
|
212
199
|
|
213
200
|
Remove executable-flags from files that should not be executable.
|
214
201
|
|
215
202
|
|
216
|
-
### geordi rspec [FILES]
|
203
|
+
### `geordi rspec [FILES]`
|
217
204
|
|
218
205
|
Run RSpec.
|
219
206
|
|
@@ -223,7 +210,7 @@ Runs RSpec as you want: with RSpec 1/2 detection, `bundle exec`, rspec_spinner
|
|
223
210
|
detection, etc.
|
224
211
|
|
225
212
|
|
226
|
-
### geordi security-update [STEP]
|
213
|
+
### `geordi security-update [STEP]`
|
227
214
|
|
228
215
|
Support for performing security updates.
|
229
216
|
|
@@ -235,7 +222,12 @@ Switches branches, pulls, pushes and deploys as required by our workflow. Tells
|
|
235
222
|
what it will do before it does it.
|
236
223
|
|
237
224
|
|
238
|
-
### geordi
|
225
|
+
### `geordi server [PORT]`
|
226
|
+
|
227
|
+
Start a development server.
|
228
|
+
|
229
|
+
|
230
|
+
### `geordi setup`
|
239
231
|
|
240
232
|
Setup a project for the first time.
|
241
233
|
|
@@ -257,7 +249,7 @@ After setting up, runs all tests when called with the `--test` option:
|
|
257
249
|
See `geordi help setup` for details.
|
258
250
|
|
259
251
|
|
260
|
-
### geordi shell TARGET
|
252
|
+
### `geordi shell TARGET`
|
261
253
|
|
262
254
|
Open a shell on a Capistrano deploy target.
|
263
255
|
|
@@ -268,17 +260,17 @@ Lets you select the server to connect to when called with `--select-server`:
|
|
268
260
|
geordi shell production -s
|
269
261
|
|
270
262
|
|
271
|
-
### geordi tests
|
263
|
+
### `geordi tests`
|
272
264
|
|
273
265
|
Run all employed tests.
|
274
266
|
|
275
267
|
|
276
|
-
### geordi unit
|
268
|
+
### `geordi unit`
|
277
269
|
|
278
270
|
Run Test::Unit.
|
279
271
|
|
280
272
|
|
281
|
-
### geordi update
|
273
|
+
### `geordi update`
|
282
274
|
|
283
275
|
Bring a project up to date.
|
284
276
|
|
@@ -298,12 +290,12 @@ After updating, runs all tests when called with the `--test` option:
|
|
298
290
|
See `geordi help update` for details.
|
299
291
|
|
300
292
|
|
301
|
-
### geordi version
|
293
|
+
### `geordi version`
|
302
294
|
|
303
295
|
Print the current version of geordi.
|
304
296
|
|
305
297
|
|
306
|
-
### geordi vnc
|
298
|
+
### `geordi vnc`
|
307
299
|
|
308
300
|
Show the hidden VNC window.
|
309
301
|
|
@@ -355,7 +347,7 @@ calling your local geordi like so (adjust paths to your needs):
|
|
355
347
|
ruby -I ../geordi/lib ../geordi/bin/geordi <command>
|
356
348
|
|
357
349
|
Don't forget to update this README. The whole `geordi` section is auto-generated
|
358
|
-
by `rake
|
350
|
+
by `rake readme`.
|
359
351
|
|
360
352
|
Geordi is (partially) tested with Cucumber and Aruba. Run all tests with `rake`.
|
361
353
|
Of course you're free to use `geordi tests` ;)
|
data/Rakefile
CHANGED
@@ -8,12 +8,12 @@ task :features do
|
|
8
8
|
system 'cucumber'
|
9
9
|
end
|
10
10
|
|
11
|
-
task :
|
11
|
+
task :readme do
|
12
12
|
require File.expand_path('../lib/geordi/cli', __FILE__)
|
13
13
|
|
14
14
|
readme = File.read('README.md')
|
15
15
|
geordi_section_regex = /
|
16
|
-
geordi
|
16
|
+
`geordi`\n
|
17
17
|
-{3,} # 3 dashes or more
|
18
18
|
.*? # anything, non-greedy
|
19
19
|
(?= # stop before:
|
@@ -22,22 +22,24 @@ task :update_readme do
|
|
22
22
|
/xm
|
23
23
|
|
24
24
|
geordi_section = <<-TEXT
|
25
|
-
geordi
|
26
|
-
|
25
|
+
`geordi`
|
26
|
+
--------
|
27
27
|
|
28
|
-
The
|
28
|
+
The `geordi` binary holds most of the utility commands. For the few other
|
29
|
+
binaries, see the bottom of this file.
|
29
30
|
|
30
|
-
You may abbreviate commands by typing only
|
31
|
-
|
32
|
-
tests afterwards.
|
31
|
+
You may abbreviate commands by typing only their first letters, e.g. `geordi
|
32
|
+
con` will boot a development console, `geordi set -t` will setup a project and
|
33
|
+
run tests afterwards.
|
33
34
|
|
34
|
-
For details on commands, e.g. supported options,
|
35
|
+
For details on commands, e.g. supported options, you may always run
|
36
|
+
`geordi help <command>`.
|
35
37
|
|
36
38
|
TEXT
|
37
39
|
|
38
40
|
Geordi::CLI.all_commands.sort.each do |_, command|
|
39
41
|
unless command.hidden?
|
40
|
-
geordi_section << "### geordi #{ command.usage }
|
42
|
+
geordi_section << "### `geordi #{ command.usage }`\n\n"
|
41
43
|
geordi_section << "#{ command.description.sub /(\.)?$/, '.' }\n\n"
|
42
44
|
geordi_section << "#{ command.long_description.strip }\n\n" if command.long_description
|
43
45
|
geordi_section << "\n"
|
data/features/cucumber.feature
CHANGED
@@ -123,7 +123,26 @@ Feature: The cucumber command
|
|
123
123
|
Then the output should contain "# Running features"
|
124
124
|
And the output should match /^> .*cucumber .*--tags ~@solo/
|
125
125
|
But the output should not contain "# Running @solo features"
|
126
|
-
|
126
|
+
|
127
|
+
|
128
|
+
Scenario: When called with line numbers, the @solo extra run is skipped
|
129
|
+
|
130
|
+
Note that with line numbers in the passed file names, features are run
|
131
|
+
serially.
|
132
|
+
|
133
|
+
Given a file named "features/example.feature" with:
|
134
|
+
"""
|
135
|
+
Feature: Test without solo tag
|
136
|
+
Scenario: Example scenario
|
137
|
+
Scenario: Other scenario
|
138
|
+
"""
|
139
|
+
|
140
|
+
When I run `geordi cucumber --verbose features/example.feature:2`
|
141
|
+
Then the output should contain "# Running features"
|
142
|
+
But the output should not contain "# Running @solo features"
|
143
|
+
# Regression test, with line numbers grep would fail with:
|
144
|
+
# grep: features/example.feature:2: No such file or directory
|
145
|
+
And the output should not contain "No such file or directory"
|
127
146
|
|
128
147
|
|
129
148
|
Scenario: Specifying a firefox version to use
|
data/features/firefox.feature
CHANGED
@@ -51,3 +51,8 @@ Feature: The firefox/chrome command
|
|
51
51
|
Then the output should contain "> VNC is ready"
|
52
52
|
And the output should contain "testcontent"
|
53
53
|
But the output should not contain "Firefox for Selenium"
|
54
|
+
|
55
|
+
|
56
|
+
Scenario: Running --setup without a version prints an error
|
57
|
+
When I run `geordi firefox --setup`
|
58
|
+
Then the output should contain "Firefox version required"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Feature: The server/devserver command
|
2
|
+
|
3
|
+
Scenario: Booting a development server
|
4
|
+
When I run `geordi server`
|
5
|
+
Then the output should contain "http://aruba.vcap.me:3000"
|
6
|
+
And the output should contain "Util.system! bundle exec rails server -p 3000 -b 0.0.0.0"
|
7
|
+
|
8
|
+
|
9
|
+
Scenario: Passing a port as argument
|
10
|
+
When I run `geordi server 3001`
|
11
|
+
Then the output should contain "http://aruba.vcap.me:3001"
|
12
|
+
And the output should contain "Util.system! bundle exec rails server -p 3001 -b 0.0.0.0"
|
13
|
+
|
14
|
+
|
15
|
+
Scenario: Passing a port as option
|
16
|
+
When I run `geordi server -p 3001`
|
17
|
+
Then the output should contain "http://aruba.vcap.me:3001"
|
18
|
+
And the output should contain "Util.system! bundle exec rails server -p 3001 -b 0.0.0.0"
|
19
|
+
|
20
|
+
|
21
|
+
Scenario: The command is aliased for backwards compatibility
|
22
|
+
When I run `geordi devserver`
|
23
|
+
Then the output should contain "Util.system! bundle exec rails server -p 3000 -b 0.0.0.0"
|
24
|
+
|
@@ -49,15 +49,20 @@ def cucumber(*args)
|
|
49
49
|
end
|
50
50
|
|
51
51
|
# Serial run of @solo scenarios
|
52
|
-
files
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
if files.any? { |f| f.include? ':' }
|
53
|
+
note '@solo run skipped when called with line numbers' if options.verbose
|
54
|
+
else
|
55
|
+
files << 'features' if files.empty? # Proper grepping
|
56
|
+
solo_tag_usages = `grep -r '@solo' #{ files.join(' ') }`.split("\n")
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
58
|
+
if solo_tag_usages.any?
|
59
|
+
cmd_opts << '--tags' << '@solo'
|
60
|
+
|
61
|
+
announce 'Running @solo features'
|
62
|
+
Geordi::Cucumber.new.run files, cmd_opts, :verbose => options.verbose, :parallel => false
|
63
|
+
end
|
60
64
|
|
65
|
+
end
|
61
66
|
else
|
62
67
|
note 'Cucumber not employed.'
|
63
68
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
desc 'deploy [STAGE]', 'Guided deployment across branches'
|
2
2
|
long_desc <<-LONGDESC
|
3
|
-
Example: `geordi deploy
|
3
|
+
Example: `geordi deploy` or `geordi deploy p[roduction]`
|
4
4
|
|
5
5
|
Merge, push and deploy with a single command! There are several scenarios where
|
6
6
|
this command comes in handy:
|
@@ -8,7 +8,7 @@ this command comes in handy:
|
|
8
8
|
1) *Production deploy:* From the master branch, run `geordi deploy production`.
|
9
9
|
This will merge `master` to `production`, push and deploy to production.
|
10
10
|
|
11
|
-
2) *Feature branch deploy:* From
|
11
|
+
2) *Feature branch deploy:* From a feature branch, run `geordi deploy staging`.
|
12
12
|
This will merge the feature branch to `master`, push and deploy to staging.
|
13
13
|
|
14
14
|
3) *Simple deploy:* If the source branch matches the target branch, merging will
|
@@ -17,8 +17,13 @@ this command comes in handy:
|
|
17
17
|
Calling the command without arguments will infer the target stage from the
|
18
18
|
current branch and fall back to master/staging.
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
Finds available Capistrano stages by their prefix, e.g. `geordi deploy p` will
|
21
|
+
deploy production, `geordi deploy mak` will deploy a `makandra` stage if there
|
22
|
+
is a file config/deploy/makandra.rb.
|
23
|
+
|
24
|
+
When your project is running Capistrano 3, deployment will use `cap deploy`
|
25
|
+
instead of `cap deploy:migrations`. You can force using `deploy` by passing the
|
26
|
+
-M option: `geordi deploy -M staging`.
|
22
27
|
LONGDESC
|
23
28
|
|
24
29
|
option :no_migrations, :aliases => '-M', :type => :boolean,
|
@@ -27,31 +32,40 @@ option :no_migrations, :aliases => '-M', :type => :boolean,
|
|
27
32
|
def deploy(target_stage = nil)
|
28
33
|
# Set/Infer default values
|
29
34
|
branch_stage_map = { 'master' => 'staging', 'production' => 'production'}
|
35
|
+
if target_stage and not Util.deploy_targets.include? target_stage
|
36
|
+
# Target stage autocompletion from available stages
|
37
|
+
target_stage = Util.deploy_targets.find { |t| t.start_with? target_stage }
|
38
|
+
end
|
30
39
|
proposed_stage = target_stage || branch_stage_map.fetch(Util.current_branch, 'staging')
|
31
40
|
|
32
|
-
|
41
|
+
# Ask for required information
|
42
|
+
target_stage = prompt 'Deployment stage:', proposed_stage
|
33
43
|
source_branch = prompt 'Source branch:', Util.current_branch
|
34
44
|
target_branch = prompt 'Deploy branch:', branch_stage_map.invert.fetch(target_stage, 'master')
|
35
45
|
|
36
46
|
merge_needed = (source_branch != target_branch)
|
47
|
+
push_needed = merge_needed || `git cherry -v | wc -l`.strip.to_i > 0
|
37
48
|
|
38
49
|
announce "Checking whether your #{source_branch} branch is ready"
|
39
50
|
if `git status -s | wc -l`.strip != '0'
|
40
|
-
|
51
|
+
warn "Your #{source_branch} branch holds uncommitted changes."
|
52
|
+
prompt('Continue anyway?', 'n', /y|yes/) or fail 'Cancelled.'
|
41
53
|
else
|
42
54
|
note 'All good.'
|
43
55
|
end
|
44
56
|
|
45
57
|
if merge_needed
|
46
|
-
announce "Checking what's in your #{target_branch} branch right now"
|
58
|
+
announce "Checking what's in your #{target_branch} branch right now" #######
|
47
59
|
Util.system! "git checkout #{target_branch} && git pull"
|
48
60
|
end
|
49
61
|
|
50
|
-
announce
|
51
|
-
note "
|
52
|
-
|
62
|
+
announce 'You are about to:' #################################################
|
63
|
+
note "Merge branch #{source_branch} into #{target_branch}" if merge_needed
|
64
|
+
if push_needed
|
65
|
+
note 'Push these commits:' if push_needed
|
66
|
+
Util.system! "git --no-pager log origin/#{target_branch}..#{source_branch} --oneline"
|
67
|
+
end
|
53
68
|
note "Deploy to #{target_stage}"
|
54
|
-
Util.system! "git --no-pager log origin/#{target_branch}..#{source_branch} --oneline"
|
55
69
|
|
56
70
|
if prompt('Go ahead with the deployment?', 'n', /y|yes/)
|
57
71
|
cap3 = file_containing?('Capfile', 'capistrano/setup')
|
@@ -59,10 +73,14 @@ def deploy(target_stage = nil)
|
|
59
73
|
capistrano_call << ':migrations' unless cap3 || options.no_migrations
|
60
74
|
capistrano_call = "bundle exec #{capistrano_call}" if file_containing?('Gemfile', /capistrano/)
|
61
75
|
|
76
|
+
invoke_cmd 'bundle_install'
|
77
|
+
|
62
78
|
puts
|
63
|
-
|
64
|
-
|
65
|
-
|
79
|
+
commands = []
|
80
|
+
commands << "git merge #{source_branch}" if merge_needed
|
81
|
+
commands << 'git push' if push_needed
|
82
|
+
commands << capistrano_call
|
83
|
+
Util.system! commands.join(' && '), :show_cmd => true
|
66
84
|
|
67
85
|
success 'Deployment complete.'
|
68
86
|
else
|
data/lib/geordi/commands/dump.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
desc 'eurest', 'Open the current Eurest cantina menu'
|
1
|
+
desc 'eurest', 'Open the current Eurest cantina menu', :hide => true
|
2
2
|
def eurest
|
3
3
|
Util.system! %{file="Speiseplan_KW`date +%V`.pdf" && wget -O/tmp/$file http://www.eurest-extranet.de/eurest/export/sites/default/sigma-technopark/de/downloads/$file && xdg-open /tmp/$file}
|
4
4
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
desc 'firefox COMMAND', 'Run a command with VNC set up (
|
1
|
+
desc 'firefox COMMAND', 'Run a command with VNC and test browser set up (alias: chrome)'
|
2
2
|
long_desc <<-LONGDESC
|
3
3
|
Example: `geordi firefox b cucumber` or `geordi firefox --setup 24.0`
|
4
4
|
|
@@ -10,11 +10,13 @@ Useful when you need Firefox for Selenium or the VNC set up, but can't use the
|
|
10
10
|
This command is aliased `chrome` for users running Selenium in Chrome.
|
11
11
|
LONGDESC
|
12
12
|
|
13
|
-
option :setup, :
|
14
|
-
:desc => 'Install a special test
|
13
|
+
option :setup, :banner => 'FIREFOX_VERSION',
|
14
|
+
:desc => 'Install a special test runner Firefox with the given version'
|
15
15
|
|
16
16
|
def firefox(*command)
|
17
17
|
if options.setup
|
18
|
+
fail 'Firefox version required (e.g. --setup 24.0)' if options.setup == 'setup'
|
19
|
+
|
18
20
|
require 'geordi/firefox_for_selenium'
|
19
21
|
Geordi::FirefoxForSelenium.install(options.setup)
|
20
22
|
|
@@ -1,20 +1,10 @@
|
|
1
1
|
desc 'png-optimize PATH', 'Optimize .png files'
|
2
2
|
long_desc <<-LONGDESC
|
3
|
+
Example: `geordi png-optimize some/directory`
|
4
|
+
|
3
5
|
- Removes color profiles: cHRM, sRGB, gAMA, ICC, etc.
|
4
6
|
- Eliminates unused colors and reduces bit-depth (if possible)
|
5
7
|
- May reduce PNG file size lossless
|
6
|
-
|
7
|
-
Batch-optimize all `*.png` files in a directory:
|
8
|
-
|
9
|
-
geordi png-optimize directory
|
10
|
-
|
11
|
-
Batch-optimize the current directory:
|
12
|
-
|
13
|
-
geordi png-optimize .
|
14
|
-
|
15
|
-
Optimize a single file:
|
16
|
-
|
17
|
-
geordi png-optimize input.png
|
18
8
|
LONGDESC
|
19
9
|
|
20
10
|
def png_optimize(path)
|
@@ -23,7 +13,7 @@ def png_optimize(path)
|
|
23
13
|
announce 'Optimizing .png files'
|
24
14
|
|
25
15
|
if `which pngcrush`.strip.empty?
|
26
|
-
fail '
|
16
|
+
fail 'Please install pngcrush first (sudo apt-get install pngcrush)'
|
27
17
|
end
|
28
18
|
|
29
19
|
po = PngOptimizer.new
|
@@ -0,0 +1,19 @@
|
|
1
|
+
desc 'server [PORT]', 'Start a development server'
|
2
|
+
|
3
|
+
option :port, :aliases => '-p', :default => '3000',
|
4
|
+
:desc => 'Choose a port'
|
5
|
+
|
6
|
+
def server(port = nil)
|
7
|
+
invoke_cmd 'bundle_install'
|
8
|
+
require 'geordi/util'
|
9
|
+
|
10
|
+
announce 'Booting a development server'
|
11
|
+
port ||= options.port
|
12
|
+
note "URL: http://#{ File.basename(Dir.pwd) }.vcap.me:#{port}"
|
13
|
+
puts
|
14
|
+
|
15
|
+
# -b 0.0.0.0: Allow connections from other machines, e.g. a testing iPad
|
16
|
+
Util.system! Util.server_command, "-p #{ port }", '-b 0.0.0.0'
|
17
|
+
end
|
18
|
+
|
19
|
+
map 'devserver' => 'server'
|
@@ -1,9 +1,14 @@
|
|
1
1
|
desc 'tests', 'Run all employed tests'
|
2
2
|
def tests
|
3
|
-
invoke_cmd 'with_rake'
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
rake_result = invoke_cmd 'with_rake'
|
4
|
+
|
5
|
+
if rake_result == :did_not_perform
|
6
|
+
# Since `rake` usually runs all tests, only run them here if `rake` did not
|
7
|
+
# perform
|
8
|
+
invoke_cmd 'unit'
|
9
|
+
invoke_cmd 'rspec'
|
10
|
+
invoke_cmd 'cucumber'
|
11
|
+
end
|
7
12
|
|
8
13
|
success 'Successfully ran tests.'
|
9
14
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
desc 'with-rake', 'Run tests with `rake`', :hide => true
|
2
2
|
def with_rake
|
3
|
-
if file_containing?('Rakefile', /^task.+default.+(spec|test)/)
|
3
|
+
if file_containing?('Rakefile', /^task.+default.+(spec|test|feature)/)
|
4
4
|
invoke_cmd 'bundle_install'
|
5
5
|
|
6
6
|
announce 'Running tests with `rake`'
|
7
7
|
Util.system! 'rake'
|
8
8
|
else
|
9
9
|
note '`rake` does not run tests.'
|
10
|
+
:did_not_perform
|
10
11
|
end
|
11
12
|
end
|
@@ -132,10 +132,10 @@ module Geordi
|
|
132
132
|
|
133
133
|
puts strip_heredoc(<<-INSTRUCTION)
|
134
134
|
Please download an old version of Firefox from: #{download_url}
|
135
|
-
Unpack it with: tar
|
135
|
+
Unpack it with: tar xjf firefox-#{@version}.tar.bz2 -C #{path} --strip-components=1
|
136
136
|
Now #{path.join('firefox')} should be the firefox binary, not a directory.
|
137
137
|
INSTRUCTION
|
138
|
-
prompt
|
138
|
+
prompt 'Continue?'
|
139
139
|
|
140
140
|
File.file?(binary) or raise "Could not find #{binary}"
|
141
141
|
end
|
@@ -170,15 +170,15 @@ module Geordi
|
|
170
170
|
This script will open the patched copy of Firefox when you press ENTER.
|
171
171
|
Please perform the following steps manually:
|
172
172
|
|
173
|
+
- IMPORTANT: Quickly disable all automatic updates under Edit /
|
174
|
+
Preferences / Advanced / Update
|
173
175
|
- Disable the default browser check when Firefox launches
|
174
176
|
- Check that the version number is correct (#{@version})
|
175
177
|
- You should not see your bookmarks, add-ons, plugins from your regular
|
176
178
|
Firefox profile
|
177
|
-
- Disable all automatic updates under Edit / Preferences / Advanced /
|
178
|
-
Update (do this quickly or Firefox will already have updated)
|
179
179
|
INSTRUCTION
|
180
180
|
|
181
|
-
prompt '
|
181
|
+
prompt 'Will open the patched copy of Firefox now'
|
182
182
|
run_firefox_for_selenium
|
183
183
|
end
|
184
184
|
|
data/lib/geordi/util.rb
CHANGED
data/lib/geordi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geordi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- features/dump.feature
|
81
81
|
- features/firefox.feature
|
82
82
|
- features/launchy_browser.feature
|
83
|
+
- features/server.feature
|
83
84
|
- features/shell.feature
|
84
85
|
- features/support/env.rb
|
85
86
|
- geordi.gemspec
|
@@ -98,7 +99,6 @@ files:
|
|
98
99
|
- lib/geordi/commands/create_databases.rb
|
99
100
|
- lib/geordi/commands/cucumber.rb
|
100
101
|
- lib/geordi/commands/deploy.rb
|
101
|
-
- lib/geordi/commands/devserver.rb
|
102
102
|
- lib/geordi/commands/dump.rb
|
103
103
|
- lib/geordi/commands/eurest.rb
|
104
104
|
- lib/geordi/commands/firefox.rb
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- lib/geordi/commands/remove_executable_flags.rb
|
110
110
|
- lib/geordi/commands/rspec.rb
|
111
111
|
- lib/geordi/commands/security_update.rb
|
112
|
+
- lib/geordi/commands/server.rb
|
112
113
|
- lib/geordi/commands/setup.rb
|
113
114
|
- lib/geordi/commands/shell.rb
|
114
115
|
- lib/geordi/commands/tests.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
desc 'devserver', 'Start a development server'
|
2
|
-
|
3
|
-
option :port, :aliases => '-p', :default => '3000'
|
4
|
-
|
5
|
-
def devserver
|
6
|
-
invoke_cmd 'bundle_install'
|
7
|
-
require 'geordi/util'
|
8
|
-
|
9
|
-
announce 'Booting a development server'
|
10
|
-
note "URL: http://#{File.basename(Dir.pwd)}.vcap.me:#{options.port}"
|
11
|
-
puts
|
12
|
-
|
13
|
-
Util.system! Util.server_command + " -p #{options.port}"
|
14
|
-
end
|