geordi 2.12.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
data/lib/geordi/docker.rb DELETED
@@ -1,116 +0,0 @@
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(:exec, '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