geordi 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.6.3
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - '1.8.7'
5
+ - '2.6.3'
6
+
7
+ gemfile:
8
+ - 'Gemfile'
9
+
10
+ dist: trusty
11
+
12
+ install:
13
+ # Replace default Travis CI bundler script with a version that doesn't
14
+ # explode when lockfile doesn't match recently bumped version
15
+ - bundle install --no-deployment --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
16
+
17
+ script: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ### Compatible changes
10
+
11
+ ### Breaking changes
12
+
13
+ ## 2.3.0 2019-08-27
14
+
15
+ ### Compatible changes
16
+ - Fixes [#70]: Make "console" and "server" commands ready for Rails 6
17
+ - Added: CI testing with Travis
18
+
9
19
  ## 2.2.0 2019-02-28
10
20
 
11
21
  ### Compatible changes
data/Gemfile CHANGED
@@ -5,8 +5,6 @@ gemspec
5
5
 
6
6
  gem 'aruba'
7
7
  gem 'rspec-mocks'
8
- gem 'pry'
9
8
  gem 'highline'
10
-
11
- # Required for running features that test parallel test execution
12
- gem 'parallel_tests' if ENV['GEORDI_TESTING']
9
+ gem 'parallel_tests'
10
+ gem 'launchy'
data/Gemfile.lock CHANGED
@@ -1,49 +1,38 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (2.1.0)
4
+ geordi (2.3.0)
5
5
  thor (>= 0.18.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- aruba (0.13.0)
11
- childprocess (~> 0.5.6)
12
- contracts (~> 0.9)
13
- cucumber (>= 1.3.19)
14
- ffi (~> 1.9.10)
15
- rspec-expectations (>= 2.99)
16
- thor (~> 0.19)
17
- builder (3.2.2)
18
- childprocess (0.5.9)
19
- ffi (~> 1.0, >= 1.0.11)
20
- coderay (1.1.0)
21
- contracts (0.13.0)
22
- cucumber (2.3.2)
10
+ addressable (2.3.8)
11
+ aruba (0.6.2)
12
+ childprocess (>= 0.3.6)
13
+ cucumber (>= 1.1.1)
14
+ rspec-expectations (>= 2.7.0)
15
+ builder (3.2.3)
16
+ childprocess (1.0.1)
17
+ rake (< 13.0)
18
+ cucumber (1.3.20)
23
19
  builder (>= 2.1.2)
24
- cucumber-core (~> 1.4.0)
25
- cucumber-wire (~> 0.0.1)
26
20
  diff-lcs (>= 1.1.3)
27
- gherkin (~> 3.2.0)
21
+ gherkin (~> 2.12)
28
22
  multi_json (>= 1.7.5, < 2.0)
29
23
  multi_test (>= 0.1.2)
30
- cucumber-core (1.4.0)
31
- gherkin (~> 3.2.0)
32
- cucumber-wire (0.0.1)
33
24
  diff-lcs (1.2.5)
34
- ffi (1.9.10)
35
- gherkin (3.2.0)
36
- highline (1.7.8)
37
- method_source (0.8.2)
38
- multi_json (1.11.2)
25
+ gherkin (2.12.2)
26
+ multi_json (~> 1.3)
27
+ highline (1.6.21)
28
+ launchy (2.4.3)
29
+ addressable (~> 2.3)
30
+ multi_json (1.13.1)
39
31
  multi_test (0.1.2)
40
- parallel (1.12.1)
41
- parallel_tests (2.23.0)
32
+ parallel (0.5.16)
33
+ parallel_tests (0.6.18)
42
34
  parallel
43
- pry (0.10.3)
44
- coderay (~> 1.1.0)
45
- method_source (~> 0.8.1)
46
- slop (~> 3.4)
35
+ rake (10.5.0)
47
36
  rspec-expectations (3.4.0)
48
37
  diff-lcs (>= 1.2.0, < 2.0)
49
38
  rspec-support (~> 3.4.0)
@@ -51,7 +40,6 @@ GEM
51
40
  diff-lcs (>= 1.2.0, < 2.0)
52
41
  rspec-support (~> 3.4.0)
53
42
  rspec-support (3.4.1)
54
- slop (3.6.0)
55
43
  thor (0.19.1)
56
44
 
57
45
  PLATFORMS
@@ -61,9 +49,9 @@ DEPENDENCIES
61
49
  aruba
62
50
  geordi!
63
51
  highline
52
+ launchy
64
53
  parallel_tests
65
- pry
66
54
  rspec-mocks
67
55
 
68
56
  BUNDLED WITH
69
- 1.17.1
57
+ 1.17.3
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Geordi
1
+ Geordi [![Build Status](https://travis-ci.org/makandra/geordi.svg?branch=master)](https://travis-ci.org/makandra/geordi)
2
2
  ======
3
3
 
4
4
  Geordi is a collection of command line tools we use in our daily work with
@@ -375,10 +375,5 @@ calling your local geordi like so (adjust paths to your needs):
375
375
  Don't forget to update this README. The whole `geordi` section is auto-generated
376
376
  by `rake readme`. Also remember to add your changes to the CHANGELOG.
377
377
 
378
- Geordi is (partially) tested with Cucumber and Aruba. Run all tests with `rake`.
379
- Of course you're free to use `geordi tests` ;)
380
-
381
- **Note** that Geordi still needs to support Ruby 1.8.7, so make sure you only
382
- use syntax that was valid back then (e.g. the :old => hash syntax).
383
- Unfortunately, it is really hard to get Geordi's tests running on 1.8.7, so you
384
- need to make sure it runs on 1.8.7 manually.
378
+ Geordi is (partially) tested with Cucumber and Aruba. Run `bundle exec rake` to test the gem against you current Ruby
379
+ version. The `travis.yml` contains all Ruby versions the gem is and needs to be tested with.
@@ -4,4 +4,4 @@ Feature: The console command
4
4
  Scenario: Opening a local Rails console
5
5
  When I run `geordi console`
6
6
  Then the output should contain "# Opening a local Rails console"
7
- And the output should contain "Util.system! bundle exec rails console development"
7
+ And the output should contain "Util.system! bundle exec rails console -e development"
@@ -122,7 +122,7 @@ Feature: The cucumber command
122
122
 
123
123
  When I run `geordi cucumber features/no_solo --verbose`
124
124
  Then the output should contain "# Running features"
125
- And the output should match /^> .*cucumber .*--tags \"~@solo\"/
125
+ And the output should match /^> .*features .*--tags \"~@solo\"/
126
126
  But the output should not contain "# Running @solo features"
127
127
 
128
128
 
@@ -157,7 +157,7 @@ Feature: The cucumber command
157
157
  """
158
158
 
159
159
  When I run `geordi cucumber --verbose`
160
- Then the output should match /^> PATH=.*24.0:\$PATH.* cucumber/
160
+ Then the output should match /^> PATH=.*24.0:\$PATH.* features/
161
161
 
162
162
 
163
163
  Scenario: Running all cucumber features matching a given string
@@ -27,6 +27,8 @@ Feature: The dump command
27
27
  And the output should contain "Util.system! ssh, user@www.example.com, -t, cd /var/www/example.com/current && bash --login -c 'dumple staging --for_download'"
28
28
  And the output should contain "> Downloading remote dump to tmp/staging.dump"
29
29
  # Omitting the absolute path in this regex (.*)
30
- And the output should match %r<Util.system! scp -C user@www.example.com:~/dumps/dump_for_download.dump .*/tmp/aruba/tmp/staging.dump>
30
+ And the output should match:
31
+ """
32
+ Util\.system! scp -C user@www\.example\.com:~\/dumps\/dump_for_download.dump .*?\/tmp\/aruba\/tmp\/staging.dump
33
+ """
31
34
  And the output should contain "> Dumped the staging database to tmp/staging.dump"
32
-
@@ -1,8 +1,5 @@
1
1
  require 'aruba/cucumber'
2
2
  require 'pry'
3
3
 
4
- # require 'geordi'
5
- # require 'cucumber/rspec/doubles'
6
-
7
4
  # Disables execution of Util.system! calls
8
5
  ENV['GEORDI_TESTING'] = 'true'
@@ -0,0 +1,5 @@
1
+ Given(/^(?:a|the) file(?: named)? "([^"]*)" with "([^"]*)"$/) do |file_name, file_content|
2
+ unescape_content = file_content.gsub('\n', "\n").gsub('\"', '"').gsub('\e', "\e").gsub('\033', "\e").gsub('\016', "\016").gsub('\017', "\017").gsub('\t', "\t")
3
+
4
+ write_file(file_name, unescape_content)
5
+ end
@@ -69,7 +69,7 @@ def deploy(target_stage = nil)
69
69
 
70
70
  if prompt('Go ahead with the deployment?', 'n', /y|yes/)
71
71
  capistrano_call = "cap #{target_stage} deploy"
72
- capistrano_call << ':migrations' unless Util.capistrano3? || options.no_migrations
72
+ capistrano_call << ':migrations' unless Util.gem_major_version('capistrano') == 3 || options.no_migrations
73
73
  capistrano_call = "bundle exec #{capistrano_call}" if Util.file_containing?('Gemfile', /capistrano/)
74
74
 
75
75
  invoke_cmd 'bundle_install'
@@ -43,7 +43,7 @@ def security_update(step='prepare')
43
43
  Util.system! 'git push', :show_cmd => true
44
44
 
45
45
  announce 'Deploying all targets'
46
- deploy = Util.capistrano3? ? 'deploy' : 'deploy:migrations'
46
+ deploy = (Util.gem_major_version('capistrano') == 3) ? 'deploy' : 'deploy:migrations'
47
47
  invoke_cmd 'capistrano', deploy
48
48
 
49
49
  success 'Successfully pushed and deployed security update'
@@ -80,7 +80,7 @@ module Geordi
80
80
  note 'Using parallel_tests'
81
81
  self.argv = argv - command_line_features
82
82
 
83
- type_arg = Gem::Version.new(parallel_tests_version) > Gem::Version.new('0.7.0') ? 'cucumber' : 'features'
83
+ type_arg = Util.gem_version('parallel_tests') > Gem::Version.new('0.7.0') ? 'cucumber' : 'features'
84
84
  features = features_to_run
85
85
  features = find_all_features_recursively('features') if features.empty?
86
86
 
@@ -93,7 +93,7 @@ module Geordi
93
93
  end
94
94
 
95
95
  def not_tag(name)
96
- if cucumber_version < '3'
96
+ if Util.gem_major_version('cucumber') < 3
97
97
  "~#{name}"
98
98
  else
99
99
  "not #{name}"
@@ -200,35 +200,10 @@ module Geordi
200
200
  @spinner_available ||= File.exists?('Gemfile') && File.open('Gemfile').read.scan(/cucumber_spinner/).any?
201
201
  end
202
202
 
203
- def parallel_tests_available?
204
- not parallel_tests_version.nil?
205
- end
206
-
207
- def parallel_tests_version
208
- @parallel_tests_version ||= gem_version('parallel_tests')
209
- end
210
-
211
- def cucumber_version
212
- @cucumber_version ||= gem_version('cucumber')
213
- end
214
-
215
- # Get the version string for the given gem by parsing Gemfile.lock.
216
- # Returns nil if the gem is not used.
217
- def gem_version(gem)
218
- gem_line = bundle_list.split("\n").detect{ |x| x.include?(gem) }
219
- if gem_line
220
- gem_line.scan( /\(([\d\.]+).*\)/ ).flatten.first
221
- end
222
- end
223
-
224
- def bundle_list
225
- @bundle_list ||= `bundle list`
226
- end
227
-
228
203
  def use_parallel_tests?(options)
229
204
  options.fetch(:parallel, true) &&
230
205
  features_to_run.size != 1 &&
231
- parallel_tests_available? &&
206
+ Util.gem_available?('parallel_tests') &&
232
207
  features_to_run.none? { |f| f.include? ':' }
233
208
  end
234
209
 
data/lib/geordi/util.rb CHANGED
@@ -55,18 +55,20 @@ module Geordi
55
55
  end
56
56
 
57
57
  def console_command(environment)
58
- if File.exists?('script/console')
59
- 'script/console ' + environment # Rails 2
60
- else
58
+ if gem_major_version('rails') == 2
59
+ 'script/console ' + environment
60
+ elsif gem_major_version('rails') == 3
61
61
  'bundle exec rails console ' + environment
62
+ else
63
+ "bundle exec rails console -e #{environment}"
62
64
  end
63
65
  end
64
66
 
65
67
  def server_command
66
- if File.exists?('script/server')
67
- 'script/server ""' # Rails 2
68
+ if gem_major_version('rails') == 2
69
+ 'script/server ""'
68
70
  else
69
- 'bundle exec rails server' # Rails 3+
71
+ 'bundle exec rails server'
70
72
  end
71
73
  end
72
74
 
@@ -112,14 +114,41 @@ module Geordi
112
114
  input_string.lines.map(&:chomp).map(&:strip)
113
115
  end
114
116
 
115
- def capistrano3?
116
- Util.file_containing? 'Capfile', 'capistrano/setup'
117
+ def gem_available?(gem)
118
+ !!gem_version(gem)
119
+ end
120
+
121
+ # Get the major version or for the given gem by parsing the Gemfile.lock.
122
+ # Returns nil if the gem is not used.
123
+ def gem_major_version(gem)
124
+ gem_version = gem_version(gem)
125
+ gem_version && gem_version.segments[0]
126
+ end
127
+
128
+ # Get the version for the given gem by parsing Gemfile.lock.
129
+ # Returns nil if the gem is not used.
130
+ def gem_version(gem)
131
+ # Lines look like `* will_paginate (2.3.15)` or `railslts-version (2.3.18.16 7f51cc7)`
132
+ bundle_list.split("\n").each do |line|
133
+ matches = line.match(/\* #{gem} \(([\d\.]+)/)
134
+ next if matches.nil? || matches[1].nil?
135
+
136
+ return Gem::Version.new(matches[1])
137
+ end
138
+
139
+ nil
117
140
  end
118
141
 
119
142
  def file_containing?(file, regex)
120
143
  File.exists?(file) and File.read(file).scan(regex).any?
121
144
  end
122
145
 
146
+ private
147
+
148
+ def bundle_list
149
+ @bundle_list ||= `bundle list`
150
+ end
151
+
123
152
  end
124
153
  end
125
154
  end
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '2.2.0'
2
+ VERSION = '2.3.0'
3
3
  end
metadata CHANGED
@@ -1,34 +1,43 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
- version: !ruby/object:Gem::Version
4
- version: 2.2.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
+ prerelease:
6
+ segments:
7
+ - 2
8
+ - 3
9
+ - 0
10
+ version: 2.3.0
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - Henning Koch
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
- date: 2019-02-28 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2019-08-27 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
14
22
  name: thor
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 0.18.0
20
- type: :runtime
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
24
27
  - - ">="
25
- - !ruby/object:Gem::Version
28
+ - !ruby/object:Gem::Version
29
+ hash: 87
30
+ segments:
31
+ - 0
32
+ - 18
33
+ - 0
26
34
  version: 0.18.0
27
- description: Collection of command line tools we use in our daily work with Ruby,
28
- Rails and Linux at makandra.
29
- email:
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: Collection of command line tools we use in our daily work with Ruby, Rails and Linux at makandra.
38
+ email:
30
39
  - henning.koch@makandra.de
31
- executables:
40
+ executables:
32
41
  - b
33
42
  - cap-all
34
43
  - console-for
@@ -48,10 +57,13 @@ executables:
48
57
  - shell-for
49
58
  - tests
50
59
  extensions: []
60
+
51
61
  extra_rdoc_files: []
52
- files:
53
- - ".gitignore"
54
- - ".ruby-version"
62
+
63
+ files:
64
+ - .gitignore
65
+ - .ruby-version
66
+ - .travis.yml
55
67
  - CHANGELOG.md
56
68
  - Gemfile
57
69
  - Gemfile.lock
@@ -80,10 +92,10 @@ files:
80
92
  - features/cucumber.feature
81
93
  - features/dump.feature
82
94
  - features/firefox.feature
83
- - features/launchy_browser.feature
84
95
  - features/server.feature
85
96
  - features/shell.feature
86
97
  - features/support/env.rb
98
+ - features/support/step_definitions/aruba_backport_steps.rb
87
99
  - geordi.gemspec
88
100
  - lib/geordi.rb
89
101
  - lib/geordi/COMMAND_TEMPLATE
@@ -130,29 +142,41 @@ files:
130
142
  - lib/geordi/remote.rb
131
143
  - lib/geordi/util.rb
132
144
  - lib/geordi/version.rb
145
+ has_rdoc: true
133
146
  homepage: http://makandra.com
134
- licenses:
147
+ licenses:
135
148
  - MIT
136
- metadata: {}
137
- post_install_message: "* Binary `geordi` installed\n"
149
+ post_install_message: |
150
+ * Binary `geordi` installed
151
+
138
152
  rdoc_options: []
139
- require_paths:
153
+
154
+ require_paths:
140
155
  - lib
141
- required_ruby_version: !ruby/object:Gem::Requirement
142
- requirements:
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
143
159
  - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- required_rubygems_version: !ruby/object:Gem::Requirement
147
- requirements:
160
+ - !ruby/object:Gem::Version
161
+ hash: 3
162
+ segments:
163
+ - 0
164
+ version: "0"
165
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
+ none: false
167
+ requirements:
148
168
  - - ">="
149
- - !ruby/object:Gem::Version
150
- version: '0'
169
+ - !ruby/object:Gem::Version
170
+ hash: 3
171
+ segments:
172
+ - 0
173
+ version: "0"
151
174
  requirements: []
175
+
152
176
  rubyforge_project: geordi
153
- rubygems_version: 2.7.6
177
+ rubygems_version: 1.6.2
154
178
  signing_key:
155
- specification_version: 4
156
- summary: Collection of command line tools we use in our daily work with Ruby, Rails
157
- and Linux at makandra.
179
+ specification_version: 3
180
+ summary: Collection of command line tools we use in our daily work with Ruby, Rails and Linux at makandra.
158
181
  test_files: []
182
+
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA256:
3
- metadata.gz: 798b88d15991f16a8c7b78a2a7509f61181f47ecb838f1c4607db8f2686da166
4
- data.tar.gz: 7a4d7bf12621ff4c9d13759e80358e5f9f0cb4739ee538b32b7d4e97b3d0e064
5
- SHA512:
6
- metadata.gz: 9efe9b47f6d37bee9d9a97f5e087157be3c59551474c1105ba24f92f5a39928abb46abc3efeed569937263998105193e92b8c2180e226a40ce7581085f104c93
7
- data.tar.gz: ceabaa4cf3773c8b7a4c223a30a27a51e79291a16c101a1daac4d188ca658e283f2f7183e3ab1079f3fba517bad845810edd27c67c98cd3fcddc8f6457816164
@@ -1,16 +0,0 @@
1
- Feature: The `launchy_browser` binary
2
-
3
- Scenario: Opening a URL
4
- # Add path to Ruby's load path
5
- Given I set the environment variable "RUBYLIB" to "test_bin"
6
- And a file named "test_bin/launchy.rb" with:
7
- """
8
- class Launchy
9
- def self.open(url)
10
- puts "[fake] Launchy.open('#{ url }')"
11
- end
12
- end
13
- """
14
-
15
- When I run `launchy_browser http://www.example.com`
16
- Then the output should contain "[fake] Launchy.open('http://www.example.com')"