jellyfish_fog_aws 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.travis.yml +11 -0
  4. data/Gemfile +14 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +1 -0
  7. data/Rakefile +11 -0
  8. data/bin/rails +12 -0
  9. data/config/initializers/fog.rb +3 -0
  10. data/config/initializers/product_types.rb +6 -0
  11. data/config/initializers/provisioners.rb +8 -0
  12. data/config/product_questions/database.json +53 -0
  13. data/config/product_questions/infrastructure.json +23 -0
  14. data/config/product_questions/storage.json +31 -0
  15. data/config/provisioners.json +5 -0
  16. data/db/migrate/20150309142220_create_jellyfish_fog_aws_database_products.rb +12 -0
  17. data/db/migrate/20150309181621_create_jellyfish_fog_aws_infrastructure_products.rb +9 -0
  18. data/db/migrate/20150309192000_create_jellyfish_fog_aws_storage_products.rb +9 -0
  19. data/doc/aws_database.json +52 -0
  20. data/doc/aws_infrastructure.json +22 -0
  21. data/doc/aws_storage.json +30 -0
  22. data/jellyfish_fog_aws.gemspec +29 -0
  23. data/lib/jellyfish_fog_aws.rb +13 -0
  24. data/lib/jellyfish_fog_aws/databases.rb +56 -0
  25. data/lib/jellyfish_fog_aws/engine.rb +9 -0
  26. data/lib/jellyfish_fog_aws/infrastructure.rb +47 -0
  27. data/lib/jellyfish_fog_aws/storage.rb +40 -0
  28. data/lib/jellyfish_fog_aws/version.rb +7 -0
  29. data/spec/dummy/README.rdoc +28 -0
  30. data/spec/dummy/Rakefile +6 -0
  31. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  32. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  33. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  34. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  35. data/spec/dummy/app/models/provisioner.rb +9 -0
  36. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  37. data/spec/dummy/bin/bundle +3 -0
  38. data/spec/dummy/bin/rails +4 -0
  39. data/spec/dummy/bin/rake +4 -0
  40. data/spec/dummy/config.ru +4 -0
  41. data/spec/dummy/config/application.rb +30 -0
  42. data/spec/dummy/config/boot.rb +5 -0
  43. data/spec/dummy/config/database.yml +5 -0
  44. data/spec/dummy/config/environment.rb +5 -0
  45. data/spec/dummy/config/environments/development.rb +37 -0
  46. data/spec/dummy/config/environments/production.rb +78 -0
  47. data/spec/dummy/config/environments/test.rb +39 -0
  48. data/spec/dummy/config/initializers/assets.rb +8 -0
  49. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  50. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  51. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  52. data/spec/dummy/config/initializers/inflections.rb +16 -0
  53. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  54. data/spec/dummy/config/initializers/session_store.rb +3 -0
  55. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  56. data/spec/dummy/config/locales/en.yml +23 -0
  57. data/spec/dummy/config/routes.rb +56 -0
  58. data/spec/dummy/config/secrets.yml +22 -0
  59. data/spec/dummy/db/migrate/20150406223805_create_jellyfish_fog_aws_database_products.jellyfish_fog_aws.rb +13 -0
  60. data/spec/dummy/db/migrate/20150406223806_create_jellyfish_fog_aws_infrastructure_products.jellyfish_fog_aws.rb +10 -0
  61. data/spec/dummy/db/migrate/20150406223807_create_jellyfish_fog_aws_storage_products.jellyfish_fog_aws.rb +10 -0
  62. data/spec/dummy/db/schema.rb +43 -0
  63. data/spec/dummy/db/test.sqlite3 +0 -0
  64. data/spec/dummy/public/404.html +67 -0
  65. data/spec/dummy/public/422.html +67 -0
  66. data/spec/dummy/public/500.html +66 -0
  67. data/spec/dummy/public/favicon.ico +0 -0
  68. data/spec/jellyfish_fog_aws_spec.rb +13 -0
  69. data/spec/lib/jellyfish_fog_aws/databases_spec.rb +46 -0
  70. data/spec/lib/jellyfish_fog_aws/infrastructure_spec.rb +35 -0
  71. data/spec/lib/jellyfish_fog_aws/storage_spec.rb +36 -0
  72. data/spec/spec_helper.rb +25 -0
  73. metadata +255 -0
File without changes
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ module Jellyfish
4
+ module Fog
5
+ module AWS
6
+ describe 'Registering product types' do
7
+ it 'registers all product types' do
8
+ expect(Dummy::Application.config.x.product_types).to have_key('AWS Fog Databases')
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ module Jellyfish
4
+ module Fog
5
+ module AWS
6
+ describe Databases do
7
+ it 'provisions and retires databases using fog' do
8
+ enable_aws_fog_provisioning
9
+
10
+ Databases.new(order_item).provision
11
+
12
+ expect(order_item.provision_status).to eq 'ok'
13
+ order_item.payload_response = JSON.parse(order_item.payload_response)
14
+ expect(
15
+ order_item.payload_response['data']['body']['CreateDBInstanceResult']['DBInstance']
16
+ ).to include(
17
+ order_item.answers.merge('DBInstanceIdentifier' => "id-#{order_item.uuid}")
18
+ )
19
+
20
+ Databases.new(order_item).retire
21
+
22
+ expect(order_item.provision_status).to eq 'retired'
23
+ end
24
+
25
+
26
+ def order_item
27
+ @order_item ||= OpenStruct.new.tap do |order_item|
28
+ order_item.uuid = '1234567890'
29
+ order_item.answers = {
30
+ 'AllocatedStorage' => 100,
31
+ 'DBInstanceClass' => 'Test',
32
+ 'Engine' => 'Test'
33
+ }
34
+ end
35
+ end
36
+
37
+ def enable_aws_fog_provisioning
38
+ ::Fog.mock!
39
+ allow_any_instance_of(::Provisioner).to receive(:aws_settings).and_return(
40
+ access_key: 'text', secret_key: 'text'
41
+ )
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ module Jellyfish
4
+ module Fog
5
+ module AWS
6
+ describe Infrastructure do
7
+ it 'provisions and retires infrastructure using fog' do
8
+ enable_aws_fog_provisioning
9
+
10
+ Infrastructure.new(order_item).provision
11
+
12
+ expect(order_item.provision_status).to eq 'ok'
13
+ order_item.payload_response = JSON.parse(order_item.payload_response)
14
+ expect(order_item.payload_response).to have_key('id')
15
+ expect(order_item.payload_response['image_id']).to eq('ami-acca47c4')
16
+
17
+ Infrastructure.new(order_item).retire
18
+
19
+ expect(order_item.provision_status).to eq 'retired'
20
+ end
21
+
22
+ def order_item
23
+ @order_item ||= OpenStruct.new
24
+ end
25
+
26
+ def enable_aws_fog_provisioning
27
+ ::Fog.mock!
28
+ allow_any_instance_of(::Provisioner).to receive(:aws_settings).and_return(
29
+ access_key: 'text', secret_key: 'text'
30
+ )
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ module Jellyfish
4
+ module Fog
5
+ module AWS
6
+ describe Storage do
7
+ it 'provisions and retires storage using fog' do
8
+ enable_aws_fog_provisioning
9
+
10
+ Storage.new(order_item).provision
11
+
12
+ expect(order_item.provision_status).to eq 'ok'
13
+ order_item.payload_response = JSON.parse(order_item.payload_response)
14
+ expect(order_item.payload_response).to include('key' => "id-#{order_item.uuid}")
15
+
16
+ Storage.new(order_item).retire
17
+
18
+ expect(order_item.provision_status).to eq 'retired'
19
+ end
20
+
21
+ def order_item
22
+ @order_item ||= OpenStruct.new.tap do |order_item|
23
+ order_item.uuid = '1234567890'
24
+ end
25
+ end
26
+
27
+ def enable_aws_fog_provisioning
28
+ ::Fog.mock!
29
+ allow_any_instance_of(::Provisioner).to receive(:aws_settings).and_return(
30
+ access_key: 'access key id', secret_key: 'secret access key'
31
+ )
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,25 @@
1
+ ENV['RAILS_ENV'] = 'test'
2
+ require 'dummy/config/environment'
3
+ require 'rspec/rails'
4
+ require 'shoulda/matchers'
5
+ require 'factory_girl'
6
+ require 'database_cleaner'
7
+ require 'bcrypt'
8
+ require 'jellyfish_fog_aws'
9
+ require 'pry'
10
+
11
+ Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
12
+
13
+ RSpec.configure do |config|
14
+ config.expect_with :rspec do |expectations|
15
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
16
+ end
17
+
18
+ config.mock_with :rspec do |mocks|
19
+ mocks.verify_partial_doubles = true
20
+ end
21
+
22
+ config.order = :random
23
+ config.use_transactional_fixtures = false
24
+ config.infer_spec_type_from_file_location!
25
+ end
metadata ADDED
@@ -0,0 +1,255 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jellyfish_fog_aws
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Caleb Thompson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-07 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fog
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bcrypt
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sqlite3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: shoulda-matchers
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: factory_girl_rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: database_cleaner
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-rails
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: custom_configuration
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Manage AWS products through Fog on Jellyfish Core API
154
+ email:
155
+ - caleb@calebthompson.io
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".gitignore"
161
+ - ".travis.yml"
162
+ - Gemfile
163
+ - MIT-LICENSE
164
+ - README.md
165
+ - Rakefile
166
+ - bin/rails
167
+ - config/initializers/fog.rb
168
+ - config/initializers/product_types.rb
169
+ - config/initializers/provisioners.rb
170
+ - config/product_questions/database.json
171
+ - config/product_questions/infrastructure.json
172
+ - config/product_questions/storage.json
173
+ - config/provisioners.json
174
+ - db/migrate/20150309142220_create_jellyfish_fog_aws_database_products.rb
175
+ - db/migrate/20150309181621_create_jellyfish_fog_aws_infrastructure_products.rb
176
+ - db/migrate/20150309192000_create_jellyfish_fog_aws_storage_products.rb
177
+ - doc/aws_database.json
178
+ - doc/aws_infrastructure.json
179
+ - doc/aws_storage.json
180
+ - jellyfish_fog_aws.gemspec
181
+ - lib/jellyfish_fog_aws.rb
182
+ - lib/jellyfish_fog_aws/databases.rb
183
+ - lib/jellyfish_fog_aws/engine.rb
184
+ - lib/jellyfish_fog_aws/infrastructure.rb
185
+ - lib/jellyfish_fog_aws/storage.rb
186
+ - lib/jellyfish_fog_aws/version.rb
187
+ - spec/dummy/README.rdoc
188
+ - spec/dummy/Rakefile
189
+ - spec/dummy/app/assets/javascripts/application.js
190
+ - spec/dummy/app/assets/stylesheets/application.css
191
+ - spec/dummy/app/controllers/application_controller.rb
192
+ - spec/dummy/app/helpers/application_helper.rb
193
+ - spec/dummy/app/models/provisioner.rb
194
+ - spec/dummy/app/views/layouts/application.html.erb
195
+ - spec/dummy/bin/bundle
196
+ - spec/dummy/bin/rails
197
+ - spec/dummy/bin/rake
198
+ - spec/dummy/config.ru
199
+ - spec/dummy/config/application.rb
200
+ - spec/dummy/config/boot.rb
201
+ - spec/dummy/config/database.yml
202
+ - spec/dummy/config/environment.rb
203
+ - spec/dummy/config/environments/development.rb
204
+ - spec/dummy/config/environments/production.rb
205
+ - spec/dummy/config/environments/test.rb
206
+ - spec/dummy/config/initializers/assets.rb
207
+ - spec/dummy/config/initializers/backtrace_silencers.rb
208
+ - spec/dummy/config/initializers/cookies_serializer.rb
209
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
210
+ - spec/dummy/config/initializers/inflections.rb
211
+ - spec/dummy/config/initializers/mime_types.rb
212
+ - spec/dummy/config/initializers/session_store.rb
213
+ - spec/dummy/config/initializers/wrap_parameters.rb
214
+ - spec/dummy/config/locales/en.yml
215
+ - spec/dummy/config/routes.rb
216
+ - spec/dummy/config/secrets.yml
217
+ - spec/dummy/db/migrate/20150406223805_create_jellyfish_fog_aws_database_products.jellyfish_fog_aws.rb
218
+ - spec/dummy/db/migrate/20150406223806_create_jellyfish_fog_aws_infrastructure_products.jellyfish_fog_aws.rb
219
+ - spec/dummy/db/migrate/20150406223807_create_jellyfish_fog_aws_storage_products.jellyfish_fog_aws.rb
220
+ - spec/dummy/db/schema.rb
221
+ - spec/dummy/db/test.sqlite3
222
+ - spec/dummy/public/404.html
223
+ - spec/dummy/public/422.html
224
+ - spec/dummy/public/500.html
225
+ - spec/dummy/public/favicon.ico
226
+ - spec/jellyfish_fog_aws_spec.rb
227
+ - spec/lib/jellyfish_fog_aws/databases_spec.rb
228
+ - spec/lib/jellyfish_fog_aws/infrastructure_spec.rb
229
+ - spec/lib/jellyfish_fog_aws/storage_spec.rb
230
+ - spec/spec_helper.rb
231
+ homepage: https://github.com/projectjellyfish/api
232
+ licenses:
233
+ - MIT
234
+ metadata: {}
235
+ post_install_message:
236
+ rdoc_options: []
237
+ require_paths:
238
+ - lib
239
+ required_ruby_version: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ required_rubygems_version: !ruby/object:Gem::Requirement
245
+ requirements:
246
+ - - ">="
247
+ - !ruby/object:Gem::Version
248
+ version: '0'
249
+ requirements: []
250
+ rubyforge_project:
251
+ rubygems_version: 2.4.6
252
+ signing_key:
253
+ specification_version: 4
254
+ summary: Fog AWS module for Jellyfish Core
255
+ test_files: []