g5_sibling_deployer_engine 0.2.6

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 (91) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +13 -0
  5. data/Gemfile +6 -0
  6. data/Guardfile +24 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +130 -0
  9. data/Rakefile +2 -0
  10. data/app/controllers/siblings/application_controller.rb +2 -0
  11. data/app/controllers/siblings/deploys_controller.rb +5 -0
  12. data/app/controllers/siblings/instructions_controller.rb +5 -0
  13. data/app/controllers/siblings_controller.rb +14 -0
  14. data/app/controllers/webhooks_controller.rb +6 -0
  15. data/app/models/sibling/deploy.rb +59 -0
  16. data/app/models/sibling/instruction.rb +60 -0
  17. data/app/models/sibling.rb +56 -0
  18. data/app/views/siblings/_nav.html.erb +5 -0
  19. data/app/views/siblings/deploys/index.html.erb +15 -0
  20. data/app/views/siblings/index.html.erb +16 -0
  21. data/app/views/siblings/instructions/index.html.erb +13 -0
  22. data/app/workers/sibling_consumer.rb +15 -0
  23. data/app/workers/sibling_deployer.rb +40 -0
  24. data/app/workers/sibling_instruction_consumer.rb +15 -0
  25. data/config/initializers/github_heroku_deployer.rb +7 -0
  26. data/config/initializers/resque.rb +12 -0
  27. data/config/initializers/table_cloth.rb +3 -0
  28. data/config/routes.rb +12 -0
  29. data/db/migrate/001_create_siblings.rb +14 -0
  30. data/db/migrate/002_create_sibling_deploys.rb +15 -0
  31. data/db/migrate/003_create_sibling_instructions.rb +11 -0
  32. data/g5_sibling_deployer_engine.gemspec +34 -0
  33. data/lib/g5_sibling_deployer_engine/engine.rb +4 -0
  34. data/lib/g5_sibling_deployer_engine/version.rb +3 -0
  35. data/lib/g5_sibling_deployer_engine.rb +12 -0
  36. data/lib/tasks/g5_sibling_deployer_engine_tasks.rake +16 -0
  37. data/lib/tasks/resque.rake +8 -0
  38. data/main_app_v2.html +38 -0
  39. data/spec/controllers/siblings/deploys_controller_spec.rb +12 -0
  40. data/spec/controllers/siblings/instructions_controller_spec.rb +12 -0
  41. data/spec/controllers/siblings_controller_spec.rb +28 -0
  42. data/spec/controllers/webhooks_controller_spec.rb +13 -0
  43. data/spec/dummy/README.rdoc +261 -0
  44. data/spec/dummy/Rakefile +7 -0
  45. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  46. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  47. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  48. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  49. data/spec/dummy/app/mailers/.gitkeep +0 -0
  50. data/spec/dummy/app/models/.gitkeep +0 -0
  51. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  52. data/spec/dummy/config/application.rb +65 -0
  53. data/spec/dummy/config/boot.rb +10 -0
  54. data/spec/dummy/config/database.yml +25 -0
  55. data/spec/dummy/config/environment.rb +5 -0
  56. data/spec/dummy/config/environments/development.rb +37 -0
  57. data/spec/dummy/config/environments/production.rb +67 -0
  58. data/spec/dummy/config/environments/test.rb +37 -0
  59. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  60. data/spec/dummy/config/initializers/inflections.rb +15 -0
  61. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  62. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  63. data/spec/dummy/config/initializers/session_store.rb +8 -0
  64. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  65. data/spec/dummy/config/locales/en.yml +5 -0
  66. data/spec/dummy/config/routes.rb +58 -0
  67. data/spec/dummy/config.ru +4 -0
  68. data/spec/dummy/db/development.sqlite3 +0 -0
  69. data/spec/dummy/db/schema.rb +47 -0
  70. data/spec/dummy/db/test.sqlite3 +0 -0
  71. data/spec/dummy/lib/assets/.gitkeep +0 -0
  72. data/spec/dummy/log/.gitkeep +0 -0
  73. data/spec/dummy/public/404.html +26 -0
  74. data/spec/dummy/public/422.html +26 -0
  75. data/spec/dummy/public/500.html +25 -0
  76. data/spec/dummy/public/favicon.ico +0 -0
  77. data/spec/dummy/script/rails +6 -0
  78. data/spec/lib/g5_sibling_deployer_engine_spec.rb +8 -0
  79. data/spec/models/sibling/deploy_spec.rb +61 -0
  80. data/spec/models/sibling/instruction_spec.rb +63 -0
  81. data/spec/models/sibling_spec.rb +73 -0
  82. data/spec/routing/routes_spec.rb +31 -0
  83. data/spec/spec_helper.rb +42 -0
  84. data/spec/support/g5-configurator-app.html +98 -0
  85. data/spec/support/g5-configurator-entries.html +387 -0
  86. data/spec/support/instructions.html +51 -0
  87. data/spec/support/main_app.html +87 -0
  88. data/spec/workers/sibling_consumer_spec.rb +21 -0
  89. data/spec/workers/sibling_deployer_spec.rb +45 -0
  90. data/spec/workers/sibling_instruction_consumer_spec.rb +15 -0
  91. metadata +352 -0
@@ -0,0 +1,21 @@
1
+ require "spec_helper"
2
+
3
+ describe SiblingConsumer do
4
+ describe ".perform" do
5
+ it "consumes entry feed" do
6
+ Sibling.should_receive(:consume_main_app_hcard).once
7
+ SiblingConsumer.perform
8
+ end
9
+ it "raises error when there is no Sibling.main_app_uid" do
10
+ lambda { SiblingConsumer.perform }.should raise_error(TypeError)
11
+ end
12
+ it "returns true when there is a Sibling.main_app_uid" do
13
+ Sibling.stub(:main_app_uid).and_return("spec/support/g5-configurator-app.html")
14
+ SiblingConsumer.perform.should be_true
15
+ end
16
+ it "does not swallow errors" do
17
+ Sibling.stub(:consume_main_app_hcard).and_raise(StandardError.new("Foo"))
18
+ lambda { SiblingConsumer.perform }.should raise_error(StandardError, "Foo")
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,45 @@
1
+ require "spec_helper"
2
+
3
+ describe SiblingDeployer do
4
+ before do
5
+ @sibling_deploy = mock(Sibling::Deploy)
6
+ Sibling::Deploy.stub(:find) { @sibling_deploy }
7
+ end
8
+
9
+ describe ".perform" do
10
+ it "deploys entry feed" do
11
+ @sibling_deploy.should_receive(:deploy).once
12
+ SiblingDeployer.perform(1)
13
+ end
14
+
15
+ it "does not swallow errors" do
16
+ @sibling_deploy.stub(:deploy).and_raise(StandardError.new("Foo"))
17
+ lambda { SiblingDeployer.perform(1) }.should raise_error(StandardError, "Foo")
18
+ end
19
+ end
20
+
21
+ describe "when an exception is raised" do
22
+ before do
23
+ @sibling_deployer = SiblingDeployer.new(1)
24
+ end
25
+
26
+ it "retries 0 times when Exception" do
27
+ @sibling_deploy.stub(:deploy).and_raise(Exception)
28
+ expect { @sibling_deployer.perform }.to raise_error(Exception)
29
+ expect(@sibling_deployer.retries).to eq 0
30
+ end
31
+
32
+ it "retries 3 times when GithubHerokuDeployer::CommandException" do
33
+ @sibling_deploy.stub(:deploy).and_raise(GithubHerokuDeployer::CommandException)
34
+ expect { @sibling_deployer.perform }.to raise_error(GithubHerokuDeployer::CommandException)
35
+ expect(@sibling_deployer.retries).to eq 3
36
+ end
37
+
38
+ it "retries 3 times when Heroku::API::Errors::ErrorWithResponse" do
39
+ pending "Not sure how to raise this error"
40
+ @sibling_deploy.stub(:deploy).and_raise(Heroku::API::Errors::ErrorWithResponse.new(nil, ))
41
+ expect { @sibling_deployer.perform }.to raise_error(Heroku::API::Errors::ErrorWithResponse)
42
+ expect(@sibling_deployer.retries).to eq 3
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,15 @@
1
+ require "spec_helper"
2
+
3
+ describe SiblingInstructionConsumer do
4
+ describe ".perform" do
5
+ it "consumes entry feed" do
6
+ Sibling::Instruction.stub(:consume_feed)
7
+ Sibling::Instruction.should_receive(:consume_feed).once
8
+ SiblingInstructionConsumer.perform
9
+ end
10
+ it "does not swallow errors" do
11
+ Sibling::Instruction.stub(:consume_feed).and_raise(StandardError.new("Foo"))
12
+ lambda { SiblingInstructionConsumer.perform }.should raise_error(StandardError, "Foo")
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,352 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: g5_sibling_deployer_engine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.6
5
+ platform: ruby
6
+ authors:
7
+ - Jessica Lynn Suttles
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.12
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.12
27
+ - !ruby/object:Gem::Dependency
28
+ name: table_cloth
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.2.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: state_machine
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 1.1.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.1.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: heroku_resque_autoscaler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.1.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 0.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: microformats2
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.0.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: github_heroku_deployer
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 0.2.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 0.2.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.3.6
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.3.6
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 0.7.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: 0.7.1
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec-rails
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: 2.12.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: 2.12.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: 2.1.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: 2.1.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: spork
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ~>
158
+ - !ruby/object:Gem::Version
159
+ version: 0.9.2
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ~>
165
+ - !ruby/object:Gem::Version
166
+ version: 0.9.2
167
+ - !ruby/object:Gem::Dependency
168
+ name: rb-fsevent
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: 0.9.2
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ~>
179
+ - !ruby/object:Gem::Version
180
+ version: 0.9.2
181
+ description: Rails Engine for G5 sibling deployers
182
+ email:
183
+ - jlsuttles@gmail.com
184
+ executables: []
185
+ extensions: []
186
+ extra_rdoc_files: []
187
+ files:
188
+ - .gitignore
189
+ - .rspec
190
+ - .travis.yml
191
+ - Gemfile
192
+ - Guardfile
193
+ - LICENSE.txt
194
+ - README.md
195
+ - Rakefile
196
+ - app/controllers/siblings/application_controller.rb
197
+ - app/controllers/siblings/deploys_controller.rb
198
+ - app/controllers/siblings/instructions_controller.rb
199
+ - app/controllers/siblings_controller.rb
200
+ - app/controllers/webhooks_controller.rb
201
+ - app/models/sibling.rb
202
+ - app/models/sibling/deploy.rb
203
+ - app/models/sibling/instruction.rb
204
+ - app/views/siblings/_nav.html.erb
205
+ - app/views/siblings/deploys/index.html.erb
206
+ - app/views/siblings/index.html.erb
207
+ - app/views/siblings/instructions/index.html.erb
208
+ - app/workers/sibling_consumer.rb
209
+ - app/workers/sibling_deployer.rb
210
+ - app/workers/sibling_instruction_consumer.rb
211
+ - config/initializers/github_heroku_deployer.rb
212
+ - config/initializers/resque.rb
213
+ - config/initializers/table_cloth.rb
214
+ - config/routes.rb
215
+ - db/migrate/001_create_siblings.rb
216
+ - db/migrate/002_create_sibling_deploys.rb
217
+ - db/migrate/003_create_sibling_instructions.rb
218
+ - g5_sibling_deployer_engine.gemspec
219
+ - lib/g5_sibling_deployer_engine.rb
220
+ - lib/g5_sibling_deployer_engine/engine.rb
221
+ - lib/g5_sibling_deployer_engine/version.rb
222
+ - lib/tasks/g5_sibling_deployer_engine_tasks.rake
223
+ - lib/tasks/resque.rake
224
+ - main_app_v2.html
225
+ - spec/controllers/siblings/deploys_controller_spec.rb
226
+ - spec/controllers/siblings/instructions_controller_spec.rb
227
+ - spec/controllers/siblings_controller_spec.rb
228
+ - spec/controllers/webhooks_controller_spec.rb
229
+ - spec/dummy/README.rdoc
230
+ - spec/dummy/Rakefile
231
+ - spec/dummy/app/assets/javascripts/application.js
232
+ - spec/dummy/app/assets/stylesheets/application.css
233
+ - spec/dummy/app/controllers/application_controller.rb
234
+ - spec/dummy/app/helpers/application_helper.rb
235
+ - spec/dummy/app/mailers/.gitkeep
236
+ - spec/dummy/app/models/.gitkeep
237
+ - spec/dummy/app/views/layouts/application.html.erb
238
+ - spec/dummy/config.ru
239
+ - spec/dummy/config/application.rb
240
+ - spec/dummy/config/boot.rb
241
+ - spec/dummy/config/database.yml
242
+ - spec/dummy/config/environment.rb
243
+ - spec/dummy/config/environments/development.rb
244
+ - spec/dummy/config/environments/production.rb
245
+ - spec/dummy/config/environments/test.rb
246
+ - spec/dummy/config/initializers/backtrace_silencers.rb
247
+ - spec/dummy/config/initializers/inflections.rb
248
+ - spec/dummy/config/initializers/mime_types.rb
249
+ - spec/dummy/config/initializers/secret_token.rb
250
+ - spec/dummy/config/initializers/session_store.rb
251
+ - spec/dummy/config/initializers/wrap_parameters.rb
252
+ - spec/dummy/config/locales/en.yml
253
+ - spec/dummy/config/routes.rb
254
+ - spec/dummy/db/development.sqlite3
255
+ - spec/dummy/db/schema.rb
256
+ - spec/dummy/db/test.sqlite3
257
+ - spec/dummy/lib/assets/.gitkeep
258
+ - spec/dummy/log/.gitkeep
259
+ - spec/dummy/public/404.html
260
+ - spec/dummy/public/422.html
261
+ - spec/dummy/public/500.html
262
+ - spec/dummy/public/favicon.ico
263
+ - spec/dummy/script/rails
264
+ - spec/lib/g5_sibling_deployer_engine_spec.rb
265
+ - spec/models/sibling/deploy_spec.rb
266
+ - spec/models/sibling/instruction_spec.rb
267
+ - spec/models/sibling_spec.rb
268
+ - spec/routing/routes_spec.rb
269
+ - spec/spec_helper.rb
270
+ - spec/support/g5-configurator-app.html
271
+ - spec/support/g5-configurator-entries.html
272
+ - spec/support/instructions.html
273
+ - spec/support/main_app.html
274
+ - spec/workers/sibling_consumer_spec.rb
275
+ - spec/workers/sibling_deployer_spec.rb
276
+ - spec/workers/sibling_instruction_consumer_spec.rb
277
+ homepage: https://github.com/G5/g5_sibling_deployer_engine
278
+ licenses: []
279
+ metadata: {}
280
+ post_install_message:
281
+ rdoc_options: []
282
+ require_paths:
283
+ - lib
284
+ required_ruby_version: !ruby/object:Gem::Requirement
285
+ requirements:
286
+ - - ! '>='
287
+ - !ruby/object:Gem::Version
288
+ version: '0'
289
+ required_rubygems_version: !ruby/object:Gem::Requirement
290
+ requirements:
291
+ - - ! '>='
292
+ - !ruby/object:Gem::Version
293
+ version: '0'
294
+ requirements: []
295
+ rubyforge_project:
296
+ rubygems_version: 2.0.6
297
+ signing_key:
298
+ specification_version: 4
299
+ summary: Rails Engine for G5 sibling deployers
300
+ test_files:
301
+ - spec/controllers/siblings/deploys_controller_spec.rb
302
+ - spec/controllers/siblings/instructions_controller_spec.rb
303
+ - spec/controllers/siblings_controller_spec.rb
304
+ - spec/controllers/webhooks_controller_spec.rb
305
+ - spec/dummy/README.rdoc
306
+ - spec/dummy/Rakefile
307
+ - spec/dummy/app/assets/javascripts/application.js
308
+ - spec/dummy/app/assets/stylesheets/application.css
309
+ - spec/dummy/app/controllers/application_controller.rb
310
+ - spec/dummy/app/helpers/application_helper.rb
311
+ - spec/dummy/app/mailers/.gitkeep
312
+ - spec/dummy/app/models/.gitkeep
313
+ - spec/dummy/app/views/layouts/application.html.erb
314
+ - spec/dummy/config.ru
315
+ - spec/dummy/config/application.rb
316
+ - spec/dummy/config/boot.rb
317
+ - spec/dummy/config/database.yml
318
+ - spec/dummy/config/environment.rb
319
+ - spec/dummy/config/environments/development.rb
320
+ - spec/dummy/config/environments/production.rb
321
+ - spec/dummy/config/environments/test.rb
322
+ - spec/dummy/config/initializers/backtrace_silencers.rb
323
+ - spec/dummy/config/initializers/inflections.rb
324
+ - spec/dummy/config/initializers/mime_types.rb
325
+ - spec/dummy/config/initializers/secret_token.rb
326
+ - spec/dummy/config/initializers/session_store.rb
327
+ - spec/dummy/config/initializers/wrap_parameters.rb
328
+ - spec/dummy/config/locales/en.yml
329
+ - spec/dummy/config/routes.rb
330
+ - spec/dummy/db/development.sqlite3
331
+ - spec/dummy/db/schema.rb
332
+ - spec/dummy/db/test.sqlite3
333
+ - spec/dummy/lib/assets/.gitkeep
334
+ - spec/dummy/log/.gitkeep
335
+ - spec/dummy/public/404.html
336
+ - spec/dummy/public/422.html
337
+ - spec/dummy/public/500.html
338
+ - spec/dummy/public/favicon.ico
339
+ - spec/dummy/script/rails
340
+ - spec/lib/g5_sibling_deployer_engine_spec.rb
341
+ - spec/models/sibling/deploy_spec.rb
342
+ - spec/models/sibling/instruction_spec.rb
343
+ - spec/models/sibling_spec.rb
344
+ - spec/routing/routes_spec.rb
345
+ - spec/spec_helper.rb
346
+ - spec/support/g5-configurator-app.html
347
+ - spec/support/g5-configurator-entries.html
348
+ - spec/support/instructions.html
349
+ - spec/support/main_app.html
350
+ - spec/workers/sibling_consumer_spec.rb
351
+ - spec/workers/sibling_deployer_spec.rb
352
+ - spec/workers/sibling_instruction_consumer_spec.rb