cybele 1.9.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (384) hide show
  1. checksums.yaml +4 -4
  2. data/.fasterer.yml +5 -0
  3. data/.flayignore +3 -0
  4. data/.gitignore +4 -1
  5. data/.haml-lint.yml +5 -0
  6. data/.poper.yml +7 -0
  7. data/.rubocop.yml +59 -0
  8. data/.ruby-version +1 -1
  9. data/CHANGELOG.md +458 -2
  10. data/Gemfile +2 -0
  11. data/README.md +16 -20
  12. data/Rakefile +1 -1
  13. data/USAGE +12 -0
  14. data/bin/build_app +18 -0
  15. data/bin/build_gem +20 -0
  16. data/bin/cybele +21 -6
  17. data/config.reek +29 -0
  18. data/cybele.gemspec +14 -6
  19. data/example.pronto.yml +8 -0
  20. data/lib/cybele.rb +33 -0
  21. data/lib/cybele/app_builder.rb +43 -510
  22. data/lib/cybele/generators/app_generator.rb +240 -180
  23. data/lib/cybele/helpers.rb +104 -0
  24. data/lib/cybele/helpers/app_files/assets_files.rb +43 -0
  25. data/lib/cybele/helpers/app_files/controller_files.rb +23 -0
  26. data/lib/cybele/helpers/app_files/helper_files.rb +15 -0
  27. data/lib/cybele/helpers/app_files/mailer_files.rb +15 -0
  28. data/lib/cybele/helpers/app_files/model_files.rb +16 -0
  29. data/lib/cybele/helpers/app_files/vendor_files.rb +14 -0
  30. data/lib/cybele/helpers/app_files/view_files.rb +62 -0
  31. data/lib/cybele/helpers/app_files/view_gems.rb +20 -0
  32. data/lib/cybele/helpers/audited.rb +12 -0
  33. data/lib/cybele/helpers/basic_authentication.rb +44 -0
  34. data/lib/cybele/helpers/devise.rb +67 -0
  35. data/lib/cybele/helpers/docker.rb +53 -0
  36. data/lib/cybele/helpers/dotenv.rb +23 -0
  37. data/lib/cybele/helpers/error_pages.rb +37 -0
  38. data/lib/cybele/helpers/general.rb +87 -0
  39. data/lib/cybele/helpers/haml.rb +18 -0
  40. data/lib/cybele/helpers/locale_language.rb +23 -0
  41. data/lib/cybele/helpers/mailer.rb +25 -0
  42. data/lib/cybele/helpers/paperclip.rb +33 -0
  43. data/lib/cybele/helpers/pronto.rb +34 -0
  44. data/lib/cybele/helpers/recipient_interceptor.rb +18 -0
  45. data/lib/cybele/helpers/responders.rb +36 -0
  46. data/lib/cybele/helpers/routes.rb +18 -0
  47. data/lib/cybele/helpers/show_for.rb +20 -0
  48. data/lib/cybele/helpers/sidekiq.rb +37 -0
  49. data/lib/cybele/helpers/simple_form.rb +19 -0
  50. data/lib/cybele/helpers/staging.rb +15 -0
  51. data/lib/cybele/version.rb +5 -3
  52. data/spec/features/cli_help_spec.rb +42 -0
  53. data/spec/features/git_and_git_flow_spec.rb +30 -0
  54. data/spec/features/new_default_project_spec.rb +465 -0
  55. data/spec/features/new_not_default_project_spec.rb +412 -0
  56. data/spec/spec_helper.rb +38 -0
  57. data/spec/support/config_test_helper.rb +36 -0
  58. data/spec/support/cybele_test_helpers.rb +115 -0
  59. data/spec/support/devise_test_helper.rb +45 -0
  60. data/spec/support/dotenv_test_helper.rb +31 -0
  61. data/spec/support/error_pages_test_helper.rb +24 -0
  62. data/spec/support/force_ssl_test_helper.rb +24 -0
  63. data/spec/support/git_ignore_test_helper.rb +10 -0
  64. data/spec/support/locale_language_test_helper.rb +43 -0
  65. data/spec/support/mail_test_helpers.rb +15 -0
  66. data/spec/support/paperclip_test_helper.rb +38 -0
  67. data/spec/support/pronto_test_helpers.rb +41 -0
  68. data/spec/support/responder_test_helper.rb +32 -0
  69. data/templates/Gemfile.erb +59 -0
  70. data/templates/README.md.erb +23 -20
  71. data/templates/VERSION.txt +1 -0
  72. data/templates/app_files/app/assets/javascripts/application.js +81 -0
  73. data/templates/app_files/app/assets/javascripts/hq/application.js +80 -0
  74. data/templates/{app/assets/stylesheets/application.css.sass → app_files/app/assets/stylesheets/application.sass} +27 -16
  75. data/templates/app_files/app/assets/stylesheets/hq/_sidebar.sass +89 -0
  76. data/templates/app_files/app/assets/stylesheets/hq/application.sass +74 -0
  77. data/templates/app_files/app/controllers/concerns/activatable.rb +16 -0
  78. data/templates/{app → app_files/app}/controllers/hq/admins_controller.rb +7 -10
  79. data/templates/app_files/app/controllers/hq/application_controller.rb +13 -0
  80. data/templates/{app → app_files/app}/controllers/hq/audits_controller.rb +3 -3
  81. data/templates/app_files/app/controllers/hq/dashboard_controller.rb +7 -0
  82. data/templates/{app → app_files/app}/controllers/hq/passwords_controller.rb +3 -2
  83. data/templates/app_files/app/controllers/hq/registrations_controller.rb +22 -0
  84. data/templates/{app → app_files/app}/controllers/hq/sessions_controller.rb +5 -4
  85. data/templates/{app → app_files/app}/controllers/hq/users_controller.rb +7 -10
  86. data/templates/app_files/app/controllers/user/application_controller.rb +18 -0
  87. data/templates/app_files/app/controllers/user/dashboard_controller.rb +7 -0
  88. data/templates/{app → app_files/app}/controllers/user/passwords_controller.rb +3 -4
  89. data/templates/app_files/app/controllers/user/profile_controller.rb +30 -0
  90. data/templates/{app → app_files/app}/controllers/user/registrations_controller.rb +7 -8
  91. data/templates/{app → app_files/app}/controllers/user/sessions_controller.rb +5 -6
  92. data/templates/app_files/app/controllers/welcome_controller.rb +9 -0
  93. data/templates/app_files/app/helpers/application_helper.rb.erb +61 -0
  94. data/templates/app_files/app/mailers/admin_mailer.rb +10 -0
  95. data/templates/app_files/app/mailers/application_mailer.rb +6 -0
  96. data/templates/app_files/app/mailers/user_mailer.rb +10 -0
  97. data/templates/app_files/app/models/admin.rb +42 -0
  98. data/templates/app_files/app/models/audit.rb +4 -0
  99. data/templates/app_files/app/models/concerns/password_creatable.rb +39 -0
  100. data/templates/app_files/app/models/user.rb +43 -0
  101. data/templates/app_files/app/vendor/assets/javascripts/footable.min.js +10 -0
  102. data/templates/{vendor → app_files/app/vendor}/assets/javascripts/jquery.datetimepicker.js +0 -0
  103. data/templates/{vendor → app_files/app/vendor}/assets/javascripts/jquery.maskedinput.min.js +0 -0
  104. data/templates/{vendor → app_files/app/vendor}/assets/javascripts/nprogress.js +0 -0
  105. data/templates/{vendor → app_files/app/vendor}/assets/javascripts/trix.js +0 -0
  106. data/templates/app_files/app/vendor/assets/stylesheets/footable.bootstrap.min.css +1 -0
  107. data/templates/{vendor → app_files/app/vendor}/assets/stylesheets/jquery.datetimepicker.css +0 -0
  108. data/templates/{vendor → app_files/app/vendor}/assets/stylesheets/nprogress.css +0 -1
  109. data/templates/{vendor → app_files/app/vendor}/assets/stylesheets/trix.css +0 -0
  110. data/templates/app_files/app/views/admin_mailer/login_info.html.haml +13 -0
  111. data/templates/app_files/app/views/hq/admins/_admin.html.haml +38 -0
  112. data/templates/{app → app_files/app}/views/hq/admins/_blank.html.haml +3 -3
  113. data/templates/app_files/app/views/hq/admins/_filters.html.haml +27 -0
  114. data/templates/app_files/app/views/hq/admins/_form.html.haml +17 -0
  115. data/templates/app_files/app/views/hq/admins/_list.html.haml +20 -0
  116. data/templates/app_files/app/views/hq/admins/edit.html.haml +3 -0
  117. data/templates/app_files/app/views/hq/admins/index.html.haml +18 -0
  118. data/templates/{app → app_files/app}/views/hq/admins/new.html.haml +2 -2
  119. data/templates/{app → app_files/app}/views/hq/admins/show.html.haml +8 -8
  120. data/templates/app_files/app/views/hq/audits/_filters.html.haml +48 -0
  121. data/templates/app_files/app/views/hq/audits/_list.html.haml +47 -0
  122. data/templates/{app → app_files/app}/views/hq/audits/index.html.haml +3 -3
  123. data/templates/app_files/app/views/hq/audits/show.html.haml +8 -0
  124. data/templates/app_files/app/views/hq/dashboard/index.html.haml +13 -0
  125. data/templates/app_files/app/views/hq/passwords/edit.html.haml +24 -0
  126. data/templates/app_files/app/views/hq/passwords/new.html.haml +21 -0
  127. data/templates/app_files/app/views/hq/registrations/edit.html.haml +30 -0
  128. data/templates/app_files/app/views/hq/sessions/new.html.haml +20 -0
  129. data/templates/{app → app_files/app}/views/hq/users/_blank.html.haml +3 -3
  130. data/templates/app_files/app/views/hq/users/_filters.html.haml +26 -0
  131. data/templates/app_files/app/views/hq/users/_form.html.haml +17 -0
  132. data/templates/app_files/app/views/hq/users/_list.html.haml +21 -0
  133. data/templates/app_files/app/views/hq/users/_user.html.haml +38 -0
  134. data/templates/app_files/app/views/hq/users/edit.html.haml +3 -0
  135. data/templates/app_files/app/views/hq/users/index.html.haml +18 -0
  136. data/templates/{app → app_files/app}/views/hq/users/new.html.haml +2 -2
  137. data/templates/{app → app_files/app}/views/hq/users/show.html.haml +8 -9
  138. data/templates/app_files/app/views/layouts/application.html.haml.erb +33 -0
  139. data/templates/app_files/app/views/layouts/hq/application.html.haml.erb +57 -0
  140. data/templates/app_files/app/views/layouts/hq/login.html.haml.erb +47 -0
  141. data/templates/app_files/app/views/layouts/hq/partials/_breadcrumb.html.haml +3 -0
  142. data/templates/app_files/app/views/layouts/hq/partials/_dock.html.haml +95 -0
  143. data/templates/{app/views/layouts/hq/partials/_footer.html.haml.erb → app_files/app/views/layouts/hq/partials/_footer.html.haml} +0 -0
  144. data/templates/app_files/app/views/layouts/hq/partials/_navbar.html.haml +35 -0
  145. data/templates/app_files/app/views/layouts/hq/partials/_toolbar.html.haml +3 -0
  146. data/templates/{app/views/layouts/hq/partials/_trackers.html.haml.erb → app_files/app/views/layouts/hq/partials/_trackers.html.haml} +0 -0
  147. data/templates/app_files/app/views/layouts/mailer.html.haml.erb +255 -0
  148. data/templates/app_files/app/views/layouts/partials/_messages.html.haml +11 -0
  149. data/templates/app_files/app/views/layouts/partials/_navbar.html.haml.erb +37 -0
  150. data/templates/{app/views/layouts/partials/_footer.html.haml.erb → app_files/app/views/layouts/partials/_warnings.html.haml} +0 -0
  151. data/templates/app_files/app/views/user/dashboard/index.html.haml +11 -0
  152. data/templates/app_files/app/views/user/passwords/edit.html.haml +18 -0
  153. data/templates/app_files/app/views/user/passwords/new.html.haml +18 -0
  154. data/templates/{app → app_files/app}/views/user/profile/_form.html.haml +5 -5
  155. data/templates/app_files/app/views/user/profile/edit.html.haml +3 -0
  156. data/templates/app_files/app/views/user/profile/show.html.haml +18 -0
  157. data/templates/app_files/app/views/user/registrations/edit.html.haml +30 -0
  158. data/templates/app_files/app/views/user/registrations/new.html.haml +33 -0
  159. data/templates/app_files/app/views/user/sessions/new.html.haml +15 -0
  160. data/templates/app_files/app/views/user_mailer/login_info.html.haml +13 -0
  161. data/templates/app_files/app/views/welcome/about.html.haml +3 -0
  162. data/templates/app_files/app/views/welcome/contact.html.haml +3 -0
  163. data/templates/app_files/app/views/welcome/index.html.haml.erb +19 -0
  164. data/templates/app_files/bootstrap_Gemfile.erb +4 -0
  165. data/templates/app_files/breadcrumb_Gemfile.erb +4 -0
  166. data/templates/app_files/jquery_Gemfile.erb +4 -0
  167. data/templates/{public → app_files/public}/images/favicon.png +0 -0
  168. data/templates/{public → app_files/public}/images/mail-logo.png +0 -0
  169. data/templates/basic_authentication/basic_authentication.rb +22 -0
  170. data/templates/basic_authentication/basic_authentication_settings.yml.erb +3 -0
  171. data/templates/basic_authentication/include_module.erb +2 -0
  172. data/templates/basic_authentication/no_basic_authentication.erb +2 -0
  173. data/templates/basic_authentication/yes_basic_authentication.erb +2 -0
  174. data/templates/bullet/bullet_settings.rb.erb +9 -0
  175. data/templates/config/config_application.rb.erb +4 -0
  176. data/templates/config/locales/devise.en.yml +99 -0
  177. data/templates/config/locales/devise.tr.yml +97 -0
  178. data/templates/config/locales/en.yml +34 -0
  179. data/templates/config/locales/mailer.en.yml +32 -0
  180. data/templates/config/locales/{email.tr.yml → mailer.tr.yml} +6 -2
  181. data/templates/config/locales/models.en.yml +74 -0
  182. data/templates/config/locales/models.tr.yml +11 -27
  183. data/templates/config/locales/responders.en.yml +15 -0
  184. data/templates/config/locales/responders.tr.yml +3 -2
  185. data/templates/config/locales/show_for.tr.yml +3 -3
  186. data/templates/config/locales/view.en.yml +73 -0
  187. data/templates/config/locales/view.tr.yml +55 -82
  188. data/templates/config/routes.rb.erb +63 -0
  189. data/templates/cybele_gitignore +4 -3
  190. data/templates/devise/devise_authenticate_admin.rb.erb +2 -0
  191. data/templates/devise/devise_before_action_strong_parameter.rb.erb +3 -0
  192. data/templates/devise/devise_mailer.rb.erb +1 -0
  193. data/templates/devise/devise_strong_parameter.rb.erb +13 -0
  194. data/templates/{app/views/devise → devise/devise_views}/confirmations/new.html.haml +4 -1
  195. data/templates/devise/devise_views/mailer/confirmation_instructions.html.haml +5 -0
  196. data/templates/devise/devise_views/mailer/reset_password_instructions.html.haml +7 -0
  197. data/templates/{app/views/devise → devise/devise_views}/mailer/unlock_instructions.html.haml +1 -1
  198. data/templates/devise/devise_views/passwords/edit.html.haml +19 -0
  199. data/templates/devise/devise_views/passwords/new.html.haml +14 -0
  200. data/templates/devise/devise_views/registrations/edit.html.haml +21 -0
  201. data/templates/devise/devise_views/registrations/new.html.haml +32 -0
  202. data/templates/{app/views/devise → devise/devise_views}/sessions/new.html.haml +8 -3
  203. data/templates/devise/devise_views/shared/_links.haml +29 -0
  204. data/templates/{app/views/devise → devise/devise_views}/unlocks/new.html.haml +4 -1
  205. data/templates/devise/seeds.rb.erb +1 -0
  206. data/templates/docker/Dockerfile.erb +48 -0
  207. data/templates/docker/docker-compose.yml.erb +46 -0
  208. data/templates/docker/docker_env_local_sample.erb +6 -0
  209. data/templates/docker/docker_env_local_sample_host.erb +1 -0
  210. data/templates/docker/docker_env_local_sample_sidekiq.erb +2 -0
  211. data/templates/docker/docker_env_staging_production_sidekiq.erb +2 -0
  212. data/templates/docker/start-app.sh.erb +7 -0
  213. data/templates/docker/start-sidekiq.sh.erb +27 -0
  214. data/templates/dotenv/.env.local.erb +5 -0
  215. data/templates/dotenv/.env.production.erb +5 -0
  216. data/templates/dotenv/.env.sample.erb +5 -0
  217. data/templates/dotenv/.env.staging.erb +5 -0
  218. data/templates/dotenv/dotenv_Gemfile.erb +2 -0
  219. data/templates/error_pages/error_control.erb +7 -0
  220. data/templates/error_pages/error_method.erb +10 -0
  221. data/templates/error_pages/error_route.erb.rb +2 -0
  222. data/templates/error_pages/internal_server_error.html.haml +2 -0
  223. data/templates/error_pages/not_found.html.haml +2 -0
  224. data/templates/guardfile/guardfile_settings.rb.erb +49 -0
  225. data/templates/haml/haml_Gemfile.erb +5 -0
  226. data/templates/mailer/.env.local.erb +7 -0
  227. data/templates/mailer/host.rb.erb +2 -0
  228. data/templates/mailer/mailer_settings.yml.erb +8 -0
  229. data/templates/mailer/smtp.rb.erb +10 -0
  230. data/templates/paperclip/paperclip.rb.erb +11 -0
  231. data/templates/paperclip/paperclip_Gemfile.erb +4 -0
  232. data/templates/paperclip/paperclip_env_local.erb +6 -0
  233. data/templates/paperclip/paperclip_env_production.erb +6 -0
  234. data/templates/paperclip/paperclip_env_sample.erb +6 -0
  235. data/templates/paperclip/paperclip_env_staging.erb +6 -0
  236. data/templates/paperclip/paperclip_settings.yml.erb +10 -0
  237. data/templates/postgresql_database.yml.erb +24 -0
  238. data/templates/pronto/.flayignore.erb +5 -0
  239. data/templates/pronto/.haml-lint.yml.erb +5 -0
  240. data/templates/pronto/.rubocop.yml.erb +38 -0
  241. data/templates/pronto/config.reek.erb +42 -0
  242. data/templates/pronto/example.pronto.yml.erb +27 -0
  243. data/templates/pronto/rubo.erb +24 -0
  244. data/templates/recipient_interceptor/recipient_interceptor_settings.yml.erb +4 -0
  245. data/templates/recipient_interceptor/recipient_interceptor_staging.rb.erb +2 -0
  246. data/templates/responders/responders_Gemfile.erb +3 -0
  247. data/templates/ruby-version +1 -1
  248. data/templates/secrets.yml.erb +3 -0
  249. data/templates/settings.yml.erb +1 -0
  250. data/templates/show_for/show_for_Gemfile.erb +3 -0
  251. data/templates/sidekiq/sidekiq.rake.erb +42 -0
  252. data/templates/sidekiq/sidekiq.rb.erb +18 -0
  253. data/templates/sidekiq/sidekiq.yml.erb +18 -0
  254. data/templates/sidekiq/sidekiq_Gemfile.erb +8 -0
  255. data/templates/{Procfile.erb → sidekiq/sidekiq_Procfile.erb} +0 -0
  256. data/templates/sidekiq/sidekiq_application.rb.erb +3 -0
  257. data/templates/sidekiq/sidekiq_routes_mount.erb +8 -0
  258. data/templates/sidekiq/sidekiq_routes_require.erb +3 -0
  259. data/templates/{config/schedule.yml → sidekiq/sidekiq_schedule.yml.erb} +6 -4
  260. data/templates/simple_form/simple_form_Gemfile.erb +3 -0
  261. data/templates/ssl/ssl_env_all.erb +2 -0
  262. metadata +369 -179
  263. data/templates/.env.local.erb +0 -11
  264. data/templates/.env.production.erb +0 -11
  265. data/templates/.env.staging.erb +0 -11
  266. data/templates/app/assets/javascripts/application.js.coffee +0 -81
  267. data/templates/app/assets/javascripts/hq/application.js.coffee +0 -94
  268. data/templates/app/assets/stylesheets/hq/application.css.sass +0 -92
  269. data/templates/app/controllers/application_controller.rb.erb +0 -48
  270. data/templates/app/controllers/concerns/basic_authentication.rb +0 -18
  271. data/templates/app/controllers/hq/application_controller.rb +0 -18
  272. data/templates/app/controllers/hq/cities_controller.rb +0 -54
  273. data/templates/app/controllers/hq/countries_controller.rb +0 -54
  274. data/templates/app/controllers/hq/dashboard_controller.rb +0 -8
  275. data/templates/app/controllers/hq/registrations_controller.rb +0 -21
  276. data/templates/app/controllers/user/dashboard_controller.rb +0 -8
  277. data/templates/app/controllers/user/profile_controller.rb +0 -34
  278. data/templates/app/controllers/user/user_application_controller.rb +0 -26
  279. data/templates/app/controllers/welcome_controller.rb +0 -4
  280. data/templates/app/helpers/application_helper.rb.erb +0 -27
  281. data/templates/app/mailers/admin_mailer.rb +0 -10
  282. data/templates/app/mailers/base_mailer.rb +0 -4
  283. data/templates/app/mailers/user_mailer.rb +0 -10
  284. data/templates/app/models/admin.rb +0 -51
  285. data/templates/app/models/audit.rb +0 -3
  286. data/templates/app/models/city.rb +0 -12
  287. data/templates/app/models/country.rb +0 -12
  288. data/templates/app/models/user.rb +0 -54
  289. data/templates/app/views/admin_mailer/login_info.html.haml +0 -13
  290. data/templates/app/views/devise/mailer/confirmation_instructions.html.haml +0 -6
  291. data/templates/app/views/devise/mailer/reset_password_instructions.html.haml +0 -9
  292. data/templates/app/views/devise/passwords/edit.html.haml +0 -11
  293. data/templates/app/views/devise/passwords/new.html.haml +0 -9
  294. data/templates/app/views/devise/registrations/edit.html.haml +0 -12
  295. data/templates/app/views/devise/registrations/new.html.haml +0 -24
  296. data/templates/app/views/devise/shared/_links.haml +0 -22
  297. data/templates/app/views/errors/internal_server_error.html.haml +0 -2
  298. data/templates/app/views/errors/not_found.html.haml +0 -2
  299. data/templates/app/views/hq/admins/_admin.html.haml +0 -21
  300. data/templates/app/views/hq/admins/_filters.html.haml +0 -20
  301. data/templates/app/views/hq/admins/_form.html.haml +0 -17
  302. data/templates/app/views/hq/admins/_list.html.haml +0 -15
  303. data/templates/app/views/hq/admins/edit.html.haml +0 -3
  304. data/templates/app/views/hq/admins/index.html.haml +0 -18
  305. data/templates/app/views/hq/audits/_filters.html.haml +0 -32
  306. data/templates/app/views/hq/audits/_list.html.haml +0 -37
  307. data/templates/app/views/hq/audits/show.html.haml +0 -5
  308. data/templates/app/views/hq/cities/_blank.html.haml +0 -9
  309. data/templates/app/views/hq/cities/_city.html.haml +0 -12
  310. data/templates/app/views/hq/cities/_filters.html.haml +0 -15
  311. data/templates/app/views/hq/cities/_form.html.haml +0 -15
  312. data/templates/app/views/hq/cities/_list.html.haml +0 -13
  313. data/templates/app/views/hq/cities/edit.html.haml +0 -3
  314. data/templates/app/views/hq/cities/index.html.haml +0 -18
  315. data/templates/app/views/hq/cities/new.html.haml +0 -3
  316. data/templates/app/views/hq/cities/show.html.haml +0 -13
  317. data/templates/app/views/hq/countries/_blank.html.haml +0 -9
  318. data/templates/app/views/hq/countries/_country.html.haml +0 -11
  319. data/templates/app/views/hq/countries/_filters.html.haml +0 -14
  320. data/templates/app/views/hq/countries/_form.html.haml +0 -14
  321. data/templates/app/views/hq/countries/_list.html.haml +0 -12
  322. data/templates/app/views/hq/countries/edit.html.haml +0 -3
  323. data/templates/app/views/hq/countries/index.html.haml +0 -18
  324. data/templates/app/views/hq/countries/new.html.haml +0 -3
  325. data/templates/app/views/hq/countries/show.html.haml +0 -14
  326. data/templates/app/views/hq/dashboard/index.html.haml +0 -8
  327. data/templates/app/views/hq/passwords/edit.html.haml +0 -12
  328. data/templates/app/views/hq/passwords/new.html.haml +0 -9
  329. data/templates/app/views/hq/registrations/edit.html.haml +0 -19
  330. data/templates/app/views/hq/sessions/new.html.haml +0 -11
  331. data/templates/app/views/hq/users/_filters.html.haml +0 -20
  332. data/templates/app/views/hq/users/_form.html.haml +0 -18
  333. data/templates/app/views/hq/users/_list.html.haml +0 -15
  334. data/templates/app/views/hq/users/_user.html.haml +0 -20
  335. data/templates/app/views/hq/users/edit.html.haml +0 -3
  336. data/templates/app/views/hq/users/index.html.haml +0 -18
  337. data/templates/app/views/layouts/application.html.haml.erb +0 -56
  338. data/templates/app/views/layouts/hq/application.html.haml.erb +0 -55
  339. data/templates/app/views/layouts/hq/login.html.haml.erb +0 -35
  340. data/templates/app/views/layouts/hq/partials/_dock.html.haml.erb +0 -36
  341. data/templates/app/views/layouts/hq/partials/_navbar.html.haml.erb +0 -22
  342. data/templates/app/views/layouts/mailer.html.haml.erb +0 -321
  343. data/templates/app/views/layouts/mailer.text.haml +0 -1
  344. data/templates/app/views/layouts/partials/_trackers.html.haml.erb +0 -0
  345. data/templates/app/views/layouts/partials/_warnings.html.haml.erb +0 -3
  346. data/templates/app/views/user/dashboard/index.html.haml +0 -8
  347. data/templates/app/views/user/passwords/edit.html.haml +0 -12
  348. data/templates/app/views/user/passwords/new.html.haml +0 -10
  349. data/templates/app/views/user/profile/edit.html.haml +0 -3
  350. data/templates/app/views/user/profile/show.html.haml +0 -18
  351. data/templates/app/views/user/registrations/edit.html.haml +0 -19
  352. data/templates/app/views/user/sessions/new.html.haml +0 -11
  353. data/templates/app/views/user_mailer/login_info.html.haml +0 -13
  354. data/templates/app/views/welcome/index.html.haml.erb +0 -16
  355. data/templates/config/database.yml.erb +0 -21
  356. data/templates/config/deploy.rb +0 -56
  357. data/templates/config/initializers/devise_async.rb +0 -6
  358. data/templates/config/initializers/disable_xml_params.rb +0 -3
  359. data/templates/config/initializers/mail.rb +0 -13
  360. data/templates/config/initializers/paperclip.rb +0 -10
  361. data/templates/config/initializers/secret_token.erb +0 -25
  362. data/templates/config/initializers/show_for.rb +0 -3
  363. data/templates/config/initializers/sidekiq.rb +0 -13
  364. data/templates/config/initializers/simple_form.rb +0 -142
  365. data/templates/config/initializers/simple_form_bootstrap.rb +0 -207
  366. data/templates/config/routes.erb +0 -51
  367. data/templates/config/settings.yml +0 -0
  368. data/templates/config/settings/production.yml +0 -0
  369. data/templates/config/settings/staging.yml +0 -0
  370. data/templates/config/sidekiq.yml +0 -13
  371. data/templates/cybele_Gemfile +0 -106
  372. data/templates/cybele_version.txt +0 -1
  373. data/templates/env.sample.erb +0 -11
  374. data/templates/lib/application_responder.rb +0 -8
  375. data/templates/lib/data/cities.yml +0 -163
  376. data/templates/lib/tasks/annotate.rake +0 -6
  377. data/templates/lib/tasks/dev.rake +0 -56
  378. data/templates/lib/tasks/sidekiq.rake +0 -26
  379. data/templates/lib/templates/rails/responders_controller/controller.rb +0 -56
  380. data/templates/public/images/missing_cover.png +0 -0
  381. data/templates/public/images/missing_cover@2x.png +0 -0
  382. data/templates/public/images/missing_logo.png +0 -0
  383. data/templates/public/images/missing_logo@2x.png +0 -0
  384. data/templates/public/images/sprite.png +0 -0
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in cybele.gemspec
data/README.md CHANGED
@@ -13,8 +13,8 @@ western colonies from around the 6th century BCE.
13
13
 
14
14
  Before generating your application, you will need:
15
15
 
16
- * Ruby ~> 2.3
17
- * Rails ~> 4.2
16
+ * Ruby ~> 2.3.5
17
+ * Rails ~> 5.1.4
18
18
 
19
19
  ## Usage
20
20
 
@@ -24,30 +24,21 @@ First you should install the cybele gem than you can use it for creating new gem
24
24
  gem install cybele
25
25
  cybele project_name
26
26
  ```
27
+
27
28
 
28
29
  When the initialization is completed, there will be some required settings.
29
30
 
30
31
  * Set .env.local variables
31
- * Set access_token in config/initializers/rollbar.rb
32
- * Set default values for is_active, time_zone variable using in User and Admin model migrations db/migrate/*.rb
33
- * Change username and password in config/settings.yml
34
- * In public folder run this command ln -s ../VERSION.txt VERSION.txt
35
-
36
- We are using sidekiq with redis-server for background jobs.
37
- Before the run application look our env.sample file. It should be in project root directory with this name .env.local
38
- ```bash
39
- bundle
40
- redis-server
41
- rake sidekiq:start
42
- rake db:create
43
- rake db:migrate
44
- rake dev:seed
45
- rails s
46
- ```
32
+ * If you don't want to use Rollbar in development environment, you can disable for development environment in config/initializers/rollbar.rb
33
+ * Change username and passwords in config/settings.yml
47
34
 
48
35
  ## What cybele do and included?
49
36
 
50
- Let's look the [Gemfile](https://raw.github.com/lab2023/cybele/develop/templates/cybele_Gemfile) which created by cybele.
37
+ Let's look options
38
+
39
+ ```ruby
40
+ cybele --help
41
+ ```
51
42
 
52
43
  ## Bugs and Feedback
53
44
 
@@ -55,6 +46,11 @@ If you discover any bugs or want to drop a line, feel free to create an issue on
55
46
 
56
47
  http://github.com/lab2023/cybele/issues
57
48
 
49
+ ## Development
50
+ * Clone project
51
+ * Run: brew install cmake
52
+ * Run: bundle
53
+
58
54
  ## Contributing
59
55
 
60
56
  Cybele uses [rDoc](http://rubydoc.info/gems/cybele) and [SemVer](http://semver.org/), and takes it seriously.
@@ -78,4 +74,4 @@ Once you've made your great commits:
78
74
 
79
75
  ## License
80
76
 
81
- Copyright © 2013-2015 [lab2023 - information technologies](http://lab2023.com)
77
+ Copyright © 2013-2015 [lab2023 - information technologies](http://lab2023.com)
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rdoc/task'
data/USAGE ADDED
@@ -0,0 +1,12 @@
1
+ Description:
2
+ Cybele is a Rails template with Lab2023 standard
3
+ defaults.
4
+
5
+ For full details check our GitHub project:
6
+ https://github.com/kebab-project/cybele
7
+
8
+ Example:
9
+ cybele ~/Workplace/blog
10
+
11
+ This generates a Rails installation in ~/Workplace/blog configured
12
+ with our preferred defaults.
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Build cybele gem
4
+ echo "Build cybele gem"
5
+ ./bin/build_gem
6
+
7
+ # Remove dummy_app_3
8
+ echo "Remove dummy_app_3"
9
+ rm -rf tmp/dummy_app_3
10
+
11
+ # Disable spring
12
+ export DISABLE_SPRING=1
13
+ # or you can run this command
14
+ # ps ax | grep spring | grep dummy_app_3 | cut -f1 -d' ' | xargs kill
15
+
16
+ # Create dummy_app_3
17
+ echo "Create dummy_app_3"
18
+ cybele tmp/dummy_app_3 --skip-create-database
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Remove previous built file
4
+ echo "Remove previous built file"
5
+ rm -rf cybele-2.*.gem
6
+
7
+ # Build gemspec
8
+ echo "Build gemspec"
9
+ gem build cybele.gemspec
10
+
11
+ # Install built gem file
12
+ echo "Install gem"
13
+ gem install cybele-2.*.gem
14
+
15
+ # Show cybele help
16
+ echo "Show cybele help"
17
+ cybele --help
18
+
19
+ # Print cybele version
20
+ echo "Cybele version: `cybele -v`"
data/bin/cybele CHANGED
@@ -1,9 +1,24 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require File.expand_path(File.join('..', 'lib', 'cybele', 'generators', 'app_generator'), File.dirname(__FILE__))
4
- require File.expand_path(File.join('..', 'lib', 'cybele', 'app_builder'), File.dirname(__FILE__))
4
+ require 'pathname'
5
5
 
6
- templates_root = File.expand_path(File.join('..', 'templates'), File.dirname(__FILE__))
7
- Cybele::AppGenerator.source_root templates_root
8
- Cybele::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
9
- Cybele::AppGenerator.start
6
+ source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
7
+ $LOAD_PATH << source_path
8
+
9
+ require 'cybele'
10
+
11
+ if ARGV.empty?
12
+ puts 'Please provide a path for the new application'
13
+ puts
14
+ puts 'See --help for more info'
15
+ exit 0
16
+ elsif %w[-v --version].include? ARGV[0]
17
+ puts Cybele::VERSION
18
+ exit 0
19
+ end
20
+
21
+ root = File.expand_path(File.join('..', 'templates'), File.dirname(__FILE__))
22
+ Cybele::AppGenerator.source_root root
23
+ Cybele::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << root
24
+ Cybele::AppGenerator.start
@@ -0,0 +1,29 @@
1
+ "lib/cybele/":
2
+ IrresponsibleModule:
3
+ enabled: false
4
+ "templates/":
5
+ IrresponsibleModule:
6
+ enabled: false
7
+ "templates/app_files/app/controllers/":
8
+ InstanceVariableAssumption:
9
+ enabled: false
10
+ IrresponsibleModule:
11
+ enabled: false
12
+ "templates/app_files/app/mailers":
13
+ InstanceVariableAssumption:
14
+ enabled: false
15
+ IrresponsibleModule:
16
+ enabled: false
17
+
18
+ DuplicateMethodCall:
19
+ enabled: false
20
+
21
+ FeatureEnvy:
22
+ enabled: false
23
+
24
+ UtilityFunction:
25
+ public_methods_only: true
26
+
27
+ TooManyStatements:
28
+ enabled: true
29
+ max_statements: 6
@@ -1,8 +1,10 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require File.expand_path('../lib/cybele/version', __FILE__)
5
6
  require 'date'
7
+ require 'English'
6
8
 
7
9
  Gem::Specification.new do |spec|
8
10
  spec.required_ruby_version = ">= #{Cybele::RUBY_VERSION}"
@@ -11,19 +13,25 @@ Gem::Specification.new do |spec|
11
13
  spec.version = Cybele::VERSION
12
14
  spec.authors = %w[lab2023]
13
15
  spec.email = %w[info@lab2023.com]
14
- spec.description = %q{Rails 4.x template with responder, simple form, haml, exception notification, etc etc ...}
15
- spec.summary = %q{Rails 4.x template with responder, simple form, haml, exception notification, etc etc ...}
16
+ spec.description = 'Rails 5.x App template'
17
+ spec.summary = 'Rails 5.x template with responder, simple form, haml, exception notification, etc etc ...'
16
18
  spec.homepage = 'https://github.com/kebab-project/cybele'
17
19
  spec.license = 'MIT'
18
20
  spec.date = Date.today.strftime('%Y-%m-%d')
19
- spec.files = `git ls-files`.split($/)
21
+ spec.files = `git ls-files`.split($RS)
20
22
  spec.executables = %w[cybele]
21
23
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
24
  spec.require_paths = %w[lib]
23
25
 
24
- spec.add_development_dependency 'rake'
25
26
  spec.add_dependency 'bundler', '~> 1.5'
26
- spec.add_dependency 'rails', Cybele::RAILS_VERSION
27
+ spec.add_runtime_dependency 'rails', '~> 5.0', Cybele::RAILS_VERSION
28
+ spec.add_development_dependency 'pronto', '~> 0.9.5'
29
+ spec.add_development_dependency 'pronto-fasterer', '~> 0.9.0'
30
+ spec.add_development_dependency 'pronto-flay', '~> 0.9.0'
31
+ spec.add_development_dependency 'pronto-reek', '~> 0.9.0'
32
+ spec.add_development_dependency 'pronto-rubocop', '~> 0.9.0'
33
+ spec.add_development_dependency 'rspec', '~> 3.5'
34
+ spec.add_development_dependency 'thor', '~> 0.19.4'
27
35
 
28
36
  spec.extra_rdoc_files = %w[README.md MIT-LICENSE]
29
37
  end
@@ -0,0 +1,8 @@
1
+ all:
2
+ exclude:
3
+ - 'spec/**/*'
4
+ bitbucket:
5
+ slug: 'lab2023corp/cybele'
6
+ username: 'username'
7
+ password: 'password'
8
+ max_warnings: 150
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cybele/version'
4
+ require 'cybele/generators/app_generator'
5
+ require 'cybele/helpers'
6
+ require 'cybele/helpers/staging'
7
+ require 'cybele/helpers/sidekiq'
8
+ require 'cybele/helpers/responders'
9
+ require 'cybele/helpers/simple_form'
10
+ require 'cybele/helpers/dotenv'
11
+ require 'cybele/helpers/show_for'
12
+ require 'cybele/helpers/recipient_interceptor'
13
+ require 'cybele/helpers/haml'
14
+ require 'cybele/helpers/locale_language'
15
+ require 'cybele/helpers/mailer'
16
+ require 'cybele/helpers/paperclip'
17
+ require 'cybele/helpers/devise'
18
+ require 'cybele/helpers/docker'
19
+ require 'cybele/helpers/error_pages'
20
+ require 'cybele/helpers/audited'
21
+ require 'cybele/helpers/routes'
22
+ require 'cybele/helpers/general'
23
+ require 'cybele/helpers/basic_authentication'
24
+ require 'cybele/helpers/app_files/assets_files'
25
+ require 'cybele/helpers/app_files/controller_files'
26
+ require 'cybele/helpers/app_files/model_files'
27
+ require 'cybele/helpers/app_files/vendor_files'
28
+ require 'cybele/helpers/app_files/mailer_files'
29
+ require 'cybele/helpers/app_files/helper_files'
30
+ require 'cybele/helpers/app_files/view_files'
31
+ require 'cybele/helpers/app_files/view_gems'
32
+ require 'cybele/helpers/pronto'
33
+ require 'cybele/app_builder'
@@ -1,57 +1,35 @@
1
- module Cybele
2
-
3
- class AppBuilder < Rails::AppBuilder
4
-
5
- def readme
6
- template 'README.md.erb', 'README.md', force: true
7
- end
8
-
9
- def remove_readme_rdoc
10
- remove_file 'README.rdoc', force: true
11
- end
12
-
13
- def replace_gemfile
14
- remove_file 'Gemfile', force: true
15
- copy_file 'cybele_Gemfile', 'Gemfile'
16
- end
17
-
18
- def add_editorconfig
19
- copy_file 'editorconfig', '.editorconfig'
20
- end
21
-
22
- def add_ruby_version
23
- copy_file 'ruby-version', '.ruby-version'
24
- end
25
-
26
- def add_disable_xml_params
27
- copy_file 'config/initializers/disable_xml_params.rb', 'config/initializers/disable_xml_params.rb'
28
- end
29
-
30
- def add_paperclip_aws
31
- copy_file 'config/initializers/paperclip.rb', 'config/initializers/paperclip.rb'
32
- end
33
-
34
- def replace_erb_with_haml
35
- remove_file 'app/views/layouts/application.html.erb', force: true
36
- template 'app/views/layouts/application.html.haml.erb', 'app/views/layouts/application.html.haml', force: true
37
- end
38
-
39
- def install_responder_gem
40
- copy_file 'lib/application_responder.rb', 'lib/application_responder.rb'
41
- remove_file 'app/controllers/application_controller.rb', force: true
42
- copy_file 'app/controllers/application_controller.rb', 'app/controllers/application_controller.rb'
43
- copy_file 'app/controllers/concerns/basic_authentication.rb', 'app/controllers/concerns/basic_authentication.rb'
44
- copy_file 'lib/templates/rails/responders_controller/controller.rb', 'lib/templates/rails/responders_controller/controller.rb'
45
- copy_file 'config/locales/responders.tr.yml', 'config/locales/responders.tr.yml'
46
- end
47
-
48
- def replace_database_yml
49
- template 'config/database.yml.erb', 'config/database.yml', force: true
50
- end
1
+ # frozen_string_literal: true
51
2
 
52
- def create_database
53
- bundle_command 'exec rake db:create'
54
- end
3
+ module Cybele
4
+ class AppBuilder < Rails::AppBuilder # rubocop:disable Metrics/ClassLength
5
+ include Cybele::Helpers
6
+ include Cybele::Helpers::Staging
7
+ include Cybele::Helpers::Sidekiq
8
+ include Cybele::Helpers::Responders
9
+ include Cybele::Helpers::SimpleForm
10
+ include Cybele::Helpers::Dotenv
11
+ include Cybele::Helpers::RecipientInterceptor
12
+ include Cybele::Helpers::ShowFor
13
+ include Cybele::Helpers::Haml
14
+ include Cybele::Helpers::LocaleLanguage
15
+ include Cybele::Helpers::Mailer
16
+ include Cybele::Helpers::Paperclip
17
+ include Cybele::Helpers::Devise
18
+ include Cybele::Helpers::ErrorPages
19
+ include Cybele::Helpers::Audited
20
+ include Cybele::Helpers::Routes
21
+ include Cybele::Helpers::BasicAuthentication
22
+ include Cybele::Helpers::AppFiles::AssetsFiles
23
+ include Cybele::Helpers::AppFiles::ControllerFiles
24
+ include Cybele::Helpers::AppFiles::ModelFiles
25
+ include Cybele::Helpers::AppFiles::VendorFiles
26
+ include Cybele::Helpers::AppFiles::MailerFiles
27
+ include Cybele::Helpers::AppFiles::HelperFiles
28
+ include Cybele::Helpers::AppFiles::ViewFiles
29
+ include Cybele::Helpers::AppFiles::ViewGems
30
+ include Cybele::Helpers::Docker
31
+ include Cybele::Helpers::Pronto
32
+ include Cybele::Helpers::General
55
33
 
56
34
  def setup_gitignore_files
57
35
  remove_file '.gitignore', force: true
@@ -59,7 +37,7 @@ module Cybele
59
37
  end
60
38
 
61
39
  def setup_gitignore_folders
62
- %w(
40
+ %w[
63
41
  app/assets/images
64
42
  db/migrate
65
43
  spec/support
@@ -68,467 +46,22 @@ module Cybele
68
46
  spec/views
69
47
  spec/controllers
70
48
  spec/helpers
71
- ).each do |dir|
49
+ ].each do |dir|
72
50
  empty_directory_with_keep_file dir
73
51
  end
74
52
  end
75
53
 
76
- def setup_asset_precompile
77
- config = <<-RUBY
78
- config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
79
- config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
80
- config.sass.preferred_syntax = :sass
81
- config.i18n.default_locale = :tr
82
- config.time_zone = 'Istanbul'
83
- config.i18n.fallbacks = true
84
- config.active_job.queue_adapter = :sidekiq
85
- RUBY
86
- inject_into_file 'config/application.rb', config, after: '# config.i18n.default_locale = :de'
87
- end
88
-
89
- def convert_application_js_to_coffee
90
- remove_file 'app/assets/javascripts/application.js', force: true
91
- copy_file 'app/assets/javascripts/application.js.coffee', 'app/assets/javascripts/application.js.coffee'
92
- end
93
-
94
- def convert_application_css_to_sass
95
- remove_file 'app/assets/stylesheets/application.css', force: true
96
- copy_file 'app/assets/stylesheets/application.css.sass', 'app/assets/stylesheets/application.css.sass'
97
- end
98
-
99
- def copy_vendor_assets
100
- directory 'vendor/assets', 'vendor/assets'
101
- end
102
-
103
- def configure_smtp
104
- remove_file 'config/settings/production.yml', force: true
105
- copy_file 'config/settings/production.yml', 'config/settings/production.yml'
106
- copy_file 'config/settings/staging.yml', 'config/settings/staging.yml'
107
-
108
- config = <<-RUBY
109
- Mail.register_interceptor RecipientInterceptor.new(Settings.email.sandbox, subject_prefix: '[STAGING]')
110
- RUBY
111
- configure_environment 'staging', config
112
-
113
- config = <<-RUBY
114
- config.action_mailer.delivery_method = :smtp
115
- config.action_mailer.raise_delivery_errors = false
116
- config.action_mailer.smtp_settings = {
117
- address: Settings.smtp.address,
118
- port: Settings.smtp.port,
119
- enable_starttls_auto: Settings.smtp.enable_starttls_auto,
120
- user_name: Settings.smtp.user_name,
121
- password: Settings.smtp.password,
122
- authentication: Settings.smtp.authentication
123
- }
124
- RUBY
125
- configure_environment 'production', config
126
- configure_environment 'staging', config
127
- end
128
-
129
- def configure_bullet
130
- config = <<-RUBY
131
- config.after_initialize do
132
- Bullet.enable = true
133
- Bullet.alert = true
134
- Bullet.bullet_logger = true
135
- Bullet.console = true
136
- Bullet.rails_logger = true
137
- Bullet.add_footer = false
138
- end
139
- RUBY
140
- configure_environment 'development', config
141
- end
142
-
143
- def setup_staging_environment
144
- run 'cp config/environments/production.rb config/environments/staging.rb'
145
- config = <<-YML
146
- email:
147
- sandbox: sandbox@#{app_name}.com
148
- noreply: no-reply@#{app_name}.com
149
- admin: admin@#{app_name}.com
150
-
151
- basic_auth:
152
- username: #{app_name}
153
- password: #{app_name}
154
-
155
- sidekiq:
156
- username: #{app_name}
157
- password: #{app_name}
158
-
159
- root_path: <%= ENV['ROOT_PATH'] %>
160
-
161
- smtp:
162
- address: <%= ENV['SMTP_ADDRESS'] %>
163
- port: 587
164
- enable_starttls_auto: true
165
- user_name: <%= ENV['SMTP_USER_NAME'] %>
166
- password: <%= ENV['SMTP_PASSWORD'] %>
167
- authentication: 'plain'
168
-
169
- AWS:
170
- S3:
171
- bucket: <%= ENV['S3_BUCKET_NAME'] %>
172
- access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
173
- secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
174
- aws_url: http://<%= ENV['AWS_RAW_URL'] %>
175
- aws_raw_url: <%= ENV['AWS_RAW_URL'] %>
176
- # Bucket region should be ireland for this setting
177
- end_point: s3-eu-west-1.amazonaws.com
178
- YML
179
- prepend_file 'config/settings.yml', config
180
- end
181
-
182
- def configure_action_mailer
183
- action_mailer_host 'development'
184
- action_mailer_host 'staging'
185
- action_mailer_host 'production'
186
- end
187
-
188
- def setup_letter_opener
189
- config = <<-RUBY
190
- config.action_mailer.delivery_method = :letter_opener
191
- RUBY
192
- configure_environment 'development', config
193
- end
194
-
195
- def generate_rspec
196
- generate 'rspec:install'
197
- end
198
-
199
- def generate_capybara
200
- inject_into_file 'spec/spec_helper.rb', after: "require 'rspec/autorun'" do <<-CODE
201
- require 'capybara/rspec'
202
- CODE
203
- end
204
- inject_into_file 'spec/spec_helper.rb', after: ' config.order = "random"' do <<-CODE
205
- # Capybara DSL
206
- config.include Capybara::DSL
207
- CODE
208
- end
209
- end
210
-
211
- def generate_factory_girl
212
- inject_into_file 'spec/spec_helper.rb', after: ' config.include Capybara::DSL' do <<-CODE
213
- # Factory girl
214
- config.include FactoryGirl::Syntax::Methods
215
- CODE
216
- end
217
- end
218
-
219
- def generate_simple_form
220
- generate 'simple_form:install --bootstrap --force'
221
- copy_file 'config/locales/simple_form.tr.yml', 'config/locales/simple_form.tr.yml'
222
- copy_file 'config/locales/tr.yml', 'config/locales/tr.yml'
223
- end
224
-
225
- def generate_exception_notification
226
- generate 'exception_notification:install'
227
- generate 'rollbar your_token'
228
- end
229
-
230
- def add_exception_notification_to_environments
231
- config = <<-CODE
232
- config.middleware.use ExceptionNotification::Rack,
233
- email: {
234
- email_prefix: "[#{app_name}]",
235
- sender_address: %{"Notifier" <notifier@#{app_name}.com>},
236
- exception_recipients: %w{your_email@address.com}
237
- }
238
- CODE
239
- configure_environment('production', config)
240
- configure_environment('staging', config)
241
- inject_into_file 'config/initializers/exception_notification.rb', before: 'config.add_notifier :email, {' do <<-RUBY
242
- unless Rails.env == 'development'
243
- RUBY
244
- end
245
- inject_into_file 'config/initializers/exception_notification.rb', before: '# Campfire notifier sends notifications to your Campfire room.' do <<-RUBY
246
- end
247
- RUBY
248
- end
249
- end
250
-
251
- def generate_rails_config
252
- generate 'rails_config:install'
253
- end
254
-
255
- def generate_devise_settings
256
- generate 'devise:install'
257
- gsub_file 'config/initializers/filter_parameter_logging.rb', /:password/, ':password, :password_confirmation'
258
- gsub_file 'config/initializers/devise.rb', /please-change-me-at-config-initializers-devise@example.com/, "no-reply@#{app_name}.com"
259
- inject_into_file 'config/initializers/devise.rb', after: "# config.mailer = 'Devise::Mailer'\n" do <<-RUBY
260
- Devise::Mailer.layout 'mailer'
261
- RUBY
262
- end
263
- end
264
-
265
- def generate_devise_user
266
- generate 'devise User name:string surname:string is_active:boolean time_zone:string'
267
- generate_devise_strong_parameters('user')
268
- remove_file 'config/locales/devise.en.yml', force: true
269
- end
270
-
271
- def generate_devise_views
272
- directory 'app/views/devise', 'app/views/devise'
273
- end
274
-
275
- def generate_welcome_page
276
- copy_file 'app/controllers/welcome_controller.rb', 'app/controllers/welcome_controller.rb'
277
- template 'app/views/welcome/index.html.haml.erb', 'app/views/welcome/index.html.haml', force: true
278
- end
279
-
280
- def setup_namespaces
281
- generate 'devise Admin name:string surname:string is_active:boolean time_zone:string'
282
-
283
- directory 'app/controllers/hq', 'app/controllers/hq'
284
- directory 'app/views/hq', 'app/views/hq'
285
-
286
- # User controllers
287
- directory 'app/controllers/user', 'app/controllers/user'
288
- directory 'app/views/user', 'app/views/user'
289
-
290
- end
291
-
292
- def create_hierapolis_theme
293
- remove_file 'lib/templates/rails/responders_controller/controller.rb', force: true
294
- remove_file 'lib/templates/haml/scaffold/_form.html.haml', force: true
295
- generate 'hierapolis:install'
296
- end
297
-
298
- def replace_simple_form_wrapper
299
- remove_file 'config/initializers/simple_form.rb', force: true
300
- remove_file 'config/initializers/simple_form_bootstrap.rb', force: true
301
-
302
- copy_file 'config/initializers/simple_form.rb', 'config/initializers/simple_form.rb'
303
- copy_file 'config/initializers/simple_form_bootstrap.rb', 'config/initializers/simple_form_bootstrap.rb'
304
- end
305
-
306
- def setup_capistrano
307
- run 'bundle exec cap install'
308
- end
309
-
310
- def setup_capistrano_settings
311
- run 'rm config/deploy.rb'
312
- # Copy teplates/config/deploy.rb to app directory
313
- copy_file 'config/deploy.rb', 'config/deploy.rb'
314
- # Change my_app_name string in the deploy.rb file with app_name that is created
315
- gsub_file 'config/deploy.rb', /my_app_name/, "#{app_name}"
316
-
317
- inject_into_file 'Capfile', after: "require 'capistrano/deploy'\n" do <<-RUBY
318
- require 'capistrano/rails'
319
- require 'capistrano/bundler'
320
- require 'sshkit/sudo'
321
- require 'capistrano/maintenance'
322
- RUBY
323
- end
324
-
325
- append_to_file 'config/deploy/production.rb' do
326
- 'server "example.com", user: "#{fetch(:local_user)}", roles: %w{app db web}, primary: true, port: 22
327
- set :rails_env, "production"
328
- set :branch, "master"
329
- set :project_domain, "example.com"'
330
- end
331
- append_to_file 'config/deploy/staging.rb' do
332
- 'server "staging.example.com", user: "#{fetch(:local_user)}", roles: %w{app db web}, primary: true, port: 22
333
- set :rails_env, "staging"
334
- set :branch, "develop"
335
- set :project_domain, "staging.example.com"'
336
- end
337
- end
338
-
339
- def setup_recipes
340
- generate 'recipes_matic:install'
341
- end
342
-
343
- def setup_client_side_validations
344
- generate 'client_side_validations:install'
345
- end
346
-
347
- def update_secret_token
348
- remove_file 'config/initializers/secret_token.rb', force: true
349
- template 'config/initializers/secret_token.erb', 'config/initializers/secret_token.rb'
350
- end
351
-
352
- def setup_show_for
353
- copy_file 'config/initializers/show_for.rb', 'config/initializers/show_for.rb'
354
- end
355
-
356
- def create_dev_rake
357
- end
358
-
359
- def custom_exception_page
360
- copy_file 'app/views/errors/internal_server_error.html.haml', 'app/views/errors/internal_server_error.html.haml'
361
- end
362
-
363
- def custom_404
364
- copy_file 'app/views/errors/not_found.html.haml', 'app/views/errors/not_found.html.haml'
365
- end
366
-
367
- def add_seeds
368
- inject_into_file 'db/seeds.rb', after: "# Mayor.create(name: 'Emanuel', city: cities.first)\n" do <<-RUBY
369
- Admin.create(email: "admin@#{app_name}.com", name: 'Admin', surname: 'Admin', password: '12341234', password_confirmation: '12341234')
370
- RUBY
371
- end
372
- end
373
-
374
- # Copy files
375
- def copy_files
376
-
377
- # Locale files
378
- say 'Coping files..'
379
- remove_file 'config/locales/en.yml', force: true
380
- remove_file 'config/locales/simple_form.en.yml', force: true
381
- copy_file 'config/locales/models.tr.yml', 'config/locales/models.tr.yml'
382
- copy_file 'config/locales/show_for.tr.yml', 'config/locales/show_for.tr.yml'
383
- copy_file 'config/locales/simple_form.tr.yml', 'config/locales/simple_form.tr.yml'
384
- copy_file 'config/locales/view.tr.yml', 'config/locales/view.tr.yml'
385
- copy_file 'config/locales/email.tr.yml', 'config/locales/email.tr.yml'
386
-
387
- # Model files
388
- remove_file 'app/models/admin.rb', force: true
389
- remove_file 'app/models/user.rb', force: true
390
- remove_file 'app/models/city.rb', force: true
391
- remove_file 'app/models/country.rb', force: true
392
- directory 'app/models', 'app/models'
393
-
394
- # Helper files
395
- remove_file 'app/helpers/application_helper.rb', force: true
396
- template 'app/helpers/application_helper.rb.erb', 'app/helpers/application_helper.rb'
397
-
398
- # Route file
399
- say 'Restore routes.rb'
400
- remove_file 'config/routes.rb', force: true
401
- template 'config/routes.erb', 'config/routes.rb'
402
-
403
- # Hq layout files
404
- say 'Set hq layouts'
405
- remove_file 'app/views/layouts/hq/application.html.haml', force: true
406
- template 'app/views/layouts/hq/application.html.haml.erb', 'app/views/layouts/hq/application.html.haml', force: true
407
- remove_file 'app/views/layouts/login.html.haml', force: true
408
- template 'app/views/layouts/hq/login.html.haml.erb', 'app/views/layouts/hq/login.html.haml', force: true
409
- remove_file 'app/views/layouts/hq/partials/_navbar.haml', force: true
410
- template 'app/views/layouts/hq/partials/_navbar.html.haml.erb', 'app/views/layouts/hq/partials/_navbar.html.haml', force: true
411
- remove_file 'app/views/layouts/hq/partials/_dock.haml', force: true
412
- template 'app/views/layouts/hq/partials/_dock.html.haml.erb', 'app/views/layouts/hq/partials/_dock.html.haml', force: true
413
- remove_file 'app/views/layouts/hq/partials/_footer.haml', force: true
414
- template 'app/views/layouts/hq/partials/_footer.html.haml.erb', 'app/views/layouts/hq/partials/_footer.html.haml', force: true
415
- remove_file 'app/views/layouts/hq/partials/_trackers.haml', force: true
416
- template 'app/views/layouts/hq/partials/_trackers.html.haml.erb', 'app/views/layouts/hq/partials/_trackers.html.haml', force: true
417
-
418
- # Mailer layout files
419
- template 'app/views/layouts/mailer.html.haml.erb', 'app/views/layouts/mailer.html.haml', force: true
420
- copy_file 'app/views/layouts/mailer.text.haml', 'app/views/layouts/mailer.text.haml'
421
-
422
- # Assets files
423
- remove_file 'app/assets/javascripts/application.js', force: true
424
- remove_file 'app/assets/stylesheets/application.css', force: true
425
-
426
- # Hq assets files
427
- remove_file 'app/assets/javascripts/hq/application.js.coffee', force: true
428
- remove_file 'app/assets/stylesheets/hq/application.css.sass', force: true
429
- copy_file 'app/assets/javascripts/hq/application.js.coffee','app/assets/javascripts/hq/application.js.coffee'
430
- copy_file 'app/assets/stylesheets/hq/application.css.sass', 'app/assets/stylesheets/hq/application.css.sass'
431
-
432
- # Partial files in layouts folder
433
- remove_file 'app/views/layouts/partials/_footer.haml', force: true
434
- template 'app/views/layouts/partials/_footer.html.haml.erb', 'app/views/layouts/partials/_footer.html.haml', force: true
435
- remove_file 'app/views/layouts/partials/_trackers.haml', force: true
436
- template 'app/views/layouts/partials/_trackers.html.haml.erb', 'app/views/layouts/partials/_trackers.html.haml', force: true
437
- template 'app/views/layouts/partials/_warnings.html.haml.erb', 'app/views/layouts/partials/_warnings.html.haml', force: true
438
-
439
- # Root folder files
440
- copy_file 'cybele_version.txt', 'VERSION.txt'
441
- directory 'public/images', 'public/images'
442
- template '.env.local.erb', '.env.local', force: true
443
- template '.env.production.erb', '.env.production', force: true
444
- template '.env.staging.erb', '.env.staging', force: true
445
- template 'env.sample.erb', 'env.sample', force: true
446
- template 'Procfile.erb', 'Procfile', force: true
447
-
448
- # Library files
449
- directory 'lib/tasks', 'lib/tasks'
450
- directory 'lib/data', 'lib/data'
451
-
452
- # Config files
453
- copy_file 'config/initializers/sidekiq.rb', 'config/initializers/sidekiq.rb'
454
- copy_file 'config/initializers/devise_async.rb', 'config/initializers/devise_async.rb'
455
- copy_file 'config/schedule.yml', 'config/schedule.yml'
456
- copy_file 'config/sidekiq.yml', 'config/sidekiq.yml'
457
- remove_file 'config/settings.local.yml', force: true
458
-
459
- # Mailer files
460
- directory 'app/mailers', 'app/mailers'
461
- directory 'app/views/admin_mailer', 'app/views/admin_mailer'
462
- directory 'app/views/user_mailer', 'app/views/user_mailer'
463
-
464
- # Controllers
465
- remove_file 'app/controllers/application_controller.rb', force: true
466
- template 'app/controllers/application_controller.rb.erb', 'app/controllers/application_controller.rb', force: true
467
- end
468
-
469
- def git_commands
54
+ def git_and_git_flow_commands
55
+ run 'mkdir .environments'
56
+ run 'mv .env.local .environments/'
57
+ run 'mv .env.production .environments/'
58
+ run 'mv .env.staging .environments/'
59
+ run 'ln -s .environments/.env.local .env.local'
60
+ run 'cd .environments && git init && git add . && git commit -m "Env initialized" && cd ..'
470
61
  git :init
62
+ git flow: 'init -d -f'
63
+ git add: '.'
64
+ git commit: '-m "Project initialized"'
471
65
  end
472
-
473
- def create_location_models
474
- generate 'model Country name:string'
475
- generate 'model City name:string country:references'
476
- generate 'audited:install'
477
- end
478
-
479
- def create_jobs_helper_lib
480
- create_file "lib/jobs_helper.rb", <<-CODE
481
- # Get system admin
482
- def system_admin
483
- admin = Admin.where(email: "system@#{app_name}.com").first
484
- if admin.nil?
485
- password = Devise.friendly_token.first(12)
486
- admin = Admin.create(name: 'System', surname: 'System', email: "system@#{app_name}.com", password: password, password_confirmation: password)
487
- end
488
- admin
489
- end
490
- CODE
491
- end
492
-
493
- private
494
-
495
- def action_mailer_host(rails_env)
496
- config = <<-RUBY
497
- # Mail Setting
498
- config.action_mailer.default_url_options = { host: ENV['ROOT_PATH'] }
499
- RUBY
500
- configure_environment(rails_env, config)
501
- end
502
-
503
- def configure_environment(rails_env, config)
504
- inject_into_file("config/environments/#{rails_env}.rb", "\n#{config}", before: "\nend")
505
- end
506
-
507
- def generate_devise_strong_parameters(model_name)
508
- create_sanitizer_lib(model_name)
509
- create_sanitizer_initializer(model_name)
510
- end
511
-
512
- def create_sanitizer_lib(model_name)
513
- create_file "lib/#{model_name.parameterize}_sanitizer.rb", <<-CODE
514
- class #{model_name.classify}::ParameterSanitizer < Devise::ParameterSanitizer
515
- private
516
- def sign_up
517
- default_params.permit(:name, :surname, :email, :password, :password_confirmation, :time_zone) # TODO add other params here
518
- end
519
- end
520
- CODE
521
- end
522
-
523
- def create_sanitizer_initializer(model_name)
524
- path = "#"
525
- path << "{Rails.application.root}"
526
- path << "/lib/#{model_name.parameterize}_sanitizer.rb"
527
- initializer 'sanitizers.rb', <<-CODE
528
- require "#{path}"
529
- CODE
530
- end
531
-
532
-
533
66
  end
534
67
  end