stackfu 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/CHANGELOG +24 -0
  2. data/Manifest +118 -0
  3. data/README +0 -0
  4. data/README.md +218 -0
  5. data/Rakefile +73 -0
  6. data/bin/stackfu +10 -0
  7. data/lib/stackfu/api_hooks.rb +17 -0
  8. data/lib/stackfu/app.rb +69 -0
  9. data/lib/stackfu/commands/command.rb +127 -0
  10. data/lib/stackfu/commands/config_command.rb +43 -0
  11. data/lib/stackfu/commands/deploy_command.rb +144 -0
  12. data/lib/stackfu/commands/dump_command.rb +101 -0
  13. data/lib/stackfu/commands/generate_command.rb +107 -0
  14. data/lib/stackfu/commands/help_command.rb +28 -0
  15. data/lib/stackfu/commands/list_command.rb +26 -0
  16. data/lib/stackfu/commands/publish_command.rb +108 -0
  17. data/lib/stackfu/commands/server_command.rb +124 -0
  18. data/lib/stackfu/helpers/providers_credentials.rb +82 -0
  19. data/lib/stackfu/helpers/rendering.rb +201 -0
  20. data/lib/stackfu/operating_systems.rb +30 -0
  21. data/lib/stackfu.rb +88 -0
  22. data/stackfu-installer/config/01-controls.yml +17 -0
  23. data/stackfu-installer/config/02-requirements.yml +3 -0
  24. data/stackfu-installer/config/03-scripts.yml +16 -0
  25. data/stackfu-installer/config/04-validations.yml +3 -0
  26. data/stackfu-installer/script/dotfiles_installation.sh.erb +22 -0
  27. data/stackfu-installer/script/github_credentials_setup.sh.erb +31 -0
  28. data/stackfu-installer/script/nginx_and_passenger.sh.erb +83 -0
  29. data/stackfu-installer/script/redis_installation.sh.erb +33 -0
  30. data/stackfu-installer/script/resque_installation.sh.erb +7 -0
  31. data/stackfu-installer/script/ruby_environment.sh.erb +20 -0
  32. data/stackfu-installer/script/stackfu.sh.erb +114 -0
  33. data/stackfu-installer/stack.yml +5 -0
  34. data/stackfu.gemspec +60 -0
  35. data/templates/01-controls.yml.erb +31 -0
  36. data/templates/02-requirements.yml.erb +26 -0
  37. data/templates/03-scripts.yml.erb +34 -0
  38. data/templates/04-validations.yml.erb +17 -0
  39. data/templates/script.sh.erb +7 -0
  40. data/templates/stack.yml.erb +17 -0
  41. data/test/fixtures/add_server_error +7 -0
  42. data/test/fixtures/deployment_add +7 -0
  43. data/test/fixtures/deployment_add_error +8 -0
  44. data/test/fixtures/deployments +7 -0
  45. data/test/fixtures/logs +7 -0
  46. data/test/fixtures/logs_partial +7 -0
  47. data/test/fixtures/plugin_add +6 -0
  48. data/test/fixtures/plugin_add_error +8 -0
  49. data/test/fixtures/plugin_deployment_add +7 -0
  50. data/test/fixtures/plugin_not_found +7 -0
  51. data/test/fixtures/plugin_unauthorized +8 -0
  52. data/test/fixtures/plugins +7 -0
  53. data/test/fixtures/plugins_by_name +7 -0
  54. data/test/fixtures/plugins_by_name_other +7 -0
  55. data/test/fixtures/plugins_empty +7 -0
  56. data/test/fixtures/plugins_multiple +7 -0
  57. data/test/fixtures/providers +7 -0
  58. data/test/fixtures/providers_servers +7 -0
  59. data/test/fixtures/server_add +6 -0
  60. data/test/fixtures/server_add_dupe +7 -0
  61. data/test/fixtures/server_add_error +7 -0
  62. data/test/fixtures/server_delete +7 -0
  63. data/test/fixtures/server_delete_error +7 -0
  64. data/test/fixtures/servers +7 -0
  65. data/test/fixtures/servers_by_name +7 -0
  66. data/test/fixtures/servers_empty +8 -0
  67. data/test/fixtures/servers_not_found +26 -0
  68. data/test/fixtures/servers_unauthorized +8 -0
  69. data/test/fixtures/servers_webbynode +7 -0
  70. data/test/fixtures/stack/stackfu-installer/config/01-controls.yml +22 -0
  71. data/test/fixtures/stack/stackfu-installer/config/02-requirements.yml +1 -0
  72. data/test/fixtures/stack/stackfu-installer/config/03-scripts.yml +23 -0
  73. data/test/fixtures/stack/stackfu-installer/config/04-validations.yml +1 -0
  74. data/test/fixtures/stack/stackfu-installer/script/dotfiles_installation.sh.erb +22 -0
  75. data/test/fixtures/stack/stackfu-installer/script/github_credentials_setup.sh.erb +31 -0
  76. data/test/fixtures/stack/stackfu-installer/script/nginx_and_passenger.sh.erb +83 -0
  77. data/test/fixtures/stack/stackfu-installer/script/redis_installation.sh.erb +33 -0
  78. data/test/fixtures/stack/stackfu-installer/script/resque_installation.sh.erb +7 -0
  79. data/test/fixtures/stack/stackfu-installer/script/ruby_environment.sh.erb +20 -0
  80. data/test/fixtures/stack/stackfu-installer/script/stackfu.sh.erb +76 -0
  81. data/test/fixtures/stack/stackfu-installer/stack.yml +5 -0
  82. data/test/fixtures/stack_add +6 -0
  83. data/test/fixtures/stack_add_error +8 -0
  84. data/test/fixtures/stack_add_error_dupe +8 -0
  85. data/test/fixtures/stack_adds_by_name +7 -0
  86. data/test/fixtures/stack_delete_not_found +7 -0
  87. data/test/fixtures/stacks +7 -0
  88. data/test/fixtures/stacks_by_name +7 -0
  89. data/test/fixtures/stacks_by_name_other +7 -0
  90. data/test/fixtures/stacks_empty +7 -0
  91. data/test/fixtures/stacks_multiple +7 -0
  92. data/test/fixtures/stacks_not_found +7 -0
  93. data/test/fixtures/stacks_realworld +7 -0
  94. data/test/fixtures/stacks_stackfu-installer +7 -0
  95. data/test/fixtures/stacks_unauthorized +8 -0
  96. data/test/fixtures/stacks_with_controls +0 -0
  97. data/test/fixtures/users +7 -0
  98. data/test/fixtures/users_no_credentials +7 -0
  99. data/test/fixtures/users_update +6 -0
  100. data/test/stack.yml +26 -0
  101. data/test/support/custom_matchers.rb +69 -0
  102. data/test/support/fixtures.rb +98 -0
  103. data/test/support/io_stub.rb +10 -0
  104. data/test/support/web_fixtures.rb +91 -0
  105. data/test/test_helper.rb +186 -0
  106. data/test/unit/commands/test_command.rb +112 -0
  107. data/test/unit/commands/test_config_command.rb +92 -0
  108. data/test/unit/commands/test_deploy_command.rb +303 -0
  109. data/test/unit/commands/test_dump_command.rb +155 -0
  110. data/test/unit/commands/test_generate_command.rb +112 -0
  111. data/test/unit/commands/test_help_command.rb +33 -0
  112. data/test/unit/commands/test_list_command.rb +63 -0
  113. data/test/unit/commands/test_publish_command.rb +265 -0
  114. data/test/unit/commands/test_server_command.rb +259 -0
  115. data/test/unit/helpers/test_rendering.rb +141 -0
  116. data/test/unit/test_array.rb +26 -0
  117. data/test/unit/test_provider.rb +14 -0
  118. data/test/unit/test_stackfu.rb +27 -0
  119. metadata +311 -0
@@ -0,0 +1,14 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ class TestProvider < Test::Unit::TestCase
4
+ include StackFu::ApiHooks
5
+
6
+ should "provide a list with provider names and codes" do
7
+ with_providers
8
+
9
+ providers = Provider.find(:all)
10
+ providers.select { |p| p.id == "webbynode" }.size.should == 1
11
+ providers.select { |p| p.id == "slicehost" }.size.should == 1
12
+ providers.select { |p| p.id == "linode" }.size.should == 1
13
+ end
14
+ end
@@ -0,0 +1,27 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ class TestStackfu < Test::Unit::TestCase
4
+ context "starting the app" do
5
+ should "show a user friendly error when cannot connect" do
6
+ Command.expects(:create).raises(Errno::ECONNREFUSED)
7
+ command "list"
8
+ stdout.should =~ /Could not connect to StackFu server./
9
+ stdout.should_not =~ /Connection refused/
10
+ end
11
+
12
+ should "provide walk through if first run" do
13
+ when_asked "StackFu Login: ", :answer => "flipper"
14
+ when_asked "StackFu Token: ", :answer => "abc123"
15
+ agree_with "Is this information correct? "
16
+
17
+ command nil, false
18
+ stdout.should =~ /StackFu Initial Configuration/
19
+ end
20
+
21
+ should "provide help if not first run" do
22
+ command nil, true
23
+ stdout.should =~ /StackFu #{StackFu::VERSION}/
24
+ $config.should == { :login => "flipper", :token => "abc123" }
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,311 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stackfu
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Felipe Coury
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-27 00:00:00 -03:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: activeresource
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 11
30
+ segments:
31
+ - 2
32
+ - 3
33
+ - 4
34
+ version: 2.3.4
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: activesupport
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 11
46
+ segments:
47
+ - 2
48
+ - 3
49
+ - 4
50
+ version: 2.3.4
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: rainbow
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 31
62
+ segments:
63
+ - 1
64
+ - 0
65
+ - 4
66
+ version: 1.0.4
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: highline
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 1
78
+ segments:
79
+ - 1
80
+ - 5
81
+ - 1
82
+ version: 1.5.1
83
+ type: :runtime
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ name: httparty
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 5
94
+ segments:
95
+ - 0
96
+ - 4
97
+ - 5
98
+ version: 0.4.5
99
+ type: :runtime
100
+ version_requirements: *id005
101
+ description: StackFu Backend
102
+ email: felipe@stackfu.com
103
+ executables:
104
+ - stackfu
105
+ extensions: []
106
+
107
+ extra_rdoc_files:
108
+ - CHANGELOG
109
+ - README
110
+ - README.md
111
+ - bin/stackfu
112
+ - lib/stackfu.rb
113
+ - lib/stackfu/api_hooks.rb
114
+ - lib/stackfu/app.rb
115
+ - lib/stackfu/commands/command.rb
116
+ - lib/stackfu/commands/config_command.rb
117
+ - lib/stackfu/commands/deploy_command.rb
118
+ - lib/stackfu/commands/dump_command.rb
119
+ - lib/stackfu/commands/generate_command.rb
120
+ - lib/stackfu/commands/help_command.rb
121
+ - lib/stackfu/commands/list_command.rb
122
+ - lib/stackfu/commands/publish_command.rb
123
+ - lib/stackfu/commands/server_command.rb
124
+ - lib/stackfu/helpers/providers_credentials.rb
125
+ - lib/stackfu/helpers/rendering.rb
126
+ - lib/stackfu/operating_systems.rb
127
+ files:
128
+ - CHANGELOG
129
+ - Manifest
130
+ - README
131
+ - README.md
132
+ - Rakefile
133
+ - bin/stackfu
134
+ - lib/stackfu.rb
135
+ - lib/stackfu/api_hooks.rb
136
+ - lib/stackfu/app.rb
137
+ - lib/stackfu/commands/command.rb
138
+ - lib/stackfu/commands/config_command.rb
139
+ - lib/stackfu/commands/deploy_command.rb
140
+ - lib/stackfu/commands/dump_command.rb
141
+ - lib/stackfu/commands/generate_command.rb
142
+ - lib/stackfu/commands/help_command.rb
143
+ - lib/stackfu/commands/list_command.rb
144
+ - lib/stackfu/commands/publish_command.rb
145
+ - lib/stackfu/commands/server_command.rb
146
+ - lib/stackfu/helpers/providers_credentials.rb
147
+ - lib/stackfu/helpers/rendering.rb
148
+ - lib/stackfu/operating_systems.rb
149
+ - stackfu-installer/config/01-controls.yml
150
+ - stackfu-installer/config/02-requirements.yml
151
+ - stackfu-installer/config/03-scripts.yml
152
+ - stackfu-installer/config/04-validations.yml
153
+ - stackfu-installer/script/dotfiles_installation.sh.erb
154
+ - stackfu-installer/script/github_credentials_setup.sh.erb
155
+ - stackfu-installer/script/nginx_and_passenger.sh.erb
156
+ - stackfu-installer/script/redis_installation.sh.erb
157
+ - stackfu-installer/script/resque_installation.sh.erb
158
+ - stackfu-installer/script/ruby_environment.sh.erb
159
+ - stackfu-installer/script/stackfu.sh.erb
160
+ - stackfu-installer/stack.yml
161
+ - stackfu.gemspec
162
+ - templates/01-controls.yml.erb
163
+ - templates/02-requirements.yml.erb
164
+ - templates/03-scripts.yml.erb
165
+ - templates/04-validations.yml.erb
166
+ - templates/script.sh.erb
167
+ - templates/stack.yml.erb
168
+ - test/fixtures/add_server_error
169
+ - test/fixtures/deployment_add
170
+ - test/fixtures/deployment_add_error
171
+ - test/fixtures/deployments
172
+ - test/fixtures/logs
173
+ - test/fixtures/logs_partial
174
+ - test/fixtures/plugin_add
175
+ - test/fixtures/plugin_add_error
176
+ - test/fixtures/plugin_deployment_add
177
+ - test/fixtures/plugin_not_found
178
+ - test/fixtures/plugin_unauthorized
179
+ - test/fixtures/plugins
180
+ - test/fixtures/plugins_by_name
181
+ - test/fixtures/plugins_by_name_other
182
+ - test/fixtures/plugins_empty
183
+ - test/fixtures/plugins_multiple
184
+ - test/fixtures/providers
185
+ - test/fixtures/providers_servers
186
+ - test/fixtures/server_add
187
+ - test/fixtures/server_add_dupe
188
+ - test/fixtures/server_add_error
189
+ - test/fixtures/server_delete
190
+ - test/fixtures/server_delete_error
191
+ - test/fixtures/servers
192
+ - test/fixtures/servers_by_name
193
+ - test/fixtures/servers_empty
194
+ - test/fixtures/servers_not_found
195
+ - test/fixtures/servers_unauthorized
196
+ - test/fixtures/servers_webbynode
197
+ - test/fixtures/stack/stackfu-installer/config/01-controls.yml
198
+ - test/fixtures/stack/stackfu-installer/config/02-requirements.yml
199
+ - test/fixtures/stack/stackfu-installer/config/03-scripts.yml
200
+ - test/fixtures/stack/stackfu-installer/config/04-validations.yml
201
+ - test/fixtures/stack/stackfu-installer/script/dotfiles_installation.sh.erb
202
+ - test/fixtures/stack/stackfu-installer/script/github_credentials_setup.sh.erb
203
+ - test/fixtures/stack/stackfu-installer/script/nginx_and_passenger.sh.erb
204
+ - test/fixtures/stack/stackfu-installer/script/redis_installation.sh.erb
205
+ - test/fixtures/stack/stackfu-installer/script/resque_installation.sh.erb
206
+ - test/fixtures/stack/stackfu-installer/script/ruby_environment.sh.erb
207
+ - test/fixtures/stack/stackfu-installer/script/stackfu.sh.erb
208
+ - test/fixtures/stack/stackfu-installer/stack.yml
209
+ - test/fixtures/stack_add
210
+ - test/fixtures/stack_add_error
211
+ - test/fixtures/stack_add_error_dupe
212
+ - test/fixtures/stack_adds_by_name
213
+ - test/fixtures/stack_delete_not_found
214
+ - test/fixtures/stacks
215
+ - test/fixtures/stacks_by_name
216
+ - test/fixtures/stacks_by_name_other
217
+ - test/fixtures/stacks_empty
218
+ - test/fixtures/stacks_multiple
219
+ - test/fixtures/stacks_not_found
220
+ - test/fixtures/stacks_realworld
221
+ - test/fixtures/stacks_stackfu-installer
222
+ - test/fixtures/stacks_unauthorized
223
+ - test/fixtures/stacks_with_controls
224
+ - test/fixtures/users
225
+ - test/fixtures/users_no_credentials
226
+ - test/fixtures/users_update
227
+ - test/stack.yml
228
+ - test/support/custom_matchers.rb
229
+ - test/support/fixtures.rb
230
+ - test/support/io_stub.rb
231
+ - test/support/web_fixtures.rb
232
+ - test/test_helper.rb
233
+ - test/unit/commands/test_command.rb
234
+ - test/unit/commands/test_config_command.rb
235
+ - test/unit/commands/test_deploy_command.rb
236
+ - test/unit/commands/test_dump_command.rb
237
+ - test/unit/commands/test_generate_command.rb
238
+ - test/unit/commands/test_help_command.rb
239
+ - test/unit/commands/test_list_command.rb
240
+ - test/unit/commands/test_publish_command.rb
241
+ - test/unit/commands/test_server_command.rb
242
+ - test/unit/helpers/test_rendering.rb
243
+ - test/unit/test_array.rb
244
+ - test/unit/test_provider.rb
245
+ - test/unit/test_stackfu.rb
246
+ has_rdoc: true
247
+ homepage: http://stackfu.com/cli
248
+ licenses: []
249
+
250
+ post_install_message: |+
251
+
252
+ --==-- StackFu - Server Deployment Engine --==--
253
+
254
+ To get started:
255
+ stackfu
256
+
257
+ To get more help:
258
+ stackfu help
259
+
260
+ And now: Deploy it, grasshopper!
261
+
262
+ rdoc_options:
263
+ - --line-numbers
264
+ - --inline-source
265
+ - --title
266
+ - Stackfu
267
+ - --main
268
+ - README
269
+ require_paths:
270
+ - lib
271
+ required_ruby_version: !ruby/object:Gem::Requirement
272
+ none: false
273
+ requirements:
274
+ - - ">="
275
+ - !ruby/object:Gem::Version
276
+ hash: 3
277
+ segments:
278
+ - 0
279
+ version: "0"
280
+ required_rubygems_version: !ruby/object:Gem::Requirement
281
+ none: false
282
+ requirements:
283
+ - - ">="
284
+ - !ruby/object:Gem::Version
285
+ hash: 11
286
+ segments:
287
+ - 1
288
+ - 2
289
+ version: "1.2"
290
+ requirements: []
291
+
292
+ rubyforge_project: stackfu
293
+ rubygems_version: 1.3.7
294
+ signing_key:
295
+ specification_version: 3
296
+ summary: StackFu Backend
297
+ test_files:
298
+ - test/test_helper.rb
299
+ - test/unit/commands/test_command.rb
300
+ - test/unit/commands/test_config_command.rb
301
+ - test/unit/commands/test_deploy_command.rb
302
+ - test/unit/commands/test_dump_command.rb
303
+ - test/unit/commands/test_generate_command.rb
304
+ - test/unit/commands/test_help_command.rb
305
+ - test/unit/commands/test_list_command.rb
306
+ - test/unit/commands/test_publish_command.rb
307
+ - test/unit/commands/test_server_command.rb
308
+ - test/unit/helpers/test_rendering.rb
309
+ - test/unit/test_array.rb
310
+ - test/unit/test_provider.rb
311
+ - test/unit/test_stackfu.rb