bebox 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -8
  3. data/README.md +33 -30
  4. data/bebox.gemspec +1 -2
  5. data/bin/bebox +1 -2
  6. data/lib/bebox/cli.rb +0 -5
  7. data/lib/bebox/commands/commands_helper.rb +3 -1
  8. data/lib/bebox/commands/environment_commands.rb +26 -29
  9. data/lib/bebox/commands/general_commands.rb +0 -1
  10. data/lib/bebox/commands/node_commands.rb +44 -48
  11. data/lib/bebox/commands/prepare_commands.rb +25 -32
  12. data/lib/bebox/commands/profile_commands.rb +56 -0
  13. data/lib/bebox/commands/project_commands.rb +23 -29
  14. data/lib/bebox/commands/provision_commands.rb +18 -120
  15. data/lib/bebox/commands/role_commands.rb +83 -0
  16. data/lib/bebox/environment.rb +4 -10
  17. data/lib/bebox/files_helper.rb +37 -0
  18. data/lib/bebox/logger.rb +0 -1
  19. data/lib/bebox/node.rb +9 -122
  20. data/lib/bebox/profile.rb +5 -16
  21. data/lib/bebox/project.rb +14 -38
  22. data/lib/bebox/provision.rb +21 -36
  23. data/lib/bebox/role.rb +2 -12
  24. data/lib/bebox/vagrant_helper.rb +96 -0
  25. data/lib/bebox/version.rb +1 -1
  26. data/lib/bebox/wizards/environment_wizard.rb +4 -20
  27. data/lib/bebox/wizards/node_wizard.rb +17 -47
  28. data/lib/bebox/wizards/profile_wizard.rb +8 -26
  29. data/lib/bebox/wizards/project_wizard.rb +42 -72
  30. data/lib/bebox/wizards/provision_wizard.rb +35 -51
  31. data/lib/bebox/wizards/role_wizard.rb +9 -29
  32. data/lib/bebox/wizards/wizards_helper.rb +41 -0
  33. data/lib/bebox.rb +30 -2
  34. data/lib/templates/project/config/deploy/steps/step-0.erb +13 -0
  35. data/lib/templates/project/config/deploy/steps/step-1.erb +0 -0
  36. data/lib/templates/project/config/deploy/steps/step-2.erb +0 -0
  37. data/lib/templates/project/config/deploy/steps/step-3.erb +0 -0
  38. data/lib/templates/project/config/deploy.erb +3 -0
  39. data/spec/fixtures/config/deploy/steps/step-0.test +13 -0
  40. data/spec/fixtures/config/deploy/steps/step-1.test +0 -0
  41. data/spec/fixtures/config/deploy/steps/step-2.test +0 -0
  42. data/spec/fixtures/config/deploy/steps/step-3.test +0 -0
  43. data/spec/fixtures/config/deploy.test +3 -0
  44. data/spec/ordered_phases_spec.rb +6 -4
  45. data/spec/pre_prepare_spec.rb +8 -6
  46. data/spec/profile_spec.rb +9 -5
  47. data/spec/project_spec.rb +9 -2
  48. data/spec/puppet_spec_helper.rb +1 -1
  49. data/spec/role_spec.rb +9 -5
  50. data/spec/spec_helper.rb +5 -0
  51. metadata +17 -212
  52. data/lib/templates/puppet/step-0/modules/rbenv/AUTHORS +0 -11
  53. data/lib/templates/puppet/step-0/modules/rbenv/CHANGELOG.md +0 -70
  54. data/lib/templates/puppet/step-0/modules/rbenv/Gemfile +0 -8
  55. data/lib/templates/puppet/step-0/modules/rbenv/Gemfile.lock +0 -28
  56. data/lib/templates/puppet/step-0/modules/rbenv/Modulefile +0 -7
  57. data/lib/templates/puppet/step-0/modules/rbenv/README.md +0 -173
  58. data/lib/templates/puppet/step-0/modules/rbenv/Rakefile +0 -22
  59. data/lib/templates/puppet/step-0/modules/rbenv/TODO +0 -10
  60. data/lib/templates/puppet/step-0/modules/rbenv/bin/autospec +0 -16
  61. data/lib/templates/puppet/step-0/modules/rbenv/bin/facter +0 -16
  62. data/lib/templates/puppet/step-0/modules/rbenv/bin/filebucket +0 -16
  63. data/lib/templates/puppet/step-0/modules/rbenv/bin/hiera +0 -16
  64. data/lib/templates/puppet/step-0/modules/rbenv/bin/htmldiff +0 -16
  65. data/lib/templates/puppet/step-0/modules/rbenv/bin/ldiff +0 -16
  66. data/lib/templates/puppet/step-0/modules/rbenv/bin/pi +0 -16
  67. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet +0 -16
  68. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-lint +0 -16
  69. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-module +0 -16
  70. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetca +0 -16
  71. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetd +0 -16
  72. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetdoc +0 -16
  73. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetmasterd +0 -16
  74. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetqd +0 -16
  75. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetrun +0 -16
  76. data/lib/templates/puppet/step-0/modules/rbenv/bin/rake +0 -16
  77. data/lib/templates/puppet/step-0/modules/rbenv/bin/ralsh +0 -16
  78. data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec +0 -16
  79. data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec-puppet-init +0 -16
  80. data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/provider/rbenvgem/default.rb +0 -50
  81. data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/type/rbenvgem.rb +0 -62
  82. data/lib/templates/puppet/step-0/modules/rbenv/manifests/bundle.pp +0 -36
  83. data/lib/templates/puppet/step-0/modules/rbenv/manifests/client.pp +0 -48
  84. data/lib/templates/puppet/step-0/modules/rbenv/manifests/compile.pp +0 -102
  85. data/lib/templates/puppet/step-0/modules/rbenv/manifests/definition.pp +0 -31
  86. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/centos.pp +0 -25
  87. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/suse.pp +0 -28
  88. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/ubuntu.pp +0 -17
  89. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies.pp +0 -8
  90. data/lib/templates/puppet/step-0/modules/rbenv/manifests/gem.pp +0 -29
  91. data/lib/templates/puppet/step-0/modules/rbenv/manifests/install.pp +0 -55
  92. data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rbenvvars.pp +0 -16
  93. data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rubybuild.pp +0 -16
  94. data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin.pp +0 -40
  95. data/lib/templates/puppet/step-0/modules/rbenv/metadata.json +0 -109
  96. data/lib/templates/puppet/step-0/modules/rbenv/templates/Gemfile.erb +0 -5
  97. data/lib/templates/puppet/step-0/modules/rbenv/templates/dot.rbenvrc.erb +0 -8
  98. data/lib/templates/puppet/step-0/modules/stdlib/CHANGELOG.md +0 -418
  99. data/lib/templates/puppet/step-0/modules/stdlib/CONTRIBUTING.md +0 -65
  100. data/lib/templates/puppet/step-0/modules/stdlib/Gemfile +0 -33
  101. data/lib/templates/puppet/step-0/modules/stdlib/Gemfile.lock +0 -166
  102. data/lib/templates/puppet/step-0/modules/stdlib/LICENSE +0 -19
  103. data/lib/templates/puppet/step-0/modules/stdlib/Modulefile +0 -11
  104. data/lib/templates/puppet/step-0/modules/stdlib/README.markdown +0 -1304
  105. data/lib/templates/puppet/step-0/modules/stdlib/README_DEVELOPER.markdown +0 -35
  106. data/lib/templates/puppet/step-0/modules/stdlib/README_SPECS.markdown +0 -7
  107. data/lib/templates/puppet/step-0/modules/stdlib/RELEASE_PROCESS.markdown +0 -24
  108. data/lib/templates/puppet/step-0/modules/stdlib/Rakefile +0 -18
  109. data/lib/templates/puppet/step-0/modules/stdlib/checksums.json +0 -349
  110. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/facter_dot_d.rb +0 -202
  111. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/pe_version.rb +0 -53
  112. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/puppet_vardir.rb +0 -26
  113. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/root_home.rb +0 -32
  114. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/util/puppet_settings.rb +0 -21
  115. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/abs.rb +0 -36
  116. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/any2array.rb +0 -33
  117. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/base64.rb +0 -37
  118. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/bool2num.rb +0 -49
  119. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/capitalize.rb +0 -34
  120. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chomp.rb +0 -35
  121. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chop.rb +0 -37
  122. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/concat.rb +0 -41
  123. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/count.rb +0 -22
  124. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb +0 -44
  125. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb +0 -35
  126. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete.rb +0 -46
  127. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_at.rb +0 -49
  128. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb +0 -34
  129. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_values.rb +0 -26
  130. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/difference.rb +0 -36
  131. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/dirname.rb +0 -15
  132. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/downcase.rb +0 -33
  133. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/empty.rb +0 -28
  134. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb +0 -35
  135. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb +0 -45
  136. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/flatten.rb +0 -33
  137. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/floor.rb +0 -25
  138. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb +0 -46
  139. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb +0 -17
  140. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getparam.rb +0 -35
  141. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getvar.rb +0 -26
  142. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/grep.rb +0 -33
  143. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb +0 -52
  144. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb +0 -25
  145. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb +0 -25
  146. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_key.rb +0 -28
  147. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/hash.rb +0 -41
  148. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/intersection.rb +0 -34
  149. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_array.rb +0 -22
  150. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_bool.rb +0 -22
  151. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb +0 -50
  152. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_float.rb +0 -30
  153. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb +0 -26
  154. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_hash.rb +0 -22
  155. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_integer.rb +0 -45
  156. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb +0 -32
  157. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb +0 -27
  158. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb +0 -75
  159. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_string.rb +0 -26
  160. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join.rb +0 -41
  161. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb +0 -47
  162. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/keys.rb +0 -26
  163. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb +0 -20
  164. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/lstrip.rb +0 -33
  165. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/max.rb +0 -21
  166. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/member.rb +0 -44
  167. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/merge.rb +0 -34
  168. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/min.rb +0 -21
  169. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/num2bool.rb +0 -43
  170. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parsejson.rb +0 -24
  171. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb +0 -24
  172. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick.rb +0 -29
  173. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick_default.rb +0 -35
  174. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/prefix.rb +0 -45
  175. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/range.rb +0 -88
  176. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reject.rb +0 -31
  177. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reverse.rb +0 -28
  178. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/rstrip.rb +0 -32
  179. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/shuffle.rb +0 -46
  180. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/size.rb +0 -48
  181. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/sort.rb +0 -27
  182. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/squeeze.rb +0 -36
  183. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2bool.rb +0 -46
  184. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb +0 -32
  185. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strftime.rb +0 -107
  186. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strip.rb +0 -39
  187. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/suffix.rb +0 -45
  188. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/swapcase.rb +0 -39
  189. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/time.rb +0 -49
  190. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb +0 -28
  191. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/type.rb +0 -50
  192. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/union.rb +0 -34
  193. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/unique.rb +0 -51
  194. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/upcase.rb +0 -41
  195. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/uriescape.rb +0 -35
  196. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb +0 -56
  197. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_array.rb +0 -33
  198. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb +0 -81
  199. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb +0 -34
  200. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb +0 -48
  201. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb +0 -33
  202. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb +0 -48
  203. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb +0 -49
  204. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_re.rb +0 -40
  205. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb +0 -71
  206. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_string.rb +0 -33
  207. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values.rb +0 -39
  208. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values_at.rb +0 -98
  209. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/zip.rb +0 -65
  210. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/provider/file_line/ruby.rb +0 -83
  211. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/anchor.rb +0 -46
  212. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/file_line.rb +0 -79
  213. data/lib/templates/puppet/step-0/modules/stdlib/manifests/init.pp +0 -20
  214. data/lib/templates/puppet/step-0/modules/stdlib/manifests/stages.pp +0 -43
  215. data/lib/templates/puppet/step-0/modules/stdlib/metadata.json +0 -111
  216. data/lib/templates/puppet/step-0/modules/sudo/.fixtures.yml +0 -5
  217. data/lib/templates/puppet/step-0/modules/sudo/.gemfile +0 -14
  218. data/lib/templates/puppet/step-0/modules/sudo/.gemfile.lock +0 -43
  219. data/lib/templates/puppet/step-0/modules/sudo/.travis.yml +0 -34
  220. data/lib/templates/puppet/step-0/modules/sudo/LICENSE +0 -13
  221. data/lib/templates/puppet/step-0/modules/sudo/Modulefile +0 -9
  222. data/lib/templates/puppet/step-0/modules/sudo/README.md +0 -171
  223. data/lib/templates/puppet/step-0/modules/sudo/Rakefile +0 -1
  224. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.aix +0 -90
  225. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.archlinux +0 -90
  226. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.deb +0 -90
  227. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.freebsd +0 -98
  228. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.omnios +0 -90
  229. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel5 +0 -97
  230. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel6 +0 -115
  231. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.solaris +0 -90
  232. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.suse +0 -81
  233. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.ubuntu +0 -30
  234. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.wheezy +0 -17
  235. data/lib/templates/puppet/step-0/modules/sudo/lib/augeas/lenses/fixedsudoers.aug +0 -520
  236. data/lib/templates/puppet/step-0/modules/sudo/manifests/allow.pp +0 -76
  237. data/lib/templates/puppet/step-0/modules/sudo/manifests/conf.pp +0 -105
  238. data/lib/templates/puppet/step-0/modules/sudo/manifests/configs.pp +0 -24
  239. data/lib/templates/puppet/step-0/modules/sudo/manifests/init.pp +0 -151
  240. data/lib/templates/puppet/step-0/modules/sudo/manifests/package/aix.pp +0 -46
  241. data/lib/templates/puppet/step-0/modules/sudo/manifests/package/solaris.pp +0 -60
  242. data/lib/templates/puppet/step-0/modules/sudo/manifests/package.pp +0 -61
  243. data/lib/templates/puppet/step-0/modules/sudo/manifests/params.pp +0 -127
  244. data/lib/templates/puppet/step-0/modules/sudo/metadata.json +0 -59
  245. data/lib/templates/puppet/step-0/modules/sudo/templates/users_groups.erb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2686461b25f6cddf91684fc202769d79fc89863
4
- data.tar.gz: fac186b3c4af1096e307c23fa5c26a2752763d22
3
+ metadata.gz: 69912bd5c8001b5268585d2e588209842de9714b
4
+ data.tar.gz: 8361cf2dc44a3e28bbc6c93991d1cffe68d662d6
5
5
  SHA512:
6
- metadata.gz: afbfa11267c24b44bd88cdbc14a5d83f9c36e8db23d72a9109ea483a0442a39829a1f5b0b7f92cdb270c2ce9719a50a2ad1c66e7344e1a61774fd4c2e19c13e3
7
- data.tar.gz: 73eb634c5c82c13a392d2c5d45cbc6615204eb6aca6feaa6710849ce5c9cf22947d17991d34cac8602946101069dea94998f831d1c9f0644d55ad54c7853cba4
6
+ metadata.gz: 3dad9691f0bff82bf147b9cd09f28bdcbcb143019ce960b99b325ad619393d71c6aca7ab5968cd6c4acf867e28194f2159bad044dd564e5ddaba241801823e0d
7
+ data.tar.gz: 4865599e35c7ed4b6b8028d73b080bfa5a120ec62167434a580fc0a706d7ad9c3be5a58cadf075e0a2d3f6dd24a00fcf65994af99a989c65ec93753d7e0cee4d
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bebox (0.0.1)
5
- active_attr (= 0.8.3)
4
+ bebox (0.1.0)
6
5
  colorize (= 0.6.0)
7
6
  gli (= 2.10.0)
8
7
  highline (= 1.6.21)
@@ -21,12 +20,6 @@ GEM
21
20
  activesupport (= 4.1.0)
22
21
  builder (~> 3.1)
23
22
  erubis (~> 2.7.0)
24
- active_attr (0.8.3)
25
- activemodel (>= 3.0.2, < 4.2)
26
- activesupport (>= 3.0.2, < 4.2)
27
- activemodel (4.1.0)
28
- activesupport (= 4.1.0)
29
- builder (~> 3.1)
30
23
  activesupport (4.1.0)
31
24
  i18n (~> 0.6, >= 0.6.9)
32
25
  json (~> 1.7, >= 1.7.7)
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
-
2
1
  Bebox
3
2
  =====
4
3
 
4
+ [![Code Climate](https://codeclimate.com/github/codescrum/bebox/badges/gpa.svg)](https://codeclimate.com/github/codescrum/bebox)
5
+
5
6
  Introduction
6
7
  ------------
7
8
 
@@ -69,6 +70,20 @@ NOTE: Probably many people would think this is not advisable, so there is always
69
70
 
70
71
  How to Use
71
72
  ----------
73
+
74
+ ### Bebox demo
75
+
76
+ You can see a bebox demo video for a complete example of provisioning a machine and deploying a rails application in it.
77
+
78
+ [![bebox demo video](http://img.youtube.com/vi/mioeMsuKJr4/0.jpg)](http://www.youtube.com/watch?v=mioeMsuKJr4)
79
+
80
+ Also you can find the provision and rails app code sample projects in:
81
+
82
+ * [A puppet repo generated by bebox to deploy a sample rails app.](http://github.com/codescrum/bebox-sample-puppet-generated-repo)
83
+
84
+ * [A demo ruby on rails app deployed from a puppet repo generated by bebox.](http://github.com/codescrum/sample-rails-app-for-bebox)
85
+
86
+
72
87
  ###Installation
73
88
 
74
89
  Pre-requisites
@@ -77,23 +92,11 @@ Pre-requisites
77
92
  * ruby version >= 1.9.2 (ruby 2.1.0 recommended)
78
93
  * vagrant (tested using vagrant 1.6.3)
79
94
 
80
- ####Build bebox gem
81
- This commands clone the project and generate the bebox gem file:
82
- ```
83
- git clone https://github.com/jairodiaz/bebox
84
- cd bebox
85
- gem build bebox.gemspec
86
- ```
87
- This creates a *bebox-0.0.1.gem* file.
88
-
89
-
90
95
  ####Install bebox:
91
96
 
92
97
  In the directory where you want to install bebox do:
93
98
 
94
- gem install BEBOX_GEM_PATH
95
-
96
- Where BEBOX_GEM_PATH is the route to the *bebox-0.0.1.gem* file created previously.
99
+ gem install bebox
97
100
 
98
101
  ###Bebox project creation (Project creation phase).
99
102
 
@@ -224,11 +227,11 @@ The structure is like:
224
227
  The *categories (category1, category2, ... categoryN)* are set if the argument *-p PATH* is passed; and are useful better organization of profiles.
225
228
 
226
229
  For example:
227
- ```
228
- bebox profile new iptables -p basic/security
229
- ```
230
+
231
+ bebox profile new iptables -p basic/security
232
+
230
233
  would create the profiles directories structure:
231
- ```
234
+
232
235
  ── profiles/
233
236
  └── basic/
234
237
  └── security/
@@ -256,7 +259,7 @@ To list profiles:
256
259
 
257
260
  **We recommend to use our default profiles (fundamental, users, security) for steps (0, 1, 3), but you can edit or delete them under your own risk**
258
261
 
259
- **Important: Remember that you need to write/edit the puppet code for the profiles to work (specially step-2 that has no defaults); also you have to write/edit the Puppetfile template created to add modules that your profile use; additionally if you call hiera data from a profile you need to add them in the hiera/data/<data>.yaml file in the structure created (see Hiera part below)**
262
+ **Important:** Remember that you need to write/edit the puppet code for the profiles to work (specially step-2 that has no defaults); also you have to write/edit the Puppetfile template created to add modules that your profile use; additionally if you call hiera data from a profile you need to add them in the hiera/data/<data>.yaml file in the structure created (see Hiera part below)
260
263
 
261
264
 
262
265
  ####Associate roles and profiles
@@ -313,7 +316,7 @@ If you use hiera data from your profiles, you can add them to the appropiate fil
313
316
  ├── modules/
314
317
  └── Puppetfile (Automatically generated by Bebox in every 'apply')
315
318
 
316
- Each of he <number>-<step-name> corresponds provisioning steps phase. For example **0-fundamental** correspond to **step-0** option.
319
+ Each of the *<number>-<step-name>* directories corresponds to a provisioning step phase. For example **0-fundamental** correspond to **step-0** option.
317
320
 
318
321
  To add hiera data you need to edit any of the **[node].yaml**, **[environment].yaml**, **common.yaml**.
319
322
  [node]: correspond to the hiera file for the node hostname (Ex. node0.server1.com.yaml).
@@ -327,36 +330,36 @@ To use the project in development mode, you need to do this:
327
330
 
328
331
  * Clone bebox from the repository.
329
332
 
330
- git clone ssh://git@codescrum.repositoryhosting.com/codescrum/bebox.git
333
+ git clone https://github.com/codescrum/bebox.git
331
334
 
332
335
  * Run bundle to install
333
336
 
334
- bundle install
337
+ bundle install
335
338
 
336
339
  * Generate the gem package
337
340
 
338
- rake package
341
+ rake package
339
342
 
340
343
  * Make a tmp directory inside bebox folder
341
344
 
342
- mkdir tmp
343
- cd tmp
345
+ mkdir tmp
346
+ cd tmp
344
347
 
345
348
  * Execute the project creation command preceded by **bundle exec**
346
349
 
347
- bundle exec bebox new PROJECT
350
+ bundle exec bebox new PROJECT
348
351
 
349
352
  * Enter to the project created
350
353
 
351
- cd PROJECT
354
+ cd PROJECT
352
355
 
353
356
  * Add to the **Gemfile** the line
354
357
 
355
- gem 'bebox', :path => "BEBOX_PATH_IN_YOUR_PC/pkg"
358
+ gem 'bebox', :path => "BEBOX_PATH_IN_YOUR_PC/pkg"
356
359
 
357
360
  * Execute any project commands preceded by **bundle exec**
358
361
 
359
- bundle exec bebox environment
362
+ bundle exec bebox environment
360
363
 
361
364
  Tests
362
365
  -----
@@ -369,4 +372,4 @@ By project's nature the specs must be run in order. To do this all specs has a '
369
372
 
370
373
  Maybe it would take a large time because it creates a vagrant machine and do a basic provision downloading packages and installing them in the machine.
371
374
 
372
- **Important: You need to have the [ubuntu-server-12042-x64-vbox4210-nocm.box](http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box) in the bebox root folder to run the tests**
375
+ **Important:** You need to have the [ubuntu-server-12042-x64-vbox4210-nocm.box](http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box) in the bebox root folder to run the tests
data/bebox.gemspec CHANGED
@@ -21,7 +21,7 @@ spec = Gem::Specification.new do |s|
21
21
  s.files = `git ls-files`.split("\n") - ['.ruby-version']
22
22
  s.require_paths << 'lib'
23
23
  s.has_rdoc = false
24
- s.rdoc_options << '--title' << 'bebox' << '--main' << 'README.rdoc' << '-ri'
24
+ s.rdoc_options << '--title' << 'bebox' << '--main' << 'README.rdoc' << '--ri'
25
25
  s.bindir = 'bin'
26
26
  s.executables << 'bebox'
27
27
  s.required_ruby_version = '>= 1.9.2'
@@ -32,7 +32,6 @@ spec = Gem::Specification.new do |s|
32
32
  s.add_development_dependency('serverspec', '1.6.0')
33
33
  s.add_development_dependency('factory_girl', '4.3.0')
34
34
  s.add_runtime_dependency('gli','2.10.0')
35
- s.add_runtime_dependency('active_attr', '0.8.3')
36
35
  s.add_runtime_dependency('tilt', '2.0.1')
37
36
  s.add_runtime_dependency('highline', '1.6.21')
38
37
  s.add_runtime_dependency('progressbar', '0.21.0')
data/bin/bebox CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require 'bebox/cli'
3
- require 'bebox/version'
2
+ require 'bebox'
4
3
 
5
4
  Bebox::Cli.new(ARGV)
data/lib/bebox/cli.rb CHANGED
@@ -1,6 +1,3 @@
1
- require 'gli'
2
- require 'highline/import'
3
- require 'bebox/logger'
4
1
 
5
2
  module Bebox
6
3
  class Cli
@@ -16,10 +13,8 @@ module Bebox
16
13
  version Bebox::VERSION
17
14
 
18
15
  if inside_project?
19
- require 'bebox/commands/project_commands'
20
16
  self.extend Bebox::ProjectCommands
21
17
  else
22
- require 'bebox/commands/general_commands'
23
18
  self.extend Bebox::GeneralCommands
24
19
  end
25
20
  exit run(*args)
@@ -1,10 +1,12 @@
1
+
1
2
  module Bebox
2
3
  module CommandsHelper
4
+ include Bebox::WizardsHelper
3
5
  # Obtain the environment from command parameters or menu
4
6
  def get_environment(options)
5
7
  environment = options[:environment]
6
8
  # Ask for environment of node if flag environment not set
7
- environment ||= Bebox::EnvironmentWizard.new.choose_environment(Environment.list(project_root))
9
+ environment ||= choose_option(Environment.list(project_root), 'Choose an existing environment:')
8
10
  # Check environment existence
9
11
  Bebox::Environment.environment_exists?(project_root, environment) ? (return environment) : exit_now!(error("The '#{environment}' environment does not exist."))
10
12
  end
@@ -1,3 +1,4 @@
1
+
1
2
  module Bebox
2
3
  module EnvironmentCommands
3
4
 
@@ -9,36 +10,32 @@ module Bebox
9
10
  # Environment management phase commands
10
11
  desc 'Manage environments for the project. The \'vagrant\', \'production\' and \'staging\' environments are present by default.'
11
12
  command :environment do |environment_command|
12
- # Environment list command
13
- environment_command.desc 'list the remote environments in the project'
14
- environment_command.command :list do |environment_list_command|
15
- environment_list_command.action do |global_options,options,args|
16
- require 'bebox/environment'
17
- environments = Bebox::Environment.list(project_root)
18
- title 'Current environments:'
19
- environments.map{|environment| msg(environment)}
20
- warn('There are not environments yet. You can create a new one with: \'bebox environment new\' command.') if environments.empty?
21
- end
22
- end
23
- # Environment new command
24
- environment_command.desc 'add a remote environment to the project'
25
- environment_command.arg_name "[environment]"
26
- environment_command.command :new do |environment_new_command|
27
- environment_new_command.action do |global_options,options,args|
28
- help_now!(error('You did not supply an environment')) if args.count == 0
29
- require 'bebox/wizards/environment_wizard'
30
- Bebox::EnvironmentWizard.new.create_new_environment(project_root, args.first)
31
- end
13
+ environment_list_command(environment_command)
14
+ generate_environment_command(environment_command, :new, :create_new_environment, 'Add a remote environment to the project')
15
+ generate_environment_command(environment_command, :remove, :remove_environment, 'Remove a remote environment in the project')
16
+ end
17
+ end
18
+
19
+ def generate_environment_command(environment_command, command, send_command, description)
20
+ environment_command.desc description
21
+ environment_command.arg_name "[environment]"
22
+ environment_command.command command do |generated_command|
23
+ generated_command.action do |global_options,options,args|
24
+ help_now!(error('You did not supply an environment')) if args.count == 0
25
+ Bebox::EnvironmentWizard.new.send(send_command, project_root, args.first)
32
26
  end
33
- # Environment remove command
34
- environment_command.desc "remove a remote environment in the project"
35
- environment_command.arg_name "[environment]"
36
- environment_command.command :remove do |environment_remove_command|
37
- environment_remove_command.action do |global_options,options,args|
38
- help_now!(error('You did not supply an environment')) if args.count == 0
39
- require 'bebox/wizards/environment_wizard'
40
- Bebox::EnvironmentWizard.new.remove_environment(project_root, args.first)
41
- end
27
+ end
28
+ end
29
+
30
+ # Environment list command
31
+ def environment_list_command(environment_command)
32
+ environment_command.desc 'List the remote environments in the project'
33
+ environment_command.command :list do |environment_list_command|
34
+ environment_list_command.action do |global_options,options,args|
35
+ environments = Bebox::Environment.list(project_root)
36
+ title 'Current environments:'
37
+ environments.map{|environment| msg(environment)}
38
+ warn('There are not environments yet. You can create a new one with: \'bebox environment new\' command.') if environments.empty?
42
39
  end
43
40
  end
44
41
  end
@@ -12,7 +12,6 @@ module Bebox
12
12
  command :new do |project_command|
13
13
  project_command.action do |global_options,options,args|
14
14
  if args.count > 0
15
- require 'bebox/wizards/project_wizard'
16
15
  Bebox::ProjectWizard.new.create_new_project("bebox-#{args.first}")
17
16
  else
18
17
  help_now!(error('You did not supply a project name'))
@@ -1,5 +1,3 @@
1
- require 'bebox/role'
2
- require 'bebox/node'
3
1
 
4
2
  module Bebox
5
3
  module NodeCommands
@@ -12,55 +10,53 @@ module Bebox
12
10
  # Nodes management phase commands
13
11
  desc 'Manage nodes for a environment in the project.'
14
12
  command :node do |node_command|
15
- # Node list command
16
- node_command.flag :environment, :desc => 'Set the environment for nodes', default_value: default_environment
17
- node_command.desc 'list the nodes in a environment'
18
- node_command.command :list do |node_list_command|
19
- node_list_command.switch :all
20
- node_list_command.action do |global_options,options,args|
21
- # Call to list nodes
22
- environments = options[:all] ? Bebox::Environment.list(project_root) : [get_environment(options)]
23
- environments.each do |environment|
24
- nodes = Node.list(project_root, environment, 'nodes')
25
- title "Nodes for '#{environment}' environment:"
26
- nodes.map{|node| msg("#{node} (#{Bebox::Node.node_provision_state(project_root, environment, node)})")}
27
- warn('There are not nodes yet in the environment. You can create a new one with: \'bebox node new\' command.') if nodes.empty?
28
- end
29
- linebreak
30
- end
31
- end
32
- # Node new command
33
- node_command.desc 'add a node to a environment'
34
- node_command.command :new do |node_new_command|
35
- node_new_command.action do |global_options,options,args|
36
- environment = get_environment(options)
37
- info "Environment: #{environment}"
38
- require 'bebox/wizards/node_wizard'
39
- Bebox::NodeWizard.new.create_new_node(project_root, environment)
13
+ node_list_command(node_command)
14
+ generate_node_command(node_command, :new, :create_new_node, 'Add a node to a environment')
15
+ node_remove_command(node_command)
16
+ # These commands are available if there is at least one role and one node
17
+ generate_node_command(node_command, :set_role, :set_role, 'Associate a node with a role in a environment') if (Bebox::Role.roles_count(project_root) > 0 && Bebox::Node.count_all_nodes_by_type(project_root, 'nodes') > 0)
18
+ end
19
+ end
20
+
21
+ def node_list_command(node_command)
22
+ # Node list command
23
+ node_command.flag :environment, desc: 'Set the environment for nodes', default_value: default_environment
24
+ node_command.desc 'list the nodes in a environment'
25
+ node_command.command :list do |node_list_command|
26
+ node_list_command.switch :all
27
+ node_list_command.action do |global_options,options,args|
28
+ # Call to list nodes
29
+ environments = options[:all] ? Bebox::Environment.list(project_root) : [get_environment(options)]
30
+ environments.each do |environment|
31
+ nodes = Node.list(project_root, environment, 'nodes')
32
+ title "Nodes for '#{environment}' environment:"
33
+ nodes.map{|node| msg("#{node} (#{Bebox::Node.node_provision_state(project_root, environment, node)})")}
34
+ warn('There are not nodes yet in the environment. You can create a new one with: \'bebox node new\' command.') if nodes.empty?
40
35
  end
36
+ linebreak
41
37
  end
42
- # Node remove command
43
- node_command.desc "remove a node in a environment"
44
- node_command.command :remove do |node_remove_command|
45
- node_remove_command.action do |global_options,options,args|
46
- environment = get_environment(options)
47
- info "Environment: #{environment}"
48
- require 'bebox/wizards/node_wizard'
49
- Bebox::NodeWizard.new.remove_node(project_root, environment, args.first)
50
- end
38
+ end
39
+ end
40
+
41
+ # For new and set_role commands
42
+ def generate_node_command(node_command, command, send_command, description)
43
+ node_command.desc description
44
+ node_command.command command do |generated_command|
45
+ generated_command.action do |global_options,options,args|
46
+ environment = get_environment(options)
47
+ info "Environment: #{environment}"
48
+ Bebox::NodeWizard.new.send(send_command, project_root, environment)
51
49
  end
52
- # These commands are available if there is at least one role and one node
53
- if Bebox::Role.roles_count(project_root) > 0 && Bebox::Node.count_all_nodes_by_type(project_root, 'nodes') > 0
54
- # Associate node to role command
55
- node_command.desc "Associate a node with a role in a environment"
56
- node_command.command :set_role do |node_role_command|
57
- node_role_command.action do |global_options,options,args|
58
- environment = get_environment(options)
59
- info "Environment: #{environment}"
60
- require 'bebox/wizards/node_wizard'
61
- Bebox::NodeWizard.new.set_role(project_root, environment)
62
- end
63
- end
50
+ end
51
+ end
52
+
53
+ def node_remove_command(node_command)
54
+ node_command.desc "Remove a node in a environment"
55
+ node_command.command :remove do |node_remove_command|
56
+ node_remove_command.action do |global_options,options,args|
57
+ environment = get_environment(options)
58
+ info "Environment: #{environment}"
59
+ Bebox::NodeWizard.new.remove_node(project_root, environment, args.first)
64
60
  end
65
61
  end
66
62
  end
@@ -1,3 +1,4 @@
1
+
1
2
  module Bebox
2
3
  module PrepareCommands
3
4
 
@@ -15,45 +16,37 @@ module Bebox
15
16
  # Check if vagrant is installed
16
17
  return error('Vagrant is not installed in the system. No changes were made.') unless vagrant_installed?
17
18
  title "Environment: #{environment}"
18
- require 'bebox/wizards/node_wizard'
19
19
  Bebox::NodeWizard.new.prepare(project_root, environment)
20
20
  end
21
21
  end
22
22
  # These commands are available if there are at least one node in the vagrant environment
23
- if Bebox::Node.list(project_root, 'vagrant', 'prepared_nodes').count > 0
24
- desc 'Halt the nodes for vagrant environment.'
25
- command :vagrant_halt do |vagrant_halt_command|
26
- vagrant_halt_command.action do |global_options,options,args|
27
- # Check if vagrant is installed
28
- return error('Vagrant is not installed in the system. No changes were made.') unless vagrant_installed?
29
- # List nodes in environment and notice message
30
- nodes = Bebox::Node.nodes_in_environment(project_root, 'vagrant', 'nodes')
31
- environment = 'vagrant'
32
- title "Environment: #{environment}"
33
- title 'Halting nodes:'
34
- nodes.each{|node| msg(node.hostname)}
35
- linebreak
36
- # Halt vagrant nodes
37
- Bebox::Node.halt_vagrant_nodes(project_root)
38
- end
23
+ (Bebox::Node.list(project_root, 'vagrant', 'prepared_nodes').count > 0) ? load_vagrant_commands : return
24
+ end
25
+
26
+ def load_vagrant_commands
27
+ desc 'Halt the nodes for vagrant environment.'
28
+ command :vagrant_halt do |vagrant_halt_command|
29
+ vagrant_halt_command.action do |global_options,options,args|
30
+ vagrant_command(:halt_vagrant_nodes, 'Halting nodes:')
39
31
  end
40
- desc 'Up the nodes for vagrant environment.'
41
- command :vagrant_up do |vagrant_up_command|
42
- vagrant_up_command.action do |global_options,options,args|
43
- # Check if vagrant is installed
44
- return error('Vagrant is not installed in the system. No changes were made.') unless vagrant_installed?
45
- # List nodes in environment and notice message
46
- nodes = Bebox::Node.nodes_in_environment(project_root, 'vagrant', 'nodes')
47
- environment = 'vagrant'
48
- title "Environment: #{environment}"
49
- title 'Running up nodes:'
50
- nodes.each{|node| msg(node.hostname)}
51
- linebreak
52
- # Up vagrant nodes
53
- Bebox::Node.up_vagrant_nodes(project_root)
54
- end
32
+ end
33
+ desc 'Up the nodes for vagrant environment.'
34
+ command :vagrant_up do |vagrant_up_command|
35
+ vagrant_up_command.action do |global_options,options,args|
36
+ vagrant_command(:up_vagrant_nodes, 'Running up nodes:')
55
37
  end
56
38
  end
57
39
  end
40
+
41
+ def vagrant_command(command, message)
42
+ # Check if vagrant is installed
43
+ return error('Vagrant is not installed in the system. No changes were made.') unless vagrant_installed?
44
+ nodes = Bebox::Node.nodes_in_environment(project_root, 'vagrant', 'nodes')
45
+ environment = 'vagrant'
46
+ title "Environment: #{environment}\n#{message}"
47
+ nodes.each{|node| msg(node.hostname)}
48
+ linebreak
49
+ Bebox::VagrantHelper.send(command, project_root)
50
+ end
58
51
  end
59
52
  end
@@ -0,0 +1,56 @@
1
+
2
+ module Bebox
3
+ module ProfileCommands
4
+
5
+ def self.extended(base)
6
+ base.load_commands
7
+ end
8
+
9
+ def load_commands
10
+ desc 'Manage profiles for the node provisioning phase.'
11
+ command :profile do |profile_command|
12
+ profile_new_command(profile_command)
13
+ profile_remove_command(profile_command)
14
+ profile_list_command(profile_command)
15
+ end
16
+ end
17
+
18
+ # Profile new command
19
+ def profile_new_command(profile_command)
20
+ profile_command.desc 'Add a profile to the project'
21
+ profile_command.arg_name "[name]"
22
+ profile_command.command :new do |profile_new_command|
23
+ profile_new_command.flag :p, :arg_name => 'path', :desc => 'A relative path of the category folders tree to store the profile. Ex. basic/security/iptables'
24
+ profile_new_command.action do |global_options,options,args|
25
+ path = options[:p] || ''
26
+ help_now!(error('You did not supply a name')) if args.count == 0
27
+ Bebox::ProfileWizard.new.create_new_profile(project_root, args.first, path)
28
+ end
29
+ end
30
+ end
31
+
32
+ # Profile remove command
33
+ def profile_remove_command(profile_command)
34
+ profile_command.desc "Remove a profile from the project"
35
+ profile_command.command :remove do |profile_remove_command|
36
+ profile_remove_command.action do |global_options,options,args|
37
+ Bebox::ProfileWizard.new.remove_profile(project_root)
38
+ end
39
+ end
40
+ end
41
+
42
+ # Profile list command
43
+ def profile_list_command(profile_command)
44
+ profile_command.desc 'List the profiles in the project'
45
+ profile_command.command :list do |profile_list_command|
46
+ profile_list_command.action do |global_options,options,args|
47
+ profiles = Bebox::ProfileWizard.new.list_profiles(project_root)
48
+ title 'Current profiles:'
49
+ profiles.map{|profile| msg(profile)}
50
+ warn('There are not profiles yet. You can create a new one with: \'bebox profile new\' command.') if profiles.empty?
51
+ linebreak
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,4 +1,3 @@
1
- require 'bebox/commands/commands_helper'
2
1
 
3
2
  module Bebox
4
3
  module ProjectCommands
@@ -10,35 +9,30 @@ module Bebox
10
9
  end
11
10
 
12
11
  def load_commands
13
- require 'bebox/commands/environment_commands'
14
- require 'bebox/environment'
12
+ load_environment_commands
13
+ load_node_commands
14
+ load_prepare_commands
15
+ load_provision_commands
16
+ end
17
+
18
+ # Load environment commands
19
+ def load_environment_commands
15
20
  self.extend Bebox::EnvironmentCommands
16
- # This commands only run if there are environments configured
17
- if Bebox::Environment.list(project_root).count > 0
18
- require 'bebox/commands/node_commands'
19
- self.extend Bebox::NodeCommands
20
- # These commands are available if there are at least one node configured in the project
21
- if Bebox::Node.count_all_nodes_by_type(project_root, 'nodes') > 0
22
- require 'bebox/commands/prepare_commands'
23
- self.extend Bebox::PrepareCommands
24
- # These commands are available if there are at least one prepared_node
25
- if Bebox::Node.count_all_nodes_by_type(project_root, 'prepared_nodes') > 0
26
- # load_provision_commands
27
- require 'bebox/commands/provision_commands'
28
- self.extend Bebox::ProvisionCommands
29
- end
30
- end
31
- end
32
- pre do |global_options,command,options,args|
33
- true
34
- end
35
-
36
- post do |global_options,command,options,args|
37
- end
38
-
39
- on_error do |exception|
40
- true
41
- end
21
+ end
22
+
23
+ # Load node commands if there are environments configured
24
+ def load_node_commands
25
+ Bebox::Environment.list(project_root).count > 0 ? (self.extend Bebox::NodeCommands) : return
26
+ end
27
+
28
+ # Load prepare commands if there are at least one node
29
+ def load_prepare_commands
30
+ Bebox::Node.count_all_nodes_by_type(project_root, 'nodes') > 0 ? (self.extend Bebox::PrepareCommands) : return
31
+ end
32
+
33
+ # Load provision commands if there are nodes prepared
34
+ def load_provision_commands
35
+ Bebox::Node.count_all_nodes_by_type(project_root, 'prepared_nodes') > 0 ? (self.extend Bebox::ProvisionCommands) : return
42
36
  end
43
37
  end
44
38
  end