gorgon 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -2
  3. data/.rspec +2 -0
  4. data/.travis.yml +10 -0
  5. data/Dockerfile +25 -0
  6. data/Gemfile.lock +20 -15
  7. data/README.md +33 -6
  8. data/Rakefile +5 -0
  9. data/architecture.md +2 -2
  10. data/bin/gorgon +2 -114
  11. data/daemon_with_upstart_and_rvm.md +1 -1
  12. data/docker-compose.yml +28 -0
  13. data/file_server/Dockerfile +8 -0
  14. data/file_server/test_gorgon.pem.pub +1 -0
  15. data/gorgon.gemspec +2 -2
  16. data/gorgon_secret.json.sample +5 -0
  17. data/lib/gorgon/amqp_service.rb +28 -26
  18. data/lib/gorgon/callback_handler.rb +28 -26
  19. data/lib/gorgon/colors.rb +6 -4
  20. data/lib/gorgon/command.rb +145 -0
  21. data/lib/gorgon/configuration.rb +45 -5
  22. data/lib/gorgon/core_ext/hash/deep_merge.rb +21 -0
  23. data/lib/gorgon/crash_reporter.rb +15 -13
  24. data/lib/gorgon/failures_printer.rb +27 -26
  25. data/lib/gorgon/g_logger.rb +19 -17
  26. data/lib/gorgon/gem_command_handler.rb +41 -39
  27. data/lib/gorgon/gem_service.rb +60 -57
  28. data/lib/gorgon/host_state.rb +23 -21
  29. data/lib/gorgon/job.rb +19 -17
  30. data/lib/gorgon/job_definition.rb +23 -21
  31. data/lib/gorgon/job_state.rb +93 -90
  32. data/lib/gorgon/listener.rb +137 -146
  33. data/lib/gorgon/listener_installer.rb +98 -96
  34. data/lib/gorgon/originator.rb +170 -167
  35. data/lib/gorgon/originator_logger.rb +30 -28
  36. data/lib/gorgon/originator_protocol.rb +85 -83
  37. data/lib/gorgon/ping_service.rb +44 -42
  38. data/lib/gorgon/pipe_forker.rb +17 -15
  39. data/lib/gorgon/progress_bar_view.rb +109 -107
  40. data/lib/gorgon/rsync_daemon.rb +56 -54
  41. data/lib/gorgon/runtime_file_reader.rb +28 -27
  42. data/lib/gorgon/runtime_recorder.rb +27 -26
  43. data/lib/gorgon/settings/files_content.rb +27 -25
  44. data/lib/gorgon/settings/initial_files_creator.rb +58 -56
  45. data/lib/gorgon/settings/rails_project_files_content.rb +33 -31
  46. data/lib/gorgon/settings/simple_project_files_content.rb +11 -9
  47. data/lib/gorgon/shutdown_manager.rb +20 -18
  48. data/lib/gorgon/source_tree_syncer.rb +108 -69
  49. data/lib/gorgon/version.rb +1 -1
  50. data/lib/gorgon/worker.rb +130 -128
  51. data/lib/gorgon/worker_manager.rb +139 -137
  52. data/lib/gorgon_amq-protocol/.rspec +3 -0
  53. data/run_dev_environment.sh +3 -0
  54. data/run_gorgon.sh +3 -0
  55. data/run_listener.sh +3 -0
  56. data/run_test.sh +3 -0
  57. data/spec/callback_handler_spec.rb +10 -10
  58. data/spec/command_spec.rb +172 -0
  59. data/spec/configuration_spec.rb +62 -0
  60. data/spec/core_ext/hash/deep_merge_spec.rb +11 -0
  61. data/spec/crash_reporter_spec.rb +10 -10
  62. data/spec/dummy/.gitignore +3 -0
  63. data/spec/dummy/Gemfile +11 -0
  64. data/spec/dummy/Gemfile.lock +76 -0
  65. data/spec/dummy/README.md +23 -0
  66. data/spec/dummy/gorgon.json +30 -0
  67. data/spec/dummy/gorgon_callbacks.rb +68 -0
  68. data/spec/dummy/gorgon_listener.json +8 -0
  69. data/spec/dummy/integration_spec.rb +51 -0
  70. data/spec/{support/mock_app/app/mailers → dummy/log}/.gitkeep +0 -0
  71. data/spec/dummy/rspec_runner.rb +8 -0
  72. data/spec/dummy/spec/1_syntax_error_spec.rb +1 -0
  73. data/spec/dummy/spec/exception_spec.rb +5 -0
  74. data/spec/dummy/spec/failing_spec.rb +11 -0
  75. data/spec/dummy/spec/keeping_rspec_config_spec.rb +5 -0
  76. data/spec/dummy/spec/spec_helper.rb +13 -0
  77. data/spec/dummy/spec/successful_spec.rb +9 -0
  78. data/spec/dummy/spec/using_shared_example_spec.rb +3 -0
  79. data/spec/dummy/test/.rb +15 -0
  80. data/spec/dummy/test/minitest/mini1_test.rb +11 -0
  81. data/spec/dummy/test/minitest/mini2_test.rb +25 -0
  82. data/spec/dummy/test/unit/1_syntax_error_test.rb +9 -0
  83. data/spec/dummy/test/unit/exception_test.rb +14 -0
  84. data/spec/dummy/test/unit/failing_test.rb +17 -0
  85. data/spec/dummy/test/unit/successful_test.rb +9 -0
  86. data/spec/dummy/test_gorgon.pem +27 -0
  87. data/spec/end_to_end_spec.rb +142 -0
  88. data/spec/failures_printer_spec.rb +20 -20
  89. data/spec/gem_command_handler_spec.rb +24 -24
  90. data/spec/gem_service_spec.rb +18 -18
  91. data/spec/gorgon_rspec_formatter_spec.rb +12 -12
  92. data/spec/host_state_spec.rb +8 -8
  93. data/spec/job_definition_spec.rb +3 -3
  94. data/spec/job_state_spec.rb +46 -46
  95. data/spec/listener_spec.rb +67 -73
  96. data/spec/mini_test_runner_spec.rb +7 -7
  97. data/spec/originator_logger_spec.rb +6 -6
  98. data/spec/originator_protocol_spec.rb +38 -38
  99. data/spec/originator_spec.rb +78 -69
  100. data/spec/ping_service_spec.rb +14 -14
  101. data/spec/pipe_forker_spec.rb +13 -13
  102. data/spec/progress_bar_view_spec.rb +32 -32
  103. data/spec/rspec_runner_spec.rb +12 -12
  104. data/spec/rsync_daemon_spec.rb +18 -16
  105. data/spec/runtime_file_reader_spec.rb +12 -12
  106. data/spec/runtime_recorder_spec.rb +19 -19
  107. data/spec/shutdown_manager_spec.rb +9 -9
  108. data/spec/source_tree_syncer_spec.rb +148 -61
  109. data/spec/spec_helper.rb +3 -0
  110. data/spec/support/end_to_end_helpers.rb +16 -0
  111. data/spec/support/stream_helpers.rb +23 -0
  112. data/spec/unknown_runner_spec.rb +1 -1
  113. data/spec/worker_manager_spec.rb +23 -23
  114. data/spec/worker_spec.rb +70 -70
  115. metadata +84 -113
  116. data/spec/acceptance_spec_helper.rb +0 -7
  117. data/spec/support/mock_app/.gitignore +0 -15
  118. data/spec/support/mock_app/Gemfile +0 -39
  119. data/spec/support/mock_app/Gemfile.lock +0 -135
  120. data/spec/support/mock_app/README.rdoc +0 -261
  121. data/spec/support/mock_app/Rakefile +0 -7
  122. data/spec/support/mock_app/app/assets/images/rails.png +0 -0
  123. data/spec/support/mock_app/app/assets/javascripts/application.js +0 -15
  124. data/spec/support/mock_app/app/assets/stylesheets/application.css +0 -13
  125. data/spec/support/mock_app/app/controllers/application_controller.rb +0 -3
  126. data/spec/support/mock_app/app/helpers/application_helper.rb +0 -2
  127. data/spec/support/mock_app/app/models/.gitkeep +0 -0
  128. data/spec/support/mock_app/app/views/layouts/application.html.erb +0 -14
  129. data/spec/support/mock_app/config.ru +0 -4
  130. data/spec/support/mock_app/config/application.rb +0 -62
  131. data/spec/support/mock_app/config/boot.rb +0 -6
  132. data/spec/support/mock_app/config/database.yml +0 -25
  133. data/spec/support/mock_app/config/environment.rb +0 -5
  134. data/spec/support/mock_app/config/environments/development.rb +0 -37
  135. data/spec/support/mock_app/config/environments/production.rb +0 -67
  136. data/spec/support/mock_app/config/environments/test.rb +0 -37
  137. data/spec/support/mock_app/config/initializers/backtrace_silencers.rb +0 -7
  138. data/spec/support/mock_app/config/initializers/inflections.rb +0 -15
  139. data/spec/support/mock_app/config/initializers/mime_types.rb +0 -5
  140. data/spec/support/mock_app/config/initializers/secret_token.rb +0 -7
  141. data/spec/support/mock_app/config/initializers/session_store.rb +0 -8
  142. data/spec/support/mock_app/config/initializers/wrap_parameters.rb +0 -14
  143. data/spec/support/mock_app/config/locales/en.yml +0 -5
  144. data/spec/support/mock_app/config/routes.rb +0 -58
  145. data/spec/support/mock_app/db/seeds.rb +0 -7
  146. data/spec/support/mock_app/doc/README_FOR_APP +0 -2
  147. data/spec/support/mock_app/lib/assets/.gitkeep +0 -0
  148. data/spec/support/mock_app/lib/tasks/.gitkeep +0 -0
  149. data/spec/support/mock_app/log/.gitkeep +0 -0
  150. data/spec/support/mock_app/public/404.html +0 -26
  151. data/spec/support/mock_app/public/422.html +0 -26
  152. data/spec/support/mock_app/public/500.html +0 -25
  153. data/spec/support/mock_app/public/favicon.ico +0 -0
  154. data/spec/support/mock_app/public/index.html +0 -241
  155. data/spec/support/mock_app/public/robots.txt +0 -5
  156. data/spec/support/mock_app/script/rails +0 -6
  157. data/spec/support/mock_app/test/fixtures/.gitkeep +0 -0
  158. data/spec/support/mock_app/test/functional/.gitkeep +0 -0
  159. data/spec/support/mock_app/test/integration/.gitkeep +0 -0
  160. data/spec/support/mock_app/test/performance/browsing_test.rb +0 -12
  161. data/spec/support/mock_app/test/test_helper.rb +0 -13
  162. data/spec/support/mock_app/test/unit/.gitkeep +0 -0
  163. data/spec/support/mock_app/test/unit/passing_test.rb +0 -7
  164. data/spec/support/mock_app/vendor/assets/javascripts/.gitkeep +0 -0
  165. data/spec/support/mock_app/vendor/assets/stylesheets/.gitkeep +0 -0
  166. data/spec/support/mock_app/vendor/plugins/.gitkeep +0 -0
  167. data/spec/support/originator_handler.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4c7715c6f11333845258e304eec73544db11135d
4
- data.tar.gz: f4f2c0ca24b61ebd1e238673dbba746bb30a787f
2
+ SHA256:
3
+ metadata.gz: 9724573d2e23c58b465f2420cff3d59af675e9599555daf228c55556d247ff9d
4
+ data.tar.gz: 3b92ad056401808c0b01e4cbc9631d77cf1114d96a507bd70df6eddd0e4b5838
5
5
  SHA512:
6
- metadata.gz: 16092b5b748104343f172c539d2dd0a8e625ce2c06bb628d717e4140729c2e77536e91c68914774241eb0ba242fd9c523434915d8908239c79e1ddf2061f16e8
7
- data.tar.gz: 2a08a60a432b19c46ab7170cb2c4e0061fa9a8c1cc2b42b635a54d2d342457ba92929dbc936a460c97bf8aef20b24148e9108548ef9fa7c49222575ddae148b6
6
+ metadata.gz: 759e075c18e5b1e9cdfb04a366156a16626835ff6edbcec56ee859a49aacbbdb5e8ccb08c04faedd226585be79c2b330ee7bec2061b5fb6af4b4b174c05553a0
7
+ data.tar.gz: a0b6e638d57012577d914e074e0ac7952dde717bf9ab4cff57f900c048bb97b0dbc6f7e69ca71056e4ac7e1cda3c317313530ed8f8ffcbd30dcc1346fc4bf7d0
data/.gitignore CHANGED
@@ -10,7 +10,5 @@ pkg
10
10
  .idea
11
11
  .rbenv-version
12
12
  *.log
13
- *.json
14
- .rspec
15
13
  .rake_tasks
16
14
  *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --require spec_helper
@@ -0,0 +1,10 @@
1
+ language: bash
2
+ sudo: required
3
+ services:
4
+ - docker
5
+ before_script:
6
+ - ./run_dev_environment.sh -d
7
+ - sleep 15
8
+ - ./run_listener.sh &
9
+ - ./run_gorgon.sh || true # ignore error status from gorgon run
10
+ script: ./run_test.sh
@@ -0,0 +1,25 @@
1
+ FROM ruby:2.1.6-slim
2
+
3
+ RUN apt-get update -y && apt-get install -y \
4
+ build-essential \
5
+ git \
6
+ net-tools # we need ifconfig
7
+
8
+ RUN mkdir -p ~/.ssh
9
+
10
+ ADD spec/dummy/test_gorgon.pem .
11
+ RUN mv test_gorgon.pem ~/.ssh/id_rsa && chmod 400 ~/.ssh/id_rsa
12
+
13
+ WORKDIR '/opt/gorgon'
14
+
15
+ RUN gem install bundler
16
+ ADD ["Gemfile", "Gemfile.lock", "gorgon.gemspec", "./"]
17
+ ADD ["lib/gorgon/version.rb", "lib/gorgon/"]
18
+ RUN bundle install
19
+
20
+ ADD . .
21
+
22
+ RUN gem build gorgon.gemspec && gem install gorgon
23
+ RUN cd spec/dummy
24
+
25
+ ENTRYPOINT ["/bin/bash", "-c", "sleep infinity"]
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gorgon (0.11.0)
4
+ gorgon (0.11.1)
5
5
  amq-protocol (~> 1.9.2)
6
6
  amqp (~> 1.1.0)
7
7
  awesome_print
@@ -10,7 +10,7 @@ PATH
10
10
  open4 (~> 1.3.0)
11
11
  ruby-progressbar (~> 1.7.5)
12
12
  uuidtools (= 2.1.3)
13
- yajl-ruby (= 1.1.0)
13
+ yajl-ruby (= 1.3.1)
14
14
 
15
15
  GEM
16
16
  remote: http://rubygems.org/
@@ -19,24 +19,29 @@ GEM
19
19
  amqp (1.1.8)
20
20
  amq-protocol (>= 1.9.2)
21
21
  eventmachine
22
- awesome_print (1.7.0)
22
+ awesome_print (1.8.0)
23
23
  colorize (0.5.8)
24
- diff-lcs (1.1.3)
24
+ diff-lcs (1.3)
25
25
  eventmachine (1.0.9.1)
26
26
  open4 (1.3.4)
27
27
  rake (0.9.2.2)
28
- rspec (2.11.0)
29
- rspec-core (~> 2.11.0)
30
- rspec-expectations (~> 2.11.0)
31
- rspec-mocks (~> 2.11.0)
32
- rspec-core (2.11.1)
33
- rspec-expectations (2.11.3)
34
- diff-lcs (~> 1.1.3)
35
- rspec-mocks (2.11.3)
28
+ rspec (3.5.0)
29
+ rspec-core (~> 3.5.0)
30
+ rspec-expectations (~> 3.5.0)
31
+ rspec-mocks (~> 3.5.0)
32
+ rspec-core (3.5.4)
33
+ rspec-support (~> 3.5.0)
34
+ rspec-expectations (3.5.0)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.5.0)
37
+ rspec-mocks (3.5.0)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.5.0)
40
+ rspec-support (3.5.0)
36
41
  ruby-progressbar (1.7.5)
37
42
  test-unit (2.5.2)
38
43
  uuidtools (2.1.3)
39
- yajl-ruby (1.1.0)
44
+ yajl-ruby (1.3.1)
40
45
 
41
46
  PLATFORMS
42
47
  ruby
@@ -44,8 +49,8 @@ PLATFORMS
44
49
  DEPENDENCIES
45
50
  gorgon!
46
51
  rake
47
- rspec (~> 2.11.0)
52
+ rspec (~> 3.5.0)
48
53
  test-unit
49
54
 
50
55
  BUNDLED WITH
51
- 1.13.1
56
+ 1.16.1
data/README.md CHANGED
@@ -1,8 +1,4 @@
1
- Gorgon
2
- =====================
3
-
4
- [![Gem Version](https://badge.fury.io/rb/gorgon.png)](https://rubygems.org/gems/gorgon)
5
- [![Code Climate](https://codeclimate.com/github/Fitzsimmons/Gorgon.png)](https://codeclimate.com/github/Fitzsimmons/Gorgon)
1
+ # Gorgon [![Build Status](https://travis-ci.org/nulogy/Gorgon.svg?branch=master)](https://travis-ci.org/nulogy/Gorgon) [![Gem Version](https://badge.fury.io/rb/gorgon.svg)](https://rubygems.org/gems/gorgon) [![Code Climate](https://codeclimate.com/github/nulogy/Gorgon/badges/gpa.svg)](https://codeclimate.com/github/nulogy/Gorgon)
6
2
 
7
3
  About
8
4
  ---------------------
@@ -26,6 +22,7 @@ Gotchas
26
22
 
27
23
  Also note that the steps in the tutorial are **not** meant to work on every project, they will only give you initial settings. You will probably have to modify the following files:
28
24
  * gorgon.json
25
+ * gorgon_secret.json
29
26
  * {test, spec}/gorgon_callbacks/gorgon_callbacks.rb
30
27
  * gorgon_listener.json (located in your project root or in ~/.gorgon/)
31
28
 
@@ -47,6 +44,11 @@ This file contains project-specific settings for gorgon, such as:
47
44
 
48
45
  See [gorgon.json example](/gorgon.json.sample) for an example file.
49
46
 
47
+ ### gorgon_secret.json (optional)
48
+ This optional file contains sensitive information such as passwords that cannot be put in gorgon.json.
49
+
50
+ See [gorgon_secret.json example](/gorgon_secret.json.sample) for an example file.
51
+
50
52
  ### gorgon_listener.json
51
53
  This file contains the listener-specific settings, such as:
52
54
 
@@ -60,6 +62,31 @@ Contributing
60
62
  ---------------------
61
63
  Read overview [architecture](/architecture.md)
62
64
 
65
+ ### Requirements:
66
+
67
+ * You only need [Docker](https://docs.docker.com/docker-for-mac/install/)
68
+
69
+ ### Prepare your environment
70
+
71
+ * Execute `./run_dev_environment.sh`
72
+ * In a new terminal tab, execute `./run_listener.sh`
73
+
74
+ **NOTE:** If you make changes changes to `listener` code, you must restart `./run_listener.sh` for those changes to take effect
75
+
76
+ ### Running all tests
77
+
78
+ * `./run_test.sh`
79
+
80
+ ### Running gorgon using the `spec/dummy` project
81
+
82
+ * `./run_gorgon.sh`
83
+
84
+ Releasing to RubyGems
85
+ ---------------------
86
+
87
+ 1. Update `version.rb`
88
+ 1. Run `rake release`
89
+
63
90
  Credits
64
91
  ---------------------
65
92
  Gorgon is maintained by:
@@ -67,4 +94,4 @@ Gorgon is maintained by:
67
94
  * Arturo Pie
68
95
 
69
96
  Gorgon is funded by [Nulogy Corp](http://www.nulogy.com/).
70
- Thank you to all the [contributors](https://github.com/Fitzsimmons/Gorgon/contributors).
97
+ Thank you to all the [contributors](https://github.com/nulogy/Gorgon/contributors).
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => [:spec]
@@ -1,7 +1,7 @@
1
1
  Architecture
2
2
  ---------------------
3
3
 
4
- [Gorgon](https://github.com/Fitzsimmons/Gorgon/) distributes a test suite across multiple machines. So you can use all the computer power in your office to run your tests in parallel.
4
+ [Gorgon](https://github.com/nulogy/Gorgon/) distributes a test suite across multiple machines. So you can use all the computer power in your office to run your tests in parallel.
5
5
 
6
6
  These are the main components of Gorgon's architecture:
7
7
 
@@ -33,7 +33,7 @@ When a *listener* receives a *job definition*, it:
33
33
  After WorkerManager starts, it:
34
34
 
35
35
  * Runs before_creating_workers callback
36
- * Forks n workers, where n is the number of available worker slots specified in [gorgon configuration](https://github.com/Fitzsimmons/Gorgon/blob/master/gorgon_listener.json.sample).
36
+ * Forks n workers, where n is the number of available worker slots specified in [gorgon configuration](https://github.com/nulogy/Gorgon/blob/master/gorgon_listener.json.sample).
37
37
  * Subscribes to a queue where originator can send a cancel_job message
38
38
 
39
39
  Each Worker:
data/bin/gorgon CHANGED
@@ -1,116 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "rubygems"
4
- require 'gorgon'
5
- require 'gorgon/originator'
6
- require 'gorgon/listener'
7
- require 'gorgon/rsync_daemon'
8
- require 'gorgon/worker_manager'
9
- require 'gorgon/ping_service'
10
- require 'gorgon/gem_service'
11
- require 'gorgon/version'
12
- require 'gorgon/listener_installer'
13
- require 'gorgon/settings/initial_files_creator'
14
-
15
- WELCOME_MSG = "Welcome to Gorgon #{Gorgon::VERSION}"
16
-
17
- def start
18
- o = Originator.new
19
- exit o.originate
20
- end
21
-
22
- def listen
23
- l = Listener.new
24
- l.listen
25
- end
26
-
27
- def start_rsync_daemon
28
- puts "Starting rsync daemon..."
29
- exit 1 unless RsyncDaemon.start ARGV[1]
30
- puts "Rsync Daemon is running. Use 'gorgon stop_rsync' to kill it."
31
- end
32
-
33
- def stop_rsync_daemon
34
- puts "Stopping rsync daemon..."
35
- exit 1 unless RsyncDaemon.stop
36
- puts "Done"
37
- end
38
-
39
- def manage_workers
40
- config_path = ENV["GORGON_CONFIG_PATH"]
41
-
42
- manager = WorkerManager.build config_path
43
- manager.manage
44
-
45
- # For some reason I have to 'exit' here, otherwise WorkerManager process crashes
46
- exit
47
- end
48
-
49
- def ping_listeners
50
- PingService.new.ping_listeners
51
- end
52
-
53
- def run_gem command
54
- GemService.new.run command
55
- end
56
-
57
- def init framework
58
- Settings::InitialFilesCreator.run framework
59
- end
60
-
61
- def install_listener
62
- ListenerInstaller.install
63
- end
64
-
65
- def usage
66
- #print instructions on how to use gorgon
67
- puts "\tstart - remotely runs all tests specified in gorgon.json"
68
- puts "\tlisten - starts a listener process using the settings in gorgon_listener.json"
69
- puts "\tping - pings listeners and shows hosts and gorgon's version they are running"
70
- puts "\tinit [rails] - create initial files for current project"
71
- puts "\tinstall_listener - runs gorgon listener as a daemon process"
72
- puts "\tstart_rsync <directory> - start rsync daemon. Run this command in File Server"
73
- puts "\tstop_rsync - stop rsync daemon."
74
- puts "\tgem command [options...] - execute the gem command on every listener and shutdown listener. e.g. 'gorgon gem install --version 1.0.0'"
75
- end
76
-
77
- case ARGV[0] # special case for 'version', because we don't need the welcome message telling us the version when we're explicitly asking for it
78
- when "version", "--version"
79
- puts Gorgon::VERSION
80
- exit
81
- end
82
-
83
- puts WELCOME_MSG
84
-
85
- case ARGV[0]
86
- when nil
87
- start
88
- when "help", "--help"
89
- usage
90
- exit
91
- when "start"
92
- start
93
- when "listen"
94
- listen
95
- when "start_rsync"
96
- start_rsync_daemon
97
- when "stop_rsync"
98
- stop_rsync_daemon
99
- when "manage_workers"
100
- manage_workers
101
- when "ping"
102
- ping_listeners
103
- when "gem"
104
- ARGV.shift
105
- run_gem ARGV.join(' ')
106
- when "help"
107
- usage
108
- when "init"
109
- init ARGV[1]
110
- when "install_listener"
111
- install_listener
112
- else
113
- puts "Unknown command!"
114
- usage
115
- exit 1
116
- end
3
+ require 'gorgon/command'
4
+ Gorgon::Command.run(ARGV)
@@ -5,7 +5,7 @@ These steps will guarantee that the listener is always running and it will start
5
5
  1. `mkdir ~/.gorgon && cd ~/.gorgon`
6
6
  1. `rvm use ruby-1.9.3` or whatever version of ruby you use.
7
7
  1. `gem install gorgon foreman`
8
- 1. Place your _gorgon\_listener.json_ in this directory. See [here](https://github.com/Fitzsimmons/Gorgon/blob/master/gorgon_listener.json.sample) for a _gorgon\_listener.json_ example.
8
+ 1. Place your _gorgon\_listener.json_ in this directory. See [here](https://github.com/nulogy/Gorgon/blob/master/gorgon_listener.json.sample) for a _gorgon\_listener.json_ example.
9
9
  1. `echo 'listener: [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" && `
10
10
  `rvm ruby-1.9.3 do gorgon listen > listener.out 2> listener.err' > Procfile`
11
11
  1. ``rvmsudo foreman export upstart /etc/init -a gorgon -u `whoami` -c listener=1``
@@ -0,0 +1,28 @@
1
+ version: '3'
2
+ services:
3
+ rabbitmq:
4
+ image: "rabbitmq:alpine"
5
+ ports:
6
+ - "5672:5672"
7
+ file_server:
8
+ build: "file_server"
9
+ volumes:
10
+ - .:/opt/gorgon
11
+ listener:
12
+ container_name: "gorgon_listener"
13
+ build: .
14
+ entrypoint: "sleep infinity"
15
+ hostname: listener
16
+ volumes:
17
+ - .:/opt/gorgon
18
+ depends_on:
19
+ - rabbitmq
20
+ originator:
21
+ container_name: "gorgon_originator"
22
+ build: .
23
+ entrypoint: "sleep infinity"
24
+ volumes:
25
+ - .:/opt/gorgon
26
+ depends_on:
27
+ - rabbitmq
28
+
@@ -0,0 +1,8 @@
1
+ FROM rastasheep/ubuntu-sshd:16.04
2
+
3
+ RUN apt-get update && apt-get install -y rsync
4
+
5
+ ADD test_gorgon.pem.pub .
6
+
7
+ RUN mkdir -p ~/.ssh \
8
+ && cat test_gorgon.pem.pub >> ~/.ssh/authorized_keys
@@ -0,0 +1 @@
1
+ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1d8JdZfeqU4sSuHBf05UQUradgWds1W6UFkTm89ZsPAFTJNLO40A603tyYX/kYWdYmbZQev4ExznIpZDChdqTojjjP1qnFESv9NcBUERHo3I79mp2PanQfFnL0VkcJw9XbDAZITc7lTyZymGZZL3FiGNWGiik3m+OhuBebqJ7shhUm9i+1k4LEIEqYPERMOX0dimHJLCw2Fzh+89piYM/yOTZIY3tneDaQPwU6Z7ytRR1g1B+eLaXsCrihE1SeXjy/powYqpbz1EB34uD+aM9Vwiyb/rtcfkTQWA69UA9Niqd7TpsGllyQeu7jbFQ82WQe2GIv09ukG5hVg0pD2Bb arturopie@arturop-mac-2.local
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_development_dependency "rake"
22
22
  s.add_development_dependency "test-unit"
23
- s.add_development_dependency "rspec", '~>2.11.0'
23
+ s.add_development_dependency "rspec", '~>3.5.0'
24
24
 
25
25
  s.add_runtime_dependency "amqp", '~> 1.1.0'
26
26
  s.add_runtime_dependency "amq-protocol", '~> 1.9.2'
@@ -32,6 +32,6 @@ Gem::Specification.new do |s|
32
32
 
33
33
  # this dependencies are clashing with one of our apps
34
34
  # This problem should be fixed
35
- s.add_runtime_dependency "yajl-ruby", '=1.1.0'
35
+ s.add_runtime_dependency "yajl-ruby", '=1.3.1'
36
36
  s.add_runtime_dependency "uuidtools", '=2.1.3'
37
37
  end
@@ -0,0 +1,5 @@
1
+ {
2
+ "connection": {
3
+ "password": "password"
4
+ }
5
+ }
@@ -1,39 +1,41 @@
1
1
  require 'gorgon_bunny/lib/gorgon_bunny'
2
2
  require 'yajl'
3
3
 
4
- class AmqpQueueDecorator
5
- def initialize queue
6
- @queue = queue
7
- end
4
+ module Gorgon
5
+ class AmqpQueueDecorator
6
+ def initialize queue
7
+ @queue = queue
8
+ end
8
9
 
9
- def pop
10
- m = @queue.pop
11
- payload = m[2]
12
- return payload
10
+ def pop
11
+ m = @queue.pop
12
+ payload = m[2]
13
+ return payload
14
+ end
13
15
  end
14
- end
15
16
 
16
- class AmqpExchangeDecorator
17
- def initialize exchange
18
- @exchange = exchange
19
- end
17
+ class AmqpExchangeDecorator
18
+ def initialize exchange
19
+ @exchange = exchange
20
+ end
20
21
 
21
- def publish msg
22
- serialized_msg = Yajl::Encoder.encode(msg)
23
- @exchange.publish serialized_msg
22
+ def publish msg
23
+ serialized_msg = Yajl::Encoder.encode(msg)
24
+ @exchange.publish serialized_msg
25
+ end
24
26
  end
25
- end
26
27
 
27
- class AmqpService
28
- def initialize connection_config
29
- @connection_config = connection_config.merge(:spec => "09")
30
- end
28
+ class AmqpService
29
+ def initialize connection_config
30
+ @connection_config = connection_config.merge(:spec => "09")
31
+ end
31
32
 
32
- def start_worker file_queue_name, reply_exchange_name
33
- GorgonBunny.run @connection_config do |b|
34
- queue = b.queue(file_queue_name, :auto_delete => true)
35
- exchange = b.exchange(reply_exchange_name, :auto_delete => true)
36
- yield AmqpQueueDecorator.new(queue), AmqpExchangeDecorator.new(exchange)
33
+ def start_worker file_queue_name, reply_exchange_name
34
+ GorgonBunny.run @connection_config do |b|
35
+ queue = b.queue(file_queue_name, :auto_delete => true)
36
+ exchange = b.exchange(reply_exchange_name, :auto_delete => true)
37
+ yield AmqpQueueDecorator.new(queue), AmqpExchangeDecorator.new(exchange)
38
+ end
37
39
  end
38
40
  end
39
41
  end