geordi 2.12.3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +8 -2
  4. data/CHANGELOG.md +8 -0
  5. data/Gemfile +2 -6
  6. data/Gemfile.lock +20 -25
  7. data/README.md +8 -28
  8. data/Rakefile +6 -10
  9. data/{bin → exe}/b +0 -0
  10. data/{bin → exe}/cap-all +0 -0
  11. data/{bin → exe}/console-for +0 -0
  12. data/{bin → exe}/cuc +0 -0
  13. data/{bin → exe}/cuc-show +0 -0
  14. data/{bin → exe}/cuc-vnc-setup +0 -0
  15. data/{bin → exe}/deploy-to-production +0 -0
  16. data/{bin → exe}/dump-for +0 -0
  17. data/{bin → exe}/dumple +0 -0
  18. data/{bin → exe}/geordi +0 -2
  19. data/{bin → exe}/gitpt +0 -0
  20. data/{bin → exe}/launchy_browser +0 -0
  21. data/{bin → exe}/load-dump +0 -0
  22. data/{bin → exe}/migrate-all +0 -0
  23. data/{bin → exe}/rs +0 -0
  24. data/{bin → exe}/run_tests +0 -0
  25. data/{bin → exe}/shell-for +0 -0
  26. data/{bin → exe}/tests +0 -0
  27. data/geordi.gemspec +23 -20
  28. data/lib/geordi/COMMAND_TEMPLATE +2 -3
  29. data/lib/geordi/capistrano_config.rb +7 -7
  30. data/lib/geordi/chromedriver_updater.rb +7 -7
  31. data/lib/geordi/cli.rb +1 -6
  32. data/lib/geordi/commands/_setup_vnc.rb +1 -1
  33. data/lib/geordi/commands/apache_site.rb +3 -3
  34. data/lib/geordi/commands/bundle_install.rb +2 -2
  35. data/lib/geordi/commands/capistrano.rb +2 -3
  36. data/lib/geordi/commands/chromedriver_update.rb +0 -9
  37. data/lib/geordi/commands/clean.rb +2 -4
  38. data/lib/geordi/commands/commit.rb +0 -1
  39. data/lib/geordi/commands/console.rb +2 -2
  40. data/lib/geordi/commands/create_database_yml.rb +2 -2
  41. data/lib/geordi/commands/create_databases.rb +2 -2
  42. data/lib/geordi/commands/cucumber.rb +20 -20
  43. data/lib/geordi/commands/delete_dumps.rb +9 -9
  44. data/lib/geordi/commands/deploy.rb +12 -13
  45. data/lib/geordi/commands/drop_databases.rb +12 -14
  46. data/lib/geordi/commands/dump.rb +5 -6
  47. data/lib/geordi/commands/eurest.rb +2 -2
  48. data/lib/geordi/commands/firefox.rb +3 -3
  49. data/lib/geordi/commands/png_optimize.rb +13 -12
  50. data/lib/geordi/commands/rake.rb +2 -2
  51. data/lib/geordi/commands/remove_executable_flags.rb +1 -1
  52. data/lib/geordi/commands/rspec.rb +6 -6
  53. data/lib/geordi/commands/security_update.rb +12 -12
  54. data/lib/geordi/commands/server.rb +5 -5
  55. data/lib/geordi/commands/setup.rb +5 -5
  56. data/lib/geordi/commands/shell.rb +2 -2
  57. data/lib/geordi/commands/unit.rb +1 -1
  58. data/lib/geordi/commands/update.rb +5 -5
  59. data/lib/geordi/commands/vnc.rb +1 -1
  60. data/lib/geordi/commands/with_rake.rb +1 -1
  61. data/lib/geordi/commands/yarn_install.rb +2 -2
  62. data/lib/geordi/cucumber.rb +28 -29
  63. data/lib/geordi/db_cleaner.rb +28 -28
  64. data/lib/geordi/dump_loader.rb +3 -3
  65. data/lib/geordi/firefox_for_selenium.rb +11 -12
  66. data/lib/geordi/gitpt.rb +13 -13
  67. data/lib/geordi/remote.rb +6 -6
  68. data/lib/geordi/util.rb +18 -24
  69. data/lib/geordi/version.rb +1 -1
  70. metadata +25 -42
  71. data/features/commit.feature +0 -17
  72. data/features/console.feature +0 -7
  73. data/features/cucumber.feature +0 -261
  74. data/features/deploy.feature +0 -66
  75. data/features/docker.feature +0 -86
  76. data/features/dump.feature +0 -34
  77. data/features/firefox.feature +0 -44
  78. data/features/server.feature +0 -31
  79. data/features/setup.feature +0 -11
  80. data/features/shell.feature +0 -78
  81. data/features/step_definitions/docker_command_steps.rb +0 -21
  82. data/features/step_definitions/miscellaneous_steps.rb +0 -11
  83. data/features/support/aruba.rb +0 -60
  84. data/features/support/env.rb +0 -9
  85. data/features/support/step_definitions/aruba_backport_steps.rb +0 -5
  86. data/lib/geordi/commands/docker.rb +0 -42
  87. data/lib/geordi/docker.rb +0 -116
@@ -1,86 +0,0 @@
1
- @same-process
2
- Feature: The docker command
3
-
4
- Scenario: Setup checks for existence of docker
5
- Given the docker command cannot find the "docker" binary
6
- When I run `geordi docker setup`
7
- Then the output should contain "which docker"
8
- And the output should contain "x You need to install docker first"
9
-
10
-
11
- Scenario: Setup checks for existence of docker-compose
12
- Given the docker command cannot find the "docker-compose" binary
13
- When I run `geordi docker setup`
14
- Then the output should contain "which docker-compose"
15
- And the output should contain "x You need to install docker-compose first"
16
-
17
-
18
- Scenario: Setup checks for existence of docker-compose.yml
19
- When I run `geordi docker setup`
20
- Then the output should contain "x Your project does not seem to be properly set up."
21
-
22
-
23
- Scenario: Setup checks for service named "main"
24
- Given a file named "docker-compose.yml" with:
25
- """
26
- foo: bar
27
- """
28
-
29
- When I run `geordi docker setup`
30
- Then the output should contain "x Your project does not seem to be properly set up."
31
-
32
-
33
- Scenario: Setup runs docker-compose pull
34
- Given a file named "docker-compose.yml" with:
35
- """
36
- services:
37
- main: foo
38
- """
39
-
40
- When I run `geordi docker setup`
41
- Then the output should contain "docker-compose pull"
42
-
43
-
44
- Scenario: Shell checks for existence of docker
45
- Given the docker command cannot find the "docker" binary
46
- When I run `geordi docker shell`
47
- Then the output should contain "which docker"
48
- And the output should contain "x You need to install docker first"
49
-
50
-
51
- Scenario: Shell runs docker-compose run main, and docker-compose stop
52
- Given a file named "docker-compose.yml" with:
53
- """
54
- services:
55
- main: foo
56
- """
57
- And I set the environment variables to:
58
- | variable | value |
59
- | SSH_AUTH_SOCK | /path/to/sock/ssh |
60
-
61
- When I run `geordi docker shell`
62
- Then the output should contain "docker-compose run --service-ports -v /path/to/sock:/path/to/sock -e SSH_AUTH_SOCK=/path/to/sock/ssh main"
63
- Then the output should contain "docker-compose stop"
64
-
65
-
66
- Scenario: One can attach to a running shell
67
- Given the docker command finds a running shell "project_main_run_foo"
68
- And a file named "docker-compose.yml" with:
69
- """
70
- services:
71
- main: foo
72
- """
73
-
74
- When I run `geordi docker shell --secondary`
75
- Then the output should contain "Could not find a running shell"
76
-
77
-
78
- Scenario: Attaching fails if no shell is running
79
- Given a file named "docker-compose.yml" with:
80
- """
81
- services:
82
- main: foo
83
- """
84
-
85
- When I run `geordi docker shell --secondary`
86
- Then the output should contain "Could not find a running shell"
@@ -1,34 +0,0 @@
1
- Feature: The dump command
2
- Most aspects of connection to a server are tested in shell feature.
3
-
4
- Scenario: Creating a dump of the development database
5
- When I run `geordi dump`
6
- Then the output should contain "Util.system! dumple development"
7
- And the output should contain "Successfully dumped the development database"
8
-
9
-
10
- Scenario: Creating a dump of a remote database
11
- Given a file named "Capfile" with "Capfile exists"
12
- And a file named "config/deploy.rb" with:
13
- """
14
- """
15
- And a file named "config/deploy/staging.rb" with:
16
- """
17
- set :rails_env, 'staging'
18
- set :deploy_to, '/var/www/example.com'
19
- set :user, 'user'
20
-
21
- server 'www.example.com'
22
- """
23
-
24
- When I run `geordi dump staging`
25
- Then the output should contain "# Dumping the database of staging"
26
- And the output should contain "> Connecting to www.example.com"
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
- And the output should contain "> Downloading remote dump to tmp/staging.dump"
29
- # Omitting the absolute path in this regex (.*)
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
- """
34
- And the output should contain "> Dumped the staging database to tmp/staging.dump"
@@ -1,44 +0,0 @@
1
- Feature: The firefox/chrome command
2
-
3
- This command is used internally by the cucumber command.
4
-
5
- Scenario: Running a command with VNC set up
6
- Given a file named "testfile" with "testcontent"
7
-
8
- When I run `geordi firefox cat testfile`
9
- Then the output should contain "> Run `geordi vnc` to view the Selenium test browsers"
10
- And the output should contain "testcontent"
11
- But the output should not contain "Firefox for Selenium"
12
-
13
-
14
- Scenario: The command is aliased as "chrome"
15
- Given a file named "testfile" with "testcontent"
16
-
17
- When I run `geordi chrome cat testfile`
18
- Then the output should contain "> Run `geordi vnc` to view the Selenium test browsers"
19
- And the output should contain "testcontent"
20
-
21
- Scenario: Having a .firefox-version that is not installed yet
22
- Given a file named ".firefox-version" with "1337"
23
- And a file named "testfile" with "testcontent"
24
-
25
- When I run `geordi firefox cat testfile` interactively
26
- And I type "yes"
27
- Then the output should contain "> Firefox 1337 not found"
28
- And the output should contain "Run tests anyway?"
29
- And the output should contain "testcontent"
30
-
31
-
32
- Scenario: A .firefox-version file with "system" is ignored (legacy support)
33
- Given a file named ".firefox-version" with "system"
34
- And a file named "testfile" with "testcontent"
35
-
36
- When I run `geordi firefox cat testfile`
37
- Then the output should contain "> Run `geordi vnc`"
38
- And the output should contain "testcontent"
39
- But the output should not contain "Firefox for Selenium"
40
-
41
-
42
- Scenario: Running --setup without a version prints an error
43
- When I run `geordi firefox --setup`
44
- Then the output should contain "Firefox version required"
@@ -1,31 +0,0 @@
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"
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"
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"
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"
24
-
25
-
26
- Scenario: Starting the server as accessible from the local network
27
-
28
- ... so it can be accessed from a test iPad or so.
29
-
30
- When I run `geordi server --public`
31
- Then the output should contain "Util.system! bundle exec rails server -b 0.0.0.0"
@@ -1,11 +0,0 @@
1
- Feature: Project setup
2
-
3
- Scenario: A local bin/setup is preferred
4
- Given a file named "bin/setup" with "custom project setup"
5
-
6
- When I run `geordi setup`
7
- Then the output should contain "Running bin/setup"
8
- And the output should contain "Geordi's own setup routine is skipped"
9
- And the output should contain "Util.system! bin/setup"
10
- And the output should not contain "Creating databases"
11
- But the output should contain "Successfully set up the project"
@@ -1,78 +0,0 @@
1
- Feature: The shell command
2
-
3
- Background:
4
- Given a file named "Capfile" with "Capfile exists"
5
-
6
-
7
- Scenario: It opens a remote shell on the primary server
8
- Given a file named "config/deploy.rb" with "deploy.rb exists"
9
- And a file named "config/deploy/geordi.rb" with:
10
- """
11
- set :user, 'deploy'
12
- set :deploy_to, '/var/www/example.com'
13
- server 'first.example.com'
14
- server 'second.example.com'
15
- """
16
-
17
- When I run `geordi shell geordi`
18
- Then the output should contain "Util.system! ssh, deploy@first.example.com, -t, cd /var/www/example.com/current && bash --login"
19
-
20
-
21
- Scenario: It understands Capistrano 3 syntax
22
- Given a file named "config/deploy.rb" with "deploy.rb exists"
23
- And a file named "config/deploy/geordi.rb" with:
24
- """
25
- set :deploy_to, '/var/www/example.com'
26
- server 'first.example.com', user: 'deploy'
27
- """
28
-
29
- When I run `geordi shell geordi`
30
- Then the output should contain "Util.system! ssh, deploy@first.example.com, -t, cd /var/www/example.com/current && bash --login"
31
-
32
- Scenario: It allows multiline capistrano server definitions
33
- Given a file named "config/deploy.rb" with "deploy.rb exists"
34
- And a file named "config/deploy/geordi.rb" with:
35
- """
36
- set :deploy_to, '/var/www/example.com'
37
- server 'first.example.com',
38
- user: 'deploy'
39
- """
40
-
41
- When I run `geordi shell geordi`
42
- Then the output should contain "Util.system! ssh, deploy@first.example.com, -t, cd /var/www/example.com/current && bash --login"
43
-
44
-
45
- Scenario: It prefers stage settings over general config
46
- Given a file named "config/deploy.rb" with:
47
- """
48
- set :deploy_to, '/var/www/unknown.example.com'
49
- set :user, 'user'
50
-
51
- server 'www.unknown.example.com'
52
- """
53
- And a file named "config/deploy/staging.rb" with:
54
- """
55
- set :deploy_to, '/var/www/example.com'
56
-
57
- server 'www.example.com'
58
- """
59
-
60
- When I run `geordi shell staging`
61
- Then the output should contain "Util.system! ssh, user@www.example.com, -t, cd /var/www/example.com/current"
62
-
63
-
64
- Scenario: It allows whitespaces in the config
65
- We also add the unset command to check we are still matching the right
66
- commands and not allow any char at the beginning.
67
-
68
- Given a file named "config/deploy.rb" with "deploy.rb exists"
69
- And a file named "config/deploy/staging.rb" with:
70
- """
71
- unset :user, 'wrong'
72
- set :deploy_to, '/var/www/example.com'
73
- set :user, 'user'
74
- server 'www.example.com'
75
- """
76
-
77
- When I run `geordi shell staging`
78
- Then the output should contain "Util.system! ssh, user@www.example.com, -t, cd /var/www/example.com/current"
@@ -1,21 +0,0 @@
1
- Given(/the docker command cannot find the "(.*?)" binary/) do |command|
2
- require 'geordi/docker'
3
- expect_any_instance_of(Geordi::Docker).to receive(:mock_run).at_least(:once).and_wrap_original do |original, *args|
4
- if args[0] =~ /which #{Regexp.escape(command)}/
5
- false
6
- else
7
- original.call(*args)
8
- end
9
- end
10
- end
11
-
12
- Given(/^the docker command finds a running shell "(.*?)"$/) do |shell_name|
13
- require 'geordi/docker'
14
- expect_any_instance_of(Geordi::Docker).to receive(:mock_parse).at_least(:once).and_wrap_original do |original, *args|
15
- if args[0] =~ /docker-compose ps/
16
- "other_shell\nshell_name foo"
17
- else
18
- original.call(*args)
19
- end
20
- end
21
- end
@@ -1,11 +0,0 @@
1
- When /^I wait for (\d+) seconds?$/ do |seconds|
2
- sleep seconds.to_i
3
- end
4
-
5
- Given 'I have staged changes' do
6
- ENV['GEORDI_TESTING_STAGED_CHANGES'] = 'true'
7
- end
8
-
9
- After do
10
- ENV['GEORDI_TESTING_STAGED_CHANGES'] = 'false'
11
- end
@@ -1,60 +0,0 @@
1
- require 'aruba/cucumber'
2
- require 'aruba/in_process'
3
- require 'geordi/cli'
4
-
5
- # https://github.com/erikhuda/thor/wiki/Integrating-with-Aruba-In-Process-Runs
6
- class InProcessCliRunner
7
-
8
- # Allow everything fun to be injected from the outside while defaulting to normal implementations.
9
- def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
10
- @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
11
- end
12
-
13
- def execute!
14
- exit_code = begin
15
- # Thor accesses these streams directly rather than letting them be injected, so we replace them...
16
- $stderr = @stderr
17
- $stdin = @stdin
18
- $stdout = @stdout
19
-
20
- # Run our normal Thor app the way we know and love.
21
- previous_program_name = $PROGRAM_NAME
22
- $PROGRAM_NAME = 'geordi'
23
- Geordi::CLI.start(@argv)
24
-
25
- # Thor::Base#start does not have a return value, assume success if no exception is raised.
26
- 0
27
- rescue StandardError => e
28
- # The ruby interpreter would pipe this to STDERR and exit 1 in the case of an unhandled exception
29
- b = e.backtrace
30
- @stderr.puts("#{b.shift}: #{e.message} (#{e.class})")
31
- @stderr.puts(b.map{|s| "\tfrom #{s}"}.join("\n"))
32
- 1
33
- rescue SystemExit => e
34
- e.status
35
- ensure
36
- # add additional cleanup code here
37
-
38
- $stderr = STDERR
39
- $stdin = STDIN
40
- $stdout = STDOUT
41
- $PROGRAM_NAME = previous_program_name
42
- end
43
-
44
- # Proxy our exit code back to the injected kernel.
45
- @kernel.exit(exit_code)
46
- end
47
- end
48
-
49
- Aruba.configure do |config|
50
- config.main_class = InProcessCliRunner
51
- config.command_launcher = :spawn
52
- end
53
-
54
- Before('@same-process') do
55
- aruba.config.command_launcher = :in_process
56
- end
57
-
58
- Before do
59
- @aruba_timeout_seconds = 5
60
- end
@@ -1,9 +0,0 @@
1
- require 'cucumber/rspec/doubles'
2
-
3
-
4
- if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('1.8.7')
5
- require 'pry'
6
- end
7
-
8
- # Disables execution of Util.system! calls
9
- ENV['GEORDI_TESTING'] = 'true'
@@ -1,5 +0,0 @@
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
@@ -1,42 +0,0 @@
1
- class DockerCLI < Thor
2
- desc 'setup', 'Setup docker and build required docker-container for the current project.'
3
- def setup
4
- docker.setup
5
- end
6
-
7
- desc 'shell', 'Open a shell in the main docker container for the current project.'
8
- option :secondary, :default => false, :type => :boolean
9
- map 'shell' => '_shell'
10
- def _shell
11
- docker.shell(:secondary => options[:secondary])
12
- end
13
-
14
- desc 'vnc', 'Open a vnc viewer connecting to the docker container.'
15
- def vnc
16
- docker.vnc
17
- end
18
-
19
- private
20
-
21
- def docker
22
- require 'geordi/docker'
23
- Geordi::Docker.new
24
- end
25
- end
26
-
27
- desc 'docker', 'Manage docker containers for the current project.'
28
- long_desc <<-LONGDESC
29
- Manage docker containers to run your project dockerized.
30
-
31
- It expects a docker-compose file that specifies all services, and a service
32
- named "main" that opens a shell for the project.
33
-
34
- There are two subcommands:
35
-
36
- - geordi docker setup
37
- Builds all docker containers.
38
- - geordi docker shell
39
- Runs the docker service named 'main'.
40
-
41
- LONGDESC
42
- subcommand 'docker', DockerCLI