geordi 2.10.0 → 2.12.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02e5f45f334a240e117f4cbcca10d6e17ebc8f077eb256b8c0ff8257a7886915
4
- data.tar.gz: 4d567ce58cbcd578749ddcef2273db8e851211d5f630d3b45453bfc6885c3d58
3
+ metadata.gz: 72b80aa5fcd6e4f4bb048f76aac069a7cb99310a3900b933f53c5549e737f52e
4
+ data.tar.gz: 1a0bba5ab27c1759e9b0b5a7f3b79f946596605d903129f332f53f4afb33b324
5
5
  SHA512:
6
- metadata.gz: ba66b7e3f475395408b79f692c79843a61f0271ea299ed98e02d407c56d5db1f373af294e516537460f64170937f6d4a206517108ac14778daded4f6bbc63a47
7
- data.tar.gz: 3733cc93bc188eada1b81fb17799b7a4fd109dfaa486fe86e14ad45339307e837bc92ca4ff6c731067d66c228dc3333a17bda07e72d6bcb05c3717c36d46e6b4
6
+ metadata.gz: aa1a3c5c3bc2278cb10f347d4b94dbea177cb94a65ce27459819cc32f87a82a6cf9408f4e659fdc3d9ca1f005e957f82e0867063d645367aec2019f721159ead
7
+ data.tar.gz: fd92c28543206ac2c61dca8efa017a944612e6ce84fa3f7c513b9b9056e358dc7423dae3163d3954cc56d4abf974620c76c9469a1c2a832f46836923fc0c0da1
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ pkg/*
5
5
  .DS_Store
6
6
  .pt_project_id
7
7
  tmp
8
+ .byebug_history
@@ -5,10 +5,30 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
5
5
 
6
6
 
7
7
  ## Unreleased
8
+
8
9
  ### Compatible changes
10
+
9
11
  ### Breaking changes
10
12
 
11
13
 
14
+ ## 2.11.0 2020-05-04
15
+
16
+ ### Compatible changes
17
+ - Added the possibility to change the Rails root for the capistrano config via the environment variable `RAILS_ROOT`. This allows you as a gem developer to run a command like `RAILS_ROOT=~/Projects/my-blog geordi console staging` whereas `geordi` uses the capistrano config from `my-blog`. Otherwise you would need to follow the instructions of [this card](https://makandracards.com/makandra/46617-how-to-use-a-local-gem-in-your-gemfile) to test changes in the gem locally.
18
+ - Bug fix for "no staged changes" even if there are changes present (#83).
19
+ - Fixed deprecation warning for `Thor exit with status 0 on errors` (#84).
20
+ - Replaced `Bundler.with_unbundled_env` with `Bundler.with_original_env` (#77). This is a better replacement than 42cd1c4.
21
+ - Add deprecation warning `Deprecation warning: Ruby 1.8.7 and 1.9.3 support will be dropped in Geordi 3.x.` to Geordi 2.
22
+ - Fix error `thor requires Ruby version >= 2.0.0` for Ruby 1.8.7 and 1.9.3 (https://github.com/makandra/geordi/issues/79#issuecomment-598664191).
23
+
24
+ ### Breaking changes
25
+
26
+
27
+ ## 2.10.1 2020-02-17
28
+
29
+ ### Compatible changes
30
+ - Add host parameter to mysql dump loader
31
+
12
32
  ## 2.10.0 2020-02-11
13
33
 
14
34
  ### Compatible changes
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source 'http://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'aruba'
7
+ gem 'contracts', '=0.9'
7
8
  gem 'rspec-mocks'
8
9
  gem 'highline'
9
10
  gem 'parallel_tests'
@@ -1,62 +1,65 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (2.10.0)
5
- thor (>= 0.18.0)
4
+ geordi (2.12.2)
5
+ thor (~> 0.18.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
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)
11
+ aruba (0.8.1)
12
+ childprocess (~> 0.5.6)
13
+ contracts (~> 0.9)
14
+ cucumber (>= 1.3.19)
15
+ rspec-expectations (>= 2.99)
15
16
  axiom-types (0.1.1)
16
17
  descendants_tracker (~> 0.0.4)
17
18
  ice_nine (~> 0.11.0)
18
19
  thread_safe (~> 0.3, >= 0.3.1)
19
- builder (3.2.3)
20
- childprocess (1.0.1)
21
- rake (< 13.0)
22
- coderay (1.1.2)
20
+ builder (3.2.4)
21
+ childprocess (0.5.9)
22
+ ffi (~> 1.0, >= 1.0.11)
23
+ coderay (1.1.3)
23
24
  coercible (1.0.0)
24
25
  descendants_tracker (~> 0.0.1)
26
+ contracts (0.9)
25
27
  cucumber (1.3.20)
26
28
  builder (>= 2.1.2)
27
29
  diff-lcs (>= 1.1.3)
28
30
  gherkin (~> 2.12)
29
31
  multi_json (>= 1.7.5, < 2.0)
30
32
  multi_test (>= 0.1.2)
31
- declarative (0.0.10)
33
+ declarative (0.0.20)
32
34
  declarative-option (0.1.0)
33
35
  descendants_tracker (0.0.4)
34
36
  thread_safe (~> 0.3, >= 0.3.1)
35
37
  diff-lcs (1.2.5)
36
38
  equalizer (0.0.11)
37
- excon (0.67.0)
38
- faraday (0.17.0)
39
+ excon (0.78.0)
40
+ faraday (1.1.0)
39
41
  multipart-post (>= 1.2, < 3)
40
- faraday_middleware (0.13.1)
41
- faraday (>= 0.7.4, < 1.0)
42
+ ruby2_keywords
43
+ faraday_middleware (1.0.0)
44
+ faraday (~> 1.0)
45
+ ffi (1.9.18)
42
46
  gherkin (2.12.2)
43
47
  multi_json (~> 1.3)
44
48
  highline (1.6.21)
45
49
  ice_nine (0.11.2)
46
50
  launchy (2.4.3)
47
51
  addressable (~> 2.3)
48
- method_source (0.9.2)
49
- mimemagic (0.3.3)
50
- multi_json (1.13.1)
52
+ method_source (1.0.0)
53
+ mimemagic (0.3.5)
54
+ multi_json (1.15.0)
51
55
  multi_test (0.1.2)
52
56
  multipart-post (2.1.1)
53
57
  parallel (0.5.16)
54
58
  parallel_tests (0.6.18)
55
59
  parallel
56
- pry (0.12.2)
57
- coderay (~> 1.1.0)
58
- method_source (~> 0.9.0)
59
- rake (10.5.0)
60
+ pry (0.13.1)
61
+ coderay (~> 1.1)
62
+ method_source (~> 1.0)
60
63
  representable (3.0.4)
61
64
  declarative (< 0.1.0)
62
65
  declarative-option (< 0.2.0)
@@ -68,9 +71,10 @@ GEM
68
71
  diff-lcs (>= 1.2.0, < 2.0)
69
72
  rspec-support (~> 3.4.0)
70
73
  rspec-support (3.4.1)
71
- thor (0.20.3)
74
+ ruby2_keywords (0.0.2)
75
+ thor (0.18.1)
72
76
  thread_safe (0.3.6)
73
- tracker_api (1.10.0)
77
+ tracker_api (1.11.0)
74
78
  addressable
75
79
  equalizer
76
80
  excon
@@ -92,6 +96,7 @@ PLATFORMS
92
96
 
93
97
  DEPENDENCIES
94
98
  aruba
99
+ contracts (= 0.9)
95
100
  geordi!
96
101
  highline
97
102
  launchy
data/README.md CHANGED
@@ -54,6 +54,11 @@ Commit using a story title from Pivotal Tracker.
54
54
 
55
55
  Example: `geordi commit`
56
56
 
57
+ Any extra arguments are forwarded to `git commit -m <message>`.
58
+
59
+ If there are no staged changes, prints a warning but will continue to create
60
+ an empty commit.
61
+
57
62
  On the first execution we ask for your Pivotal Tracker API token. It will be
58
63
  stored in `~/.gitpt`.
59
64
 
@@ -135,6 +140,23 @@ instead of `cap deploy:migrations`. You can force using `deploy` by passing the
135
140
  -M option: `geordi deploy -M staging`.
136
141
 
137
142
 
143
+ ### `geordi docker`
144
+
145
+ Manage docker containers for the current project.
146
+
147
+ Manage docker containers to run your project dockerized.
148
+
149
+ It expects a docker-compose file that specifies all services, and a service
150
+ named "main" that opens a shell for the project.
151
+
152
+ There are two subcommands:
153
+
154
+ - geordi docker setup
155
+ Builds all docker containers.
156
+ - geordi docker shell
157
+ Runs the docker service named 'main'.
158
+
159
+
138
160
  ### `geordi drop-databases`
139
161
 
140
162
  Interactively delete local databases.
@@ -385,6 +407,9 @@ calling your local geordi like so (adjust paths to your needs):
385
407
 
386
408
  # @option -I: add directory to load path
387
409
  ruby -I ../geordi/lib ../geordi/bin/geordi <command>
410
+
411
+ # with debugger
412
+ ruby -r byebug -I ../geordi/lib ../geordi/bin/geordi <command>
388
413
 
389
414
  Don't forget to update this README. The whole `geordi` section is auto-generated
390
415
  by `rake readme`. Also remember to add your changes to the CHANGELOG.
data/bin/geordi CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
4
+
3
5
  require 'geordi/util'
4
6
 
5
7
  Geordi::Util.installing_missing_gems do
@@ -0,0 +1,86 @@
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"
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,60 @@
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,4 +1,5 @@
1
- require 'aruba/cucumber'
1
+ require 'cucumber/rspec/doubles'
2
+
2
3
 
3
4
  if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('1.8.7')
4
5
  require 'pry'
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
22
 
23
- s.add_runtime_dependency 'thor', '>= 0.18.0'
23
+ s.add_runtime_dependency 'thor', '~> 0.18.0'
24
24
 
25
25
  s.post_install_message = <<-ATTENTION
26
26
  * Binary `geordi` installed
@@ -53,18 +53,21 @@ module Geordi
53
53
  end
54
54
 
55
55
  def find_project_root!
56
- current = Dir.pwd
57
- until File.exists?('Capfile')
58
- Dir.chdir '..'
59
- raise <<-ERROR if current == Dir.pwd
60
- Could not locate Capfile.
61
-
62
- Are you calling me from within a Rails project?
63
- Maybe Capistrano is not installed in this project.
64
- ERROR
65
-
66
- current = Dir.pwd
56
+ current = ENV['RAILS_ROOT'] || Dir.pwd
57
+
58
+ until File.exists?(File.join(current, 'Capfile'))
59
+ if current == '/' || current == '/home' || !File.directory?(current)
60
+ raise <<-ERROR
61
+ Could not locate Capfile.
62
+
63
+ Are you calling me from within a Rails project?
64
+ Maybe Capistrano is not installed in this project.
65
+ ERROR
66
+ else
67
+ current = File.dirname(current)
68
+ end
67
69
  end
70
+
68
71
  current
69
72
  end
70
73
 
@@ -5,8 +5,17 @@ require 'geordi/util'
5
5
 
6
6
  module Geordi
7
7
  class CLI < Thor
8
+
9
+ if Geordi::Util.ruby_version <= Gem::Version.new('2.0.0')
10
+ warn "Deprecation warning: Ruby 1.8.7 and 1.9.3 support will be dropped in Geordi 3.x."
11
+ end
12
+
8
13
  include Geordi::Interaction
9
14
 
15
+ def self.exit_on_failure?
16
+ true
17
+ end
18
+
10
19
  # load all tasks defined in lib/geordi/commands
11
20
  Dir[File.expand_path '../commands/*.rb', __FILE__].each do |file|
12
21
  class_eval File.read(file), file
@@ -0,0 +1,42 @@
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
@@ -11,8 +11,9 @@ module Geordi
11
11
  include Geordi::Interaction
12
12
 
13
13
  VNC_DISPLAY = ':17'
14
- VNC_SERVER_COMMAND = "vncserver #{VNC_DISPLAY} -localhost -nolisten tcp -SecurityTypes None -geometry 1280x1024"
15
- VNC_VIEWER_COMMAND = "vncviewer #{VNC_DISPLAY}"
14
+ VNC_SERVER_DEFAULT_OPTIONS = '-localhost -nolisten tcp -SecurityTypes None -geometry 1280x1024'
15
+ VNC_SERVER_COMMAND = "vncserver #{VNC_DISPLAY} #{ENV.fetch('GEORDI_VNC_OPTIONS', VNC_SERVER_DEFAULT_OPTIONS)}"
16
+ VNC_VIEWER_COMMAND = "vncviewer"
16
17
  VNC_ENV_VARIABLES = %w[DISPLAY BROWSER LAUNCHY_BROWSER]
17
18
 
18
19
  def run(files, cucumber_options, options = {})
@@ -29,10 +30,10 @@ module Geordi
29
30
  system command # Util.system! would reset the Firefox PATH
30
31
  end
31
32
 
32
- def launch_vnc_viewer
33
+ def launch_vnc_viewer(source = VNC_DISPLAY)
33
34
  fork {
34
35
  error = capture_stderr do
35
- system(VNC_VIEWER_COMMAND)
36
+ system(VNC_VIEWER_COMMAND, source)
36
37
  end
37
38
  unless $?.success?
38
39
  if $?.exitstatus == 127
@@ -0,0 +1,116 @@
1
+ require 'geordi/interaction'
2
+ require 'geordi/cucumber'
3
+ require 'yaml'
4
+
5
+ module Geordi
6
+ class Docker
7
+ DOCKER_COMPOSE_FILE = 'docker-compose.yml'.freeze
8
+
9
+ include Interaction
10
+
11
+ def setup
12
+ check_installation_and_config
13
+ announce('Building containers...')
14
+ if execute(:system, 'docker-compose', 'pull')
15
+ success('Build successful.')
16
+ else
17
+ fail('Build failed.')
18
+ end
19
+ end
20
+
21
+ def shell(options = {})
22
+ check_installation_and_config
23
+ if options[:secondary]
24
+ attach_to_running_shell
25
+ else
26
+ run_shell
27
+ end
28
+ end
29
+
30
+ def vnc
31
+ Cucumber.new.launch_vnc_viewer('::5967')
32
+ end
33
+
34
+ private
35
+
36
+ def attach_to_running_shell
37
+ running_containers = execute(:`, 'docker-compose ps').split("\n")
38
+ if (main_container_line = running_containers.grep(/_main_run/).first)
39
+ container_name = main_container_line.split(' ').first
40
+ execute(:system, 'docker', 'exec', '-it', container_name, 'bash')
41
+ else
42
+ fail('Could not find a running shell. Start without --secondary first.')
43
+ end
44
+ end
45
+
46
+ def run_shell
47
+ command = [:system, 'docker-compose', 'run', '--service-ports']
48
+ command += ssh_agent_forward
49
+ command += ['main']
50
+ execute(*command)
51
+ execute(:system, 'docker-compose', 'stop')
52
+ end
53
+
54
+ def execute(kind, *args)
55
+ if ENV['GEORDI_TESTING']
56
+ puts "Stubbed run #{args.join(' ')}"
57
+ if kind == :`
58
+ mock_parse(*args)
59
+ else
60
+ mock_run(*args)
61
+ end
62
+ else
63
+ send(kind, *args)
64
+ end
65
+ end
66
+
67
+ def mock_run(*args)
68
+ # exists just to be stubbed in tests
69
+ true
70
+ end
71
+
72
+ def mock_parse(*args)
73
+ # exists just to be stubbed in tests
74
+ 'command output'
75
+ end
76
+
77
+ def check_installation_and_config
78
+ unless command_exists?('docker')
79
+ fail('You need to install docker first with `sudo apt install docker`. After installation please log out and back in to your system once.')
80
+ end
81
+
82
+ unless command_exists?('docker-compose')
83
+ fail('You need to install docker-compose first with `sudo apt install docker-compose`.')
84
+ end
85
+
86
+ unless docker_compose_config && (services = docker_compose_config['services']) && services.key?('main')
87
+ fail('Your project does not seem to be properly set up. Expected to find a docker-compose.yml which defines a service named "main".')
88
+ end
89
+ end
90
+
91
+ def command_exists?(command)
92
+ execute(:system, "which #{command} > /dev/null")
93
+ end
94
+
95
+ def docker_compose_config
96
+ if File.exists?(DOCKER_COMPOSE_FILE)
97
+ if YAML.respond_to?(:safe_load)
98
+ YAML.safe_load(File.read(DOCKER_COMPOSE_FILE))
99
+ else
100
+ YAML.load(File.read(DOCKER_COMPOSE_FILE))
101
+ end
102
+ end
103
+ rescue
104
+ false
105
+ end
106
+
107
+ def ssh_agent_forward
108
+ if (auth_sock = ENV['SSH_AUTH_SOCK'])
109
+ dirname = File.dirname(auth_sock)
110
+ ['-v', "#{dirname}:#{dirname}", '-e', "SSH_AUTH_SOCK=#{auth_sock}"]
111
+ else
112
+ []
113
+ end
114
+ end
115
+ end
116
+ end
@@ -18,12 +18,13 @@ module Geordi
18
18
  @config['development']
19
19
  end
20
20
  alias_method :config, :development_database_config
21
-
21
+
22
22
  def mysql_command
23
23
  command = 'mysql --silent'
24
24
  command << ' -p' << config['password'].to_s if config['password']
25
25
  command << ' -u' << config['username'].to_s if config['username']
26
26
  command << ' --port=' << config['port'].to_s if config['port']
27
+ command << ' --host=' << config['host'].to_s if config['host']
27
28
  command << ' --default-character-set=utf8'
28
29
  command << ' ' << config['database'].to_s
29
30
  command << ' < ' << dump_file
@@ -51,8 +51,8 @@ module Geordi
51
51
  # Remove Geordi's Bundler environment when running commands.
52
52
  success = if !defined?(Bundler)
53
53
  system(*commands)
54
- elsif Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.1.2')
55
- Bundler.with_unbundled_env do
54
+ elsif Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('1.17.3')
55
+ Bundler.with_original_env do
56
56
  system(*commands)
57
57
  end
58
58
  else
@@ -94,7 +94,7 @@ module Geordi
94
94
  ENV['GEORDI_TESTING_STAGED_CHANGES'] == 'true'
95
95
  else
96
96
  statuses = `git status --porcelain`.split("\n")
97
- statuses.any? { |l| l.start_with? 'A' }
97
+ statuses.any? { |l| l.start_with? /[A-Z]/i }
98
98
  end
99
99
  end
100
100
 
@@ -161,6 +161,10 @@ module Geordi
161
161
  nil
162
162
  end
163
163
 
164
+ def ruby_version
165
+ Gem::Version.new(RUBY_VERSION)
166
+ end
167
+
164
168
  def file_containing?(file, regex)
165
169
  File.exists?(file) and File.read(file).scan(regex).any?
166
170
  end
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '2.10.0'
2
+ VERSION = '2.12.2'
3
3
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-11 00:00:00.000000000 Z
11
+ date: 2020-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.18.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.18.0
27
27
  description: Collection of command line tools we use in our daily work with Ruby,
@@ -81,14 +81,17 @@ files:
81
81
  - features/console.feature
82
82
  - features/cucumber.feature
83
83
  - features/deploy.feature
84
+ - features/docker.feature
84
85
  - features/dump.feature
85
86
  - features/firefox.feature
86
87
  - features/server.feature
87
88
  - features/setup.feature
88
89
  - features/shell.feature
90
+ - features/step_definitions/docker_command_steps.rb
91
+ - features/step_definitions/miscellaneous_steps.rb
92
+ - features/support/aruba.rb
89
93
  - features/support/env.rb
90
94
  - features/support/step_definitions/aruba_backport_steps.rb
91
- - features/support/step_definitions/miscellaneous_steps.rb
92
95
  - geordi.gemspec
93
96
  - lib/geordi.rb
94
97
  - lib/geordi/COMMAND_TEMPLATE
@@ -108,6 +111,7 @@ files:
108
111
  - lib/geordi/commands/cucumber.rb
109
112
  - lib/geordi/commands/delete_dumps.rb
110
113
  - lib/geordi/commands/deploy.rb
114
+ - lib/geordi/commands/docker.rb
111
115
  - lib/geordi/commands/drop_databases.rb
112
116
  - lib/geordi/commands/dump.rb
113
117
  - lib/geordi/commands/eurest.rb
@@ -130,6 +134,7 @@ files:
130
134
  - lib/geordi/commands/yarn_install.rb
131
135
  - lib/geordi/cucumber.rb
132
136
  - lib/geordi/db_cleaner.rb
137
+ - lib/geordi/docker.rb
133
138
  - lib/geordi/dump_loader.rb
134
139
  - lib/geordi/firefox_for_selenium.rb
135
140
  - lib/geordi/gitpt.rb