geordi 3.2.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +10 -1
  4. data/Gemfile.lock +1 -1
  5. data/README.md +111 -142
  6. data/Rakefile +18 -8
  7. data/geordi.gemspec +1 -0
  8. data/lib/geordi/COMMAND_TEMPLATE +3 -1
  9. data/lib/geordi/commands/chromedriver_update.rb +2 -2
  10. data/lib/geordi/commands/commit.rb +0 -5
  11. data/lib/geordi/commands/console.rb +8 -11
  12. data/lib/geordi/commands/create_databases.rb +2 -1
  13. data/lib/geordi/commands/cucumber.rb +13 -15
  14. data/lib/geordi/commands/delete_dumps.rb +0 -1
  15. data/lib/geordi/commands/deploy.rb +11 -11
  16. data/lib/geordi/commands/drop_databases.rb +0 -6
  17. data/lib/geordi/commands/dump.rb +9 -17
  18. data/lib/geordi/commands/firefox.rb +2 -5
  19. data/lib/geordi/commands/migrate.rb +1 -1
  20. data/lib/geordi/commands/rake.rb +3 -1
  21. data/lib/geordi/commands/rspec.rb +5 -9
  22. data/lib/geordi/commands/security_update.rb +14 -15
  23. data/lib/geordi/commands/server.rb +1 -1
  24. data/lib/geordi/commands/setup.rb +2 -11
  25. data/lib/geordi/commands/shell.rb +7 -8
  26. data/lib/geordi/commands/unit.rb +1 -1
  27. data/lib/geordi/commands/update.rb +0 -11
  28. data/lib/geordi/commands/vnc.rb +1 -3
  29. data/lib/geordi/commands/with_rake.rb +1 -1
  30. data/lib/geordi/cucumber.rb +2 -2
  31. data/lib/geordi/util.rb +11 -3
  32. data/lib/geordi/version.rb +1 -1
  33. metadata +6 -33
  34. data/exe/cap-all +0 -4
  35. data/exe/console-for +0 -4
  36. data/exe/cuc +0 -4
  37. data/exe/cuc-show +0 -4
  38. data/exe/cuc-vnc-setup +0 -4
  39. data/exe/deploy-to-production +0 -4
  40. data/exe/dump-for +0 -8
  41. data/exe/gitpt +0 -4
  42. data/exe/load-dump +0 -4
  43. data/exe/migrate-all +0 -4
  44. data/exe/rs +0 -4
  45. data/exe/run_tests +0 -4
  46. data/exe/shell-for +0 -4
  47. data/exe/tests +0 -4
  48. data/lib/geordi/commands/eurest.rb +0 -4
data/Rakefile CHANGED
@@ -32,21 +32,31 @@ You may abbreviate commands by typing only their first letters, e.g. `geordi
32
32
  con` will boot a development console, `geordi set -t` will setup a project and
33
33
  run tests afterwards.
34
34
 
35
- For details on commands, e.g. supported options, you may always run
36
- `geordi help <command>`.
37
-
35
+ You can always run `geordi help <command>` to quickly look up command help.
38
36
  TEXT
39
37
 
40
38
  Geordi::CLI.all_commands.sort.each do |_, command|
41
- unless command.hidden?
42
- geordi_section << "### `geordi #{command.usage}`\n\n"
43
- geordi_section << "#{command.description.sub /(\.)?$/, '.'}\n\n"
44
- geordi_section << "#{command.long_description.strip}\n\n" if command.long_description
39
+ next if command.hidden?
40
+
41
+ geordi_section << "\n### `geordi #{command.usage}`\n"
42
+ geordi_section << "#{command.description.sub /(\.)?$/, '.'}\n\n"
43
+ geordi_section << "#{command.long_description.strip}\n\n" if command.long_description
44
+
45
+ if command.options.any?
46
+ geordi_section << "**Options**\n"
47
+ # Taken from thor-1.0.1/lib/thor/base.rb:557
48
+ command.options.values.each do |option|
49
+ next if option.hide
50
+
51
+ geordi_section << "- `#{option.usage}`"
52
+ geordi_section << ": #{option.description}" if option.description
53
+ geordi_section << "\n"
54
+ end
45
55
  geordi_section << "\n"
46
56
  end
47
57
  end
48
58
 
49
59
  updated_readme = readme.sub(geordi_section_regex, geordi_section)
50
60
  File.open('README.md', 'w') { |f| f.puts updated_readme.strip }
51
- puts 'README.me updated.'
61
+ puts 'README.md updated.'
52
62
  end
@@ -27,5 +27,6 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.post_install_message = <<-ATTENTION
29
29
  * Binary `geordi` installed
30
+ * Geordi 4.0.0 has removed its deprecated executables. If you want to invoke these commands like before, you may create aliases on your machine. For the alias mapping, please refer to https://github.com/makandra/geordi/commit/68fa92acb146ebde3acb92d7b9556bd4eaa2b4ff
30
31
  ATTENTION
31
32
  end
@@ -12,7 +12,9 @@ Detailed description with anything the user needs to know.
12
12
 
13
13
  Short and long description are printed on the console AND included in the README
14
14
  by `rake update_readme`. Thus, please format descriptions in a way that's reader
15
- friendly both in Markdown and the console.
15
+ friendly both in Markdown and the console. In particular, note that simple line
16
+ breaks (\n) will be squished. Only paragraphs (\n\n) will work both on the bash
17
+ and in Markdown.
16
18
  LONGDESC
17
19
 
18
20
  option :opt, type: :boolean, aliases: '-o', banner: 'VALUE_NAME', desc: 'If set, VALUE_NAME will be used for something'
@@ -1,9 +1,9 @@
1
1
  desc 'chromedriver-update', 'Update the chromedriver'
2
-
3
2
  long_desc <<-LONGDESC
4
3
  Example: `geordi chromedriver_update`
5
4
 
6
- This command will find and install the matching chromedriver for the currently installed Chrome.
5
+ This command will find and install the matching chromedriver for the currently
6
+ installed Chrome.
7
7
  LONGDESC
8
8
 
9
9
  def chromedriver_update
@@ -1,13 +1,9 @@
1
1
  desc 'commit', 'Commit using a story title from Pivotal Tracker'
2
-
3
2
  long_desc <<-LONGDESC
4
3
  Example: `geordi commit`
5
4
 
6
5
  Any extra arguments are forwarded to `git commit -m <message>`.
7
6
 
8
- If there are no staged changes, prints a warning but will continue to create
9
- an empty commit.
10
-
11
7
  On the first execution we ask for your Pivotal Tracker API token. It will be
12
8
  stored in `~/.config/geordi/global.yml`.
13
9
  LONGDESC
@@ -18,6 +14,5 @@ Unsupported Ruby Version #{RUBY_VERSION}. `geordi commit` requires Ruby 2.1+.
18
14
  TEXT
19
15
 
20
16
  require 'geordi/gitpt'
21
-
22
17
  Gitpt.new.run(git_args)
23
18
  end
@@ -1,23 +1,20 @@
1
1
  desc 'console [TARGET]', 'Open a Rails console locally or on a Capistrano deploy target'
2
2
  long_desc <<-LONGDESC
3
- Open a local Rails console: `geordi console`
3
+ Local (development): `geordi console`
4
4
 
5
- Open a Rails console on `staging`: `geordi console staging`
5
+ Remote: `geordi console staging`
6
6
 
7
- Lets you select the server to connect to from a menu when called with `--select-server` or the alias `-s`:
8
-
9
- geordi console staging -s
10
-
11
- If you already know the number of the server you want to connect to, just pass it along:
12
-
13
- geordi console staging -s2
7
+ Selecting the server: `geordi console staging -s` shows a menu with all available
8
+ servers. When passed a number, directly connects to the selected server.
14
9
  LONGDESC
15
10
 
16
-
17
- option :select_server, type: :string, aliases: '-s'
11
+ # This option is duplicated in shelll.rb
12
+ option :select_server, type: :string, aliases: '-s', banner: '[SERVER_NUMBER]',
13
+ desc: 'Select a server to connect to'
18
14
 
19
15
  def console(target = 'development', *_args)
20
16
  require 'geordi/remote'
17
+ invoke_cmd 'bundle_install'
21
18
 
22
19
  if target == 'development'
23
20
  invoke_cmd 'yarn_install'
@@ -6,7 +6,8 @@ def create_databases
6
6
  Interaction.announce 'Creating databases'
7
7
 
8
8
  if File.exist?('config/database.yml')
9
- command = 'bundle exec rake db:create:all'
9
+ command = Util.binstub 'rake'
10
+ command << ' db:create:all'
10
11
  command << ' parallel:create' if Util.file_containing?('Gemfile', /parallel_tests/)
11
12
 
12
13
  Util.system! command
@@ -2,26 +2,24 @@ desc 'cucumber [FILES and OPTIONS]', 'Run Cucumber features'
2
2
  long_desc <<-LONGDESC
3
3
  Example: `geordi cucumber features/authentication_feature:3`
4
4
 
5
- Runs Cucumber as you want: with `bundle exec`, using parallel tests, with
6
- a VNC session holding Selenium test browsers, support for using a dedicated
7
- testing firefox and beta support for rerunning failed scenarios.
5
+ Runs Cucumber with `bundle exec`, using parallel tests, with a VNC session
6
+ holding Selenium test browsers, support for using a dedicated testing browser
7
+ and beta support for re-running failed scenarios.
8
8
 
9
9
  - *@solo:* Generally, features are run in parallel. However, scenarios tagged
10
- with @solo are excluded and will be run sequentially, _after_ the parallel run.
10
+ with @solo are excluded from the parallel run and executed sequentially instead.
11
11
 
12
- - *Debugging:* Sometimes, the dot-printing Cucumber formatter does not show
13
- errors. In case a feature fails without a message, try running it with `--debug`
14
- or `-d`.
12
+ - *Debugging:* In some cases, the dot-printing Cucumber formatter swallows
13
+ errors. In case a feature fails without an error message, try running it with
14
+ `--debug` or `-d`.
15
15
 
16
16
  - *Options:* Any unknown option will be passed through to Cucumber,
17
- e.g. `--format pretty`.
17
+ e.g. `--format=pretty`. Make sure to connect option and value with an equals
18
+ sign, i.e. have each option a contiguous string.
18
19
 
19
20
  - *VNC:* By default, test browsers will run in a VNC session. When using a
20
- headless test browser anyway, you can disable VNC by putting the following
21
- config into `.geordi.yml` in the project root:
22
-
23
- use_vnc: false
24
-
21
+ headless test browser anyway, you can disable VNC by setting `use_vnc: false`
22
+ in `.geordi.yml` in the project root.
25
23
  LONGDESC
26
24
 
27
25
  option :modified, aliases: '-m', type: :boolean,
@@ -29,9 +27,9 @@ option :modified, aliases: '-m', type: :boolean,
29
27
  option :containing, aliases: '-c', banner: 'STRING',
30
28
  desc: 'Run all features that contain STRING'
31
29
  option :verbose, aliases: '-v', type: :boolean,
32
- desc: 'Print the testrun command'
30
+ desc: 'Show the test run command'
33
31
  option :debug, aliases: '-d', type: :boolean,
34
- desc: 'Run with `-f pretty -b` which helps hunting down bugs'
32
+ desc: 'Run Cucumber with `-f pretty -b`, which helps hunting down bugs'
35
33
  option :rerun, aliases: '-r', type: :numeric, default: 0,
36
34
  desc: 'Rerun features up to N times while failing'
37
35
 
@@ -7,7 +7,6 @@ no argument is given, two default directories are searched for dump files: the
7
7
  current working directory and `~/dumps` (for dumps created with geordi).
8
8
 
9
9
  Geordi will ask for confirmation before actually deleting files.
10
-
11
10
  LONGDESC
12
11
 
13
12
  def delete_dumps(dump_directory = nil)
@@ -5,18 +5,18 @@ Example: `geordi deploy` or `geordi deploy p[roduction]` or `geordi deploy --cur
5
5
  Merge, push and deploy with a single command! **It always tells what it will do
6
6
  before it does it.** There are different scenarios where this command is handy:
7
7
 
8
- 1) *Production deploy:* From the master branch, run `geordi deploy production`.
9
- This will merge `master` to `production`, push and deploy to production.
8
+ - *Production deploy:* From the master branch, run `geordi deploy production`.
9
+ This will merge `master` to `production`, push and deploy to production.
10
10
 
11
- 2) *Feature branch deploy:* From a feature branch, run `geordi deploy staging`.
12
- This will merge the feature branch to `master`, push and deploy to staging.
11
+ - *Feature branch deploy:* From a feature branch, run `geordi deploy staging`.
12
+ This will merge the feature branch to `master`, push and deploy to staging.
13
13
 
14
- To deploy a feature branch directly without merging, run
15
- `geordi deploy --current-branch`. This feature depends on the environment
16
- variable `DEPLOY_BRANCH` to be picked up in the respective deploy file.
14
+ To deploy a feature branch directly without merging, run
15
+ `geordi deploy --current-branch`. This feature depends on the environment
16
+ variable `DEPLOY_BRANCH` to be picked up in the respective deploy file.
17
17
 
18
- 3) *Simple deploy:* If the source branch matches the target branch, merging will
19
- be skipped.
18
+ - *Simple deploy:* If the source branch matches the target branch, merging will
19
+ be skipped.
20
20
 
21
21
  Calling the command without arguments will infer the target stage from the
22
22
  current branch and fall back to master/staging.
@@ -94,6 +94,8 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
94
94
  git_call << "git merge #{source_branch}" if merge_needed
95
95
  git_call << 'git push' if push_needed
96
96
 
97
+ invoke_cmd 'bundle_install'
98
+
97
99
  capistrano_call = "cap #{target_stage} deploy"
98
100
  capistrano_call << ':migrations' unless Util.gem_major_version('capistrano') == 3 || options.no_migrations
99
101
  capistrano_call = "bundle exec #{capistrano_call}" if Util.file_containing?('Gemfile', /capistrano/)
@@ -103,8 +105,6 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
103
105
  Util.system! git_call.join(' && '), show_cmd: true
104
106
  end
105
107
 
106
- invoke_cmd 'bundle_install'
107
-
108
108
  Util.system! capistrano_call, show_cmd: true
109
109
 
110
110
  Interaction.success 'Deployment complete.'
@@ -7,12 +7,6 @@ and offer to delete them. Excluded are databases that are whitelisted. This come
7
7
  in handy when you're keeping your currently active projects in the whitelist files
8
8
  and perform regular housekeeping with Geordi.
9
9
 
10
- When called with `-P` or `-M` options, only handles Postgres resp. MySQL/MariaDB.
11
-
12
- When called with `--postgres <port or local socket>` or `--mysql <port or local socket>`,
13
- will instruct the underlying management commands to use those connection methods
14
- instead of the defaults. This is useful when running multiple installations.
15
-
16
10
  Geordi will ask for confirmation before actually dropping databases and will
17
11
  offer to edit the whitelist instead.
18
12
  LONGDESC
@@ -1,26 +1,18 @@
1
- desc 'dump [TARGET]', 'Handle dumps (see `geordi help dump` for details)'
1
+ desc 'dump [TARGET]', 'Handle (remote) database dumps'
2
2
  long_desc <<-DESC
3
- When called without arguments, dumps the development database with `dumple`.
3
+ `geordi dump` (without arguments) dumps the development database with `dumple`.
4
4
 
5
- geordi dump
5
+ `geordi dump -l tmp/staging.dump` (with the `--load` option) sources the
6
+ specified dump file into the development database.
6
7
 
7
- When called with the `--load` option, sources the specified dump into the
8
- development database.
8
+ `geordi dump staging` (with a Capistrano deploy target) remotely dumps the
9
+ specified target's database and downloads it to `tmp/`.
9
10
 
10
- geordi dump -l tmp/staging.dump
11
-
12
- When called with a capistrano deploy target (e.g. `staging`), remotely dumps
13
- the specified target's database and downloads it to `tmp/`.
14
-
15
- geordi dump staging
16
-
17
- When called with a capistrano deploy target and the `--load` option, sources the
18
- dump into the development database after downloading it.
19
-
20
- geordi dump staging -l
11
+ `geordi dump staging -l` (with a Capistrano deploy target and the `--load`
12
+ option) sources the dump into the development database after downloading it.
21
13
  DESC
22
14
 
23
- option :load, aliases: ['-l'], type: :string, desc: 'Load a dump'
15
+ option :load, aliases: '-l', type: :string, desc: 'Load a dump', banner: '[DUMP_FILE]'
24
16
 
25
17
  def dump(target = nil, *_args)
26
18
  require 'geordi/dump_loader'
@@ -3,11 +3,8 @@ long_desc <<-LONGDESC
3
3
  Example: `geordi firefox b cucumber` or `geordi firefox --setup 24.0`
4
4
 
5
5
  Useful when you need Firefox for Selenium or the VNC set up, but can't use the
6
- `geordi cucumber` command.
7
-
8
- *Install* a special Firefox by calling with `--setup <version>`.
9
-
10
- This command is aliased `chrome` for users running Selenium in Chrome.
6
+ `geordi cucumber` command. This command is aliased `chrome` for users running
7
+ Selenium in Chrome.
11
8
  LONGDESC
12
9
 
13
10
  option :setup, banner: 'FIREFOX_VERSION',
@@ -17,7 +17,7 @@ def migrate
17
17
  Interaction.note 'Development and parallel test databases'
18
18
  puts
19
19
 
20
- Util.system! 'bundle exec rake db:migrate parallel:prepare'
20
+ Util.system! Util.binstub('rake'), 'db:migrate parallel:prepare'
21
21
  else
22
22
  invoke_cmd 'rake', 'db:migrate'
23
23
  end
@@ -10,9 +10,11 @@ Example: `geordi rake db:migrate`
10
10
  LONGDESC
11
11
 
12
12
  def rake(*args)
13
+ invoke_cmd 'bundle_install'
14
+
13
15
  %w[development test cucumber].each do |env| # update long_desc when changing this
14
16
  if File.exist? "config/environments/#{env}.rb"
15
- call = %w[bundle exec rake] + args + ["RAILS_ENV=#{env}"]
17
+ call = [Util.binstub('rake')] + args + ["RAILS_ENV=#{env}"]
16
18
  Interaction.note_cmd call.join(' ')
17
19
 
18
20
  Util.system! *call
@@ -2,8 +2,7 @@ desc 'rspec [FILES]', 'Run RSpec'
2
2
  long_desc <<-LONGDESC
3
3
  Example: `geordi rspec spec/models/user_spec.rb:13`
4
4
 
5
- Runs RSpec as you want: with RSpec 1/2 detection, `bundle exec`, rspec_spinner
6
- detection, etc.
5
+ Runs RSpec with RSpec 1/2 support, parallel_tests detection and `bundle exec`.
7
6
  LONGDESC
8
7
 
9
8
  def rspec(*files)
@@ -15,7 +14,7 @@ def rspec(*files)
15
14
 
16
15
  if Util.file_containing?('Gemfile', /parallel_tests/) && files.empty?
17
16
  Interaction.note 'All specs at once (using parallel_tests)'
18
- Util.system! 'bundle exec rake parallel:spec', fail_message: 'Specs failed.'
17
+ Util.system! Util.binstub('rake'), 'parallel:spec', fail_message: 'Specs failed.'
19
18
 
20
19
  else
21
20
  # tell which specs will be run
@@ -26,13 +25,10 @@ def rspec(*files)
26
25
  Interaction.note 'Only: ' + files.join(', ')
27
26
  end
28
27
 
29
- command = ['bundle exec']
30
- command << if File.exist?('script/spec')
31
- 'spec -c' # RSpec 1
32
- elsif File.exist?('bin/rspec')
33
- 'bin/rspec'
28
+ command = if File.exist?('script/spec')
29
+ ['bundle exec spec -c'] # RSpec 1
34
30
  else
35
- 'rspec'
31
+ [Util.binstub('rspec')]
36
32
  end
37
33
  command << '-r rspec_spinner -f RspecSpinner::Bar' if Util.file_containing?('Gemfile', /rspec_spinner/)
38
34
  command << files.join(' ')
@@ -1,31 +1,30 @@
1
1
  desc 'security-update [STEP]', 'Support for performing security updates'
2
2
  long_desc <<-LONGDESC
3
- Preparation for security update: `geordi security-update`
3
+ Preparation for security update: `geordi security-update`. Checks out production
4
+ and pulls.
4
5
 
5
- Checks out production and pulls.
6
+ After performing the update: `geordi security-update finish`. Switches branches,
7
+ pulls, pushes and deploys as required by our workflow.
6
8
 
7
- After performing the update: `geordi security-update finish`
9
+ This command tells what it will do before it does it. In detail:
8
10
 
9
- Switches branches, pulls, pushes and deploys as required by our workflow. Tells
10
- what it will do before it does it. In detail:
11
+ 1. Ask user if tests are green
11
12
 
12
- 1. Asks user, if tests are green
13
+ 2. Push production
13
14
 
14
- 2. Pushes production
15
+ 3. Check out master and pull
15
16
 
16
- 3. Checks out master and pulls
17
+ 4. Merge production and push in master
17
18
 
18
- 4. Merges production and pushes in master
19
+ 5. Deploy staging, if there is a staging environment
19
20
 
20
- 5. Deploys staging first, if there is a staging environment
21
+ 6. Ask user if deployment log is okay and staging application is still running
21
22
 
22
- 6. Asks user, if deployment log is okay and application is still running on staging
23
+ 7. Deploy other stages
23
24
 
24
- 7. Deploys other stages
25
+ 8. Ask user if deployment log is okay and application is still running on all stages
25
26
 
26
- 8. Asks user, if deployment log is okay and application is still running on all other stages
27
-
28
- 9. Informs user about the next steps
27
+ 9. Inform user about the next (manual) steps
29
28
  LONGDESC
30
29
 
31
30
  def security_update(step = 'prepare')
@@ -3,7 +3,7 @@ desc 'server [PORT]', 'Start a development server'
3
3
  option :port, aliases: '-p', default: '3000',
4
4
  desc: 'Choose a port'
5
5
  option :public, aliases: '-P', type: :boolean,
6
- desc: 'Make the server accessible in the local network'
6
+ desc: 'Make the server accessible from the local network'
7
7
 
8
8
  def server(port = nil)
9
9
  invoke_cmd 'bundle_install'
@@ -6,17 +6,8 @@ Check out a repository and cd into its directory. Then let `setup` do the tiring
6
6
  work: run `bundle install`, create `database.yml`, create databases, migrate
7
7
  (all if applicable).
8
8
 
9
- If a local bin/setup file is found, Geordi skips these steps runs bin/setup
10
- for setup instead.
11
-
12
- After setting up, loads a remote database dump into the development db when
13
- called with the `--dump` option:
14
-
15
- geordi setup -d staging
16
-
17
- After setting up, runs all tests when called with the `--test` option:
18
-
19
- geordi setup -t
9
+ If a local bin/setup file is found, Geordi skips its routine and runs bin/setup
10
+ instead.
20
11
  LONGDESC
21
12
 
22
13
  option :dump, type: :string, aliases: '-d', banner: 'TARGET',
@@ -2,22 +2,21 @@ desc 'shell TARGET', 'Open a shell on a Capistrano deploy target'
2
2
  long_desc <<-LONGDESC
3
3
  Example: `geordi shell production`
4
4
 
5
- Lets you select the server to connect to from a menu when called with `--select-server` or the alias `-s`:
6
-
7
- geordi shell production -s
8
-
9
- If you already know the number of the server you want to connect to, just pass it along:
10
-
11
- geordi shell production -s2
5
+ Selecting the server: `geordi shell staging -s` shows a menu with all available
6
+ servers. When passed a number, directly connects to the selected server.
12
7
  LONGDESC
13
8
 
14
- option :select_server, type: :string, aliases: '-s'
9
+ # This option is duplicated in console.rb
10
+ option :select_server, type: :string, aliases: '-s', banner: '[SERVER_NUMBER]',
11
+ desc: 'Select a server to connect to'
15
12
 
16
13
  # This method has a triple 'l' because :shell is a Thor reserved word. However,
17
14
  # it can still be called with `geordi shell` :)
18
15
  def shelll(target, *_args)
19
16
  require 'geordi/remote'
20
17
 
18
+ invoke_cmd 'bundle_install'
19
+
21
20
  Interaction.announce 'Opening a shell on ' + target
22
21
  Geordi::Remote.new(target).shell(options)
23
22
  end