raygun 0.0.34 → 0.9.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGES.md +7 -1
  4. data/README.md +7 -11
  5. data/bin/raygun +4 -181
  6. data/cleanup.sh +1 -6
  7. data/lib/raygun/raygun.rb +238 -0
  8. data/lib/raygun/version.rb +1 -1
  9. metadata +6 -223
  10. data/TODO.md +0 -16
  11. data/rails_32/.env +0 -8
  12. data/rails_32/.gitignore +0 -19
  13. data/rails_32/.rspec +0 -1
  14. data/rails_32/.ruby-gemset +0 -1
  15. data/rails_32/.ruby-version +0 -1
  16. data/rails_32/Gemfile +0 -54
  17. data/rails_32/Guardfile +0 -32
  18. data/rails_32/Procfile +0 -2
  19. data/rails_32/README.md +0 -69
  20. data/rails_32/Rakefile +0 -15
  21. data/rails_32/app/assets/javascripts/application.js +0 -16
  22. data/rails_32/app/assets/javascripts/users.js.coffee +0 -3
  23. data/rails_32/app/assets/stylesheets/_footer.less +0 -30
  24. data/rails_32/app/assets/stylesheets/_navbar.less +0 -5
  25. data/rails_32/app/assets/stylesheets/application.css.less +0 -3
  26. data/rails_32/app/controllers/application_controller.rb +0 -15
  27. data/rails_32/app/controllers/pages_controller.rb +0 -8
  28. data/rails_32/app/controllers/password_resets_controller.rb +0 -36
  29. data/rails_32/app/controllers/registrations_controller.rb +0 -29
  30. data/rails_32/app/controllers/user_sessions_controller.rb +0 -26
  31. data/rails_32/app/controllers/users_controller.rb +0 -41
  32. data/rails_32/app/helpers/application_helper.rb +0 -11
  33. data/rails_32/app/helpers/users_helper.rb +0 -2
  34. data/rails_32/app/mailers/.gitkeep +0 -0
  35. data/rails_32/app/mailers/user_mailer.rb +0 -19
  36. data/rails_32/app/models/.gitkeep +0 -0
  37. data/rails_32/app/models/ability.rb +0 -40
  38. data/rails_32/app/models/user.rb +0 -21
  39. data/rails_32/app/models/user_session.rb +0 -6
  40. data/rails_32/app/views/layouts/application.html.slim +0 -36
  41. data/rails_32/app/views/pages/root.html.slim +0 -9
  42. data/rails_32/app/views/password_resets/edit.html.slim +0 -15
  43. data/rails_32/app/views/password_resets/new.html.slim +0 -11
  44. data/rails_32/app/views/registrations/new.html.slim +0 -13
  45. data/rails_32/app/views/user_mailer/activation_needed_email.html.erb +0 -17
  46. data/rails_32/app/views/user_mailer/activation_needed_email.text.erb +0 -9
  47. data/rails_32/app/views/user_mailer/activation_success_email.html.erb +0 -17
  48. data/rails_32/app/views/user_mailer/activation_success_email.text.erb +0 -9
  49. data/rails_32/app/views/user_mailer/reset_password_email.html.erb +0 -16
  50. data/rails_32/app/views/user_mailer/reset_password_email.text.erb +0 -8
  51. data/rails_32/app/views/user_sessions/new.html.slim +0 -13
  52. data/rails_32/app/views/users/_form.html.slim +0 -12
  53. data/rails_32/app/views/users/edit.html.slim +0 -5
  54. data/rails_32/app/views/users/index.html.slim +0 -26
  55. data/rails_32/app/views/users/new.html.slim +0 -4
  56. data/rails_32/app/views/users/show.html.slim +0 -17
  57. data/rails_32/config/application.rb +0 -77
  58. data/rails_32/config/boot.rb +0 -6
  59. data/rails_32/config/database.yml +0 -13
  60. data/rails_32/config/environment.rb +0 -5
  61. data/rails_32/config/environments/acceptance.rb +0 -69
  62. data/rails_32/config/environments/development.rb +0 -39
  63. data/rails_32/config/environments/production.rb +0 -69
  64. data/rails_32/config/environments/test.rb +0 -42
  65. data/rails_32/config/initializers/backtrace_silencers.rb +0 -7
  66. data/rails_32/config/initializers/inflections.rb +0 -15
  67. data/rails_32/config/initializers/mailcatcher.rb +0 -15
  68. data/rails_32/config/initializers/mime_types.rb +0 -5
  69. data/rails_32/config/initializers/secret_token.rb +0 -7
  70. data/rails_32/config/initializers/session_store.rb +0 -8
  71. data/rails_32/config/initializers/simple_form.rb +0 -142
  72. data/rails_32/config/initializers/simple_form_bootstrap.rb +0 -45
  73. data/rails_32/config/initializers/sorcery.rb +0 -398
  74. data/rails_32/config/initializers/wrap_parameters.rb +0 -14
  75. data/rails_32/config/locales/en.yml +0 -5
  76. data/rails_32/config/locales/simple_form.en.yml +0 -26
  77. data/rails_32/config/routes.rb +0 -21
  78. data/rails_32/config/unicorn.rb +0 -27
  79. data/rails_32/config.ru +0 -21
  80. data/rails_32/db/migrate/20121128215324_sorcery_core.rb +0 -19
  81. data/rails_32/db/migrate/20121128215325_sorcery_brute_force_protection.rb +0 -13
  82. data/rails_32/db/migrate/20121128215326_sorcery_activity_logging.rb +0 -17
  83. data/rails_32/db/migrate/20121128215327_sorcery_user_activation.rb +0 -17
  84. data/rails_32/db/migrate/20121128215328_sorcery_remember_me.rb +0 -15
  85. data/rails_32/db/migrate/20121128215329_sorcery_reset_password.rb +0 -17
  86. data/rails_32/db/migrate/20121128215330_sorcery_external.rb +0 -14
  87. data/rails_32/db/migrate/20121128215337_add_admin_to_users.rb +0 -5
  88. data/rails_32/db/sample_data.rb +0 -24
  89. data/rails_32/db/schema.rb +0 -54
  90. data/rails_32/db/seeds.rb +0 -7
  91. data/rails_32/lib/assets/.gitkeep +0 -0
  92. data/rails_32/lib/tasks/.gitkeep +0 -0
  93. data/rails_32/lib/tasks/cane.rake +0 -30
  94. data/rails_32/lib/tasks/coverage.rake +0 -10
  95. data/rails_32/lib/tasks/db.rake +0 -7
  96. data/rails_32/lib/tasks/spec.rake +0 -35
  97. data/rails_32/lib/templates/rails/scaffold_controller/controller.rb +0 -45
  98. data/rails_32/lib/templates/rspec/scaffold/controller_spec.rb +0 -155
  99. data/rails_32/lib/templates/rspec/scaffold/edit_spec.rb +0 -18
  100. data/rails_32/lib/templates/rspec/scaffold/index_spec.rb +0 -26
  101. data/rails_32/lib/templates/rspec/scaffold/new_spec.rb +0 -18
  102. data/rails_32/lib/templates/rspec/scaffold/show_spec.rb +0 -16
  103. data/rails_32/lib/templates/slim/scaffold/_form.html.slim +0 -13
  104. data/rails_32/lib/templates/slim/scaffold/edit.html.slim +0 -5
  105. data/rails_32/lib/templates/slim/scaffold/index.html.slim +0 -28
  106. data/rails_32/lib/templates/slim/scaffold/new.html.slim +0 -4
  107. data/rails_32/lib/templates/slim/scaffold/show.html.slim +0 -17
  108. data/rails_32/log/.gitkeep +0 -0
  109. data/rails_32/public/404.html +0 -26
  110. data/rails_32/public/422.html +0 -26
  111. data/rails_32/public/500.html +0 -25
  112. data/rails_32/public/favicon.ico +0 -0
  113. data/rails_32/public/robots.txt +0 -5
  114. data/rails_32/script/rails +0 -6
  115. data/rails_32/spec/controllers/user_sessions_controller_spec.rb +0 -42
  116. data/rails_32/spec/controllers/users_controller_spec.rb +0 -150
  117. data/rails_32/spec/factories/users.rb +0 -14
  118. data/rails_32/spec/features/activation_spec.rb +0 -18
  119. data/rails_32/spec/features/password_reset_spec.rb +0 -41
  120. data/rails_32/spec/features/registration_spec.rb +0 -39
  121. data/rails_32/spec/features/sign_in_spec.rb +0 -30
  122. data/rails_32/spec/javascripts/example_spec.js.coffee +0 -20
  123. data/rails_32/spec/javascripts/spec.css +0 -3
  124. data/rails_32/spec/javascripts/spec.js.coffee +0 -2
  125. data/rails_32/spec/mailers/user_mailer_spec.rb +0 -48
  126. data/rails_32/spec/models/ability_spec.rb +0 -38
  127. data/rails_32/spec/models/user_spec.rb +0 -36
  128. data/rails_32/spec/spec_helper.rb +0 -64
  129. data/rails_32/spec/support/accept_values.rb +0 -55
  130. data/rails_32/spec/support/database_cleaner.rb +0 -24
  131. data/rails_32/spec/support/factory_girl.rb +0 -3
  132. data/rails_32/spec/support/sorcery.rb +0 -3
  133. data/rails_32/spec/support/user_sessions_feature_helper.rb +0 -21
  134. data/rails_32/spec/views/users/edit.html.slim_spec.rb +0 -16
  135. data/rails_32/spec/views/users/index.html.slim_spec.rb +0 -16
  136. data/rails_32/spec/views/users/new.html.slim_spec.rb +0 -16
  137. data/rails_32/spec/views/users/show.html.slim_spec.rb +0 -13
  138. data/rails_32/vendor/assets/javascripts/.gitkeep +0 -0
  139. data/rails_32/vendor/assets/stylesheets/.gitkeep +0 -0
  140. data/rails_32/vendor/plugins/.gitkeep +0 -0
  141. data/rails_40/.env +0 -8
  142. data/rails_40/.gitignore +0 -16
  143. data/rails_40/.rspec +0 -1
  144. data/rails_40/.ruby-gemset +0 -1
  145. data/rails_40/.ruby-version +0 -1
  146. data/rails_40/Gemfile +0 -53
  147. data/rails_40/Guardfile +0 -34
  148. data/rails_40/Procfile +0 -2
  149. data/rails_40/README.md +0 -90
  150. data/rails_40/Rakefile +0 -15
  151. data/rails_40/app/assets/javascripts/application.js +0 -17
  152. data/rails_40/app/assets/stylesheets/_footer.less +0 -30
  153. data/rails_40/app/assets/stylesheets/_navbar.less +0 -3
  154. data/rails_40/app/assets/stylesheets/application.css.less +0 -3
  155. data/rails_40/app/controllers/application_controller.rb +0 -5
  156. data/rails_40/app/controllers/concerns/.keep +0 -0
  157. data/rails_40/app/controllers/pages_controller.rb +0 -6
  158. data/rails_40/app/helpers/application_helper.rb +0 -11
  159. data/rails_40/app/mailers/.keep +0 -0
  160. data/rails_40/app/models/.keep +0 -0
  161. data/rails_40/app/models/concerns/.keep +0 -0
  162. data/rails_40/app/views/layouts/application.html.slim +0 -39
  163. data/rails_40/app/views/pages/root.html.slim +0 -13
  164. data/rails_40/bin/bundle +0 -3
  165. data/rails_40/bin/deploy.sh +0 -47
  166. data/rails_40/bin/rails +0 -4
  167. data/rails_40/bin/rake +0 -4
  168. data/rails_40/circle.yml +0 -16
  169. data/rails_40/config/application.rb +0 -36
  170. data/rails_40/config/boot.rb +0 -4
  171. data/rails_40/config/database.yml +0 -15
  172. data/rails_40/config/environment.rb +0 -5
  173. data/rails_40/config/environments/acceptance.rb +0 -8
  174. data/rails_40/config/environments/development.rb +0 -31
  175. data/rails_40/config/environments/production.rb +0 -82
  176. data/rails_40/config/environments/test.rb +0 -38
  177. data/rails_40/config/initializers/backtrace_silencers.rb +0 -7
  178. data/rails_40/config/initializers/filter_parameter_logging.rb +0 -4
  179. data/rails_40/config/initializers/inflections.rb +0 -16
  180. data/rails_40/config/initializers/mailcatcher.rb +0 -15
  181. data/rails_40/config/initializers/mime_types.rb +0 -5
  182. data/rails_40/config/initializers/secret_token.rb +0 -12
  183. data/rails_40/config/initializers/session_store.rb +0 -3
  184. data/rails_40/config/initializers/simple_form.rb +0 -142
  185. data/rails_40/config/initializers/simple_form_bootstrap.rb +0 -45
  186. data/rails_40/config/initializers/wrap_parameters.rb +0 -14
  187. data/rails_40/config/locales/en.yml +0 -23
  188. data/rails_40/config/locales/simple_form.en.yml +0 -26
  189. data/rails_40/config/routes.rb +0 -5
  190. data/rails_40/config/unicorn.rb +0 -27
  191. data/rails_40/config.ru +0 -18
  192. data/rails_40/db/sample_data.rb +0 -11
  193. data/rails_40/db/schema.rb +0 -19
  194. data/rails_40/db/seeds.rb +0 -7
  195. data/rails_40/lib/assets/.keep +0 -0
  196. data/rails_40/lib/tasks/.keep +0 -0
  197. data/rails_40/lib/tasks/coverage.rake +0 -10
  198. data/rails_40/lib/tasks/db.rake +0 -7
  199. data/rails_40/lib/tasks/spec.rake +0 -60
  200. data/rails_40/lib/templates/rails/scaffold_controller/controller.rb +0 -61
  201. data/rails_40/lib/templates/rspec/controller/controller_spec.rb +0 -16
  202. data/rails_40/lib/templates/rspec/scaffold/controller_spec.rb +0 -155
  203. data/rails_40/lib/templates/rspec/scaffold/edit_spec.rb +0 -18
  204. data/rails_40/lib/templates/rspec/scaffold/index_spec.rb +0 -26
  205. data/rails_40/lib/templates/rspec/scaffold/new_spec.rb +0 -19
  206. data/rails_40/lib/templates/rspec/scaffold/show_spec.rb +0 -16
  207. data/rails_40/lib/templates/slim/scaffold/_form.html.slim +0 -13
  208. data/rails_40/lib/templates/slim/scaffold/edit.html.slim +0 -5
  209. data/rails_40/lib/templates/slim/scaffold/index.html.slim +0 -29
  210. data/rails_40/lib/templates/slim/scaffold/new.html.slim +0 -4
  211. data/rails_40/lib/templates/slim/scaffold/show.html.slim +0 -17
  212. data/rails_40/log/.keep +0 -0
  213. data/rails_40/public/404.html +0 -58
  214. data/rails_40/public/422.html +0 -58
  215. data/rails_40/public/500.html +0 -57
  216. data/rails_40/public/favicon.ico +0 -0
  217. data/rails_40/public/robots.txt +0 -5
  218. data/rails_40/spec/controllers/pages_controller_spec.rb +0 -12
  219. data/rails_40/spec/features/pages_spec.rb +0 -18
  220. data/rails_40/spec/javascripts/example_spec.js.coffee +0 -20
  221. data/rails_40/spec/javascripts/spec.css +0 -3
  222. data/rails_40/spec/javascripts/spec.js.coffee +0 -2
  223. data/rails_40/spec/spec_helper.rb +0 -79
  224. data/rails_40/spec/support/database_cleaner.rb +0 -24
  225. data/rails_40/spec/support/factory_girl.rb +0 -3
  226. data/rails_40/vendor/assets/javascripts/.keep +0 -0
  227. data/rails_40/vendor/assets/stylesheets/.keep +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6acc114771dba86c25780ea0592ea570d729882
4
- data.tar.gz: 0d1fed637fb1f197c76fef2a8d128df8357f56cf
3
+ metadata.gz: 0bf921b19fb09a55ca908db00a86230db0f4c69e
4
+ data.tar.gz: b893b4c80c86b177ce3210b8c672aee415f07815
5
5
  SHA512:
6
- metadata.gz: fa8b445c23966155b0f8e460ca2566850e52e20b9ce999caefb616e205d33a10d77f32b3efc8d7dce13498ed8fb6f984d7f11e83453cb888a813ef05a6252234
7
- data.tar.gz: f3d9e02e425e0885d8721f55695cb5c6864f85f3c91803f618e4c20726f221b3d7b5c773cfb0e37b9f4d0a1d443bb8d5732231af351614614bf5e2d3df2a6104
6
+ metadata.gz: 71f32414520500f460adeafc9ecc9f7b630971422aa9348c2c1198e740fbb3fcc59fe3bf6e91bcb76b780208896838485e1c59bfeb6e45c3e0bf3683dc9abf94
7
+ data.tar.gz: bb2be3c6a4451baa90f40bcf9c07a8724ceff764a1cf4c4113a16c626f9e288972652c2adf3b5f45b82f239abd171462c6ee161cde24b50b460d8b7a9aa8b87b
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.0.0-p247
1
+ 2.0.0-p247
data/CHANGES.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.9.0 [2013-]
4
+
5
+ * Raygun no longer bundles the application prototype, it's fetched from github (carbonfive/raygun-rails4) instead [#112].
6
+ * Drop support for Rails 3 (#116).
7
+ * Better bootstrap 3 support (#115, thanks @felafelwaffle!).
8
+
3
9
  ## 0.0.34 [2013-10-15]
4
10
 
5
11
  * Nudge bundler to use guard v2.x (defaults to 1.x otherwise).
@@ -39,7 +45,7 @@
39
45
  * Use unicorn by default instead of thin, as per heroku's recommendation.
40
46
  * Suppress schema dumping unless run in development mode to eliminate pg_dump errors on heroku during db:migrate.
41
47
  * Tweak mailcatcher configuration so that it only sets smtp_settings when mailcatcher is running.
42
-
48
+ ray
43
49
  ## 0.0.27 [2013-02-27]
44
50
 
45
51
  * Make sure the target directory is empty, otherwise misfire.
data/README.md CHANGED
@@ -7,17 +7,15 @@
7
7
  Rails application generator that builds a new project skeleton configured with Carbon Five preferences and
8
8
  best practices baked right in. Spend less time configuring and more building cool features.
9
9
 
10
- Raygun generates Rails 4 projects by default. Use ```-r 32``` to generate a Rails 3.2 project.
10
+ Raygun generates Rails 4 projects.
11
11
 
12
12
  Major tools/libraries:
13
13
 
14
- * Rails (4.0 or 3.2)
14
+ * Rails 4.0
15
15
  * PostgreSQL
16
16
  * Slim
17
17
  * Less
18
18
  * Bootstrap
19
- * Sorcery (rails 3.2 projects only)
20
- * Cancan (rails 3.2 projects only)
21
19
  * RSpec
22
20
  * Factory Girl
23
21
  * Jasmine
@@ -29,7 +27,7 @@ Raygun includes generator templates for controllers, views, and specs so that ge
29
27
  practices. For example, view generation produces bootstrap compatible markup and rspec specs use factory
30
28
  girl when appropriate.
31
29
 
32
- Inspired by Xavier Shay and ThoughtBot's Suspenders. Thanks!
30
+ Inspired by Xavier Shay work at Square and ThoughtBot's Suspenders. Thanks!
33
31
 
34
32
  ## Projects Goals
35
33
 
@@ -60,14 +58,12 @@ another ruby, just change the ```Gemfile``` and ```.ruby-version``` as necessary
60
58
 
61
59
  $ raygun your-project
62
60
 
63
- Try ```raygun -r 32 your-project``` to generate a Rails 3.2 project.
64
-
65
61
  Once your project is baked out, you can easily kick the wheels. Be sure that you have the prerequities
66
62
  covered (see above).
67
63
 
68
64
  $ cd your-project
69
65
  $ gem install bundler
70
- $ bundle update
66
+ $ bundle
71
67
 
72
68
  # Prepare the database: schema and reference / sample data
73
69
  $ rake db:setup db:sample_data
@@ -81,9 +77,9 @@ covered (see above).
81
77
 
82
78
  ## Internal Mechanics
83
79
 
84
- Raygun simply copies the [rails_40](rails_40) (or [rails_32](rails_32)) tree and then runs a small set of
85
- commands to customize the copied project. So, what you get looks a lot like [rails_40](rails_40)
86
- ([rails_32](rails_32)). Check out [raygun](bin/raygun) to see how it's massaged after being copied.
80
+ Raygun simply copies the [rails_40](rails_40) tree and then runs a small set of commands to customize
81
+ the copied project. So, what you get looks a lot like [rails_40](rails_40). Check out
82
+ [raygun](bin/raygun) to see how it's massaged after being copied.
87
83
 
88
84
  This approach is fast, simple, and makes raygun developement very easy. Make changes to [rails_40](rails_40),
89
85
  run its specs and fire up the server to see what happens.
data/bin/raygun CHANGED
@@ -4,191 +4,14 @@ File.expand_path('../../lib', __FILE__).tap do |lib|
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  end
6
6
 
7
- require 'optparse'
8
- require 'ostruct'
9
- require 'fileutils'
10
- require 'securerandom'
11
- require 'colorize'
12
-
13
- module Raygun
14
- class Runner
15
- attr_accessor :target_dir, :app_dir, :app_name, :dash_name, :snake_name, :camel_name, :title_name, :prototype
16
-
17
- def initialize(target_dir, prototype)
18
- @target_dir = target_dir
19
- @app_dir = File.expand_path(target_dir.strip.to_s)
20
- @app_name = File.basename(app_dir).gsub(/\s+/, '-')
21
- @dash_name = app_name.gsub('_', '-')
22
- @snake_name = app_name.gsub('-', '_')
23
- @camel_name = camelize(snake_name)
24
- @title_name = titleize(snake_name)
25
- @prototype = prototype
26
- end
27
-
28
- def check_target
29
- unless Dir["#{@app_dir}/*"].empty?
30
- puts "Misfire! The target directory isn't empty... aim elsewhere."
31
- exit 1
32
- end
33
- end
34
-
35
- def copy_prototype
36
- FileUtils.mkdir_p(app_dir)
37
-
38
- Dir.glob(File.expand_path("../../#{@prototype}/*", __FILE__), File::FNM_DOTMATCH) do |f|
39
- next if %w{. ..}.include?(File.basename(f))
40
- FileUtils.cp_r(f, app_dir)
41
- end
42
- end
43
-
44
- def rename_new_app
45
- Dir.chdir(app_dir) do
46
- {
47
- 'AppPrototype' => camel_name,
48
- 'app-prototype' => dash_name,
49
- 'app_prototype' => snake_name,
50
- 'App Prototype' => title_name
51
- }.each do |proto_name, new_name|
52
- shell "find . -type f -print | xargs #{sed_i} 's/#{proto_name}/#{new_name}/g'"
53
- end
54
- end
55
- end
56
-
57
- def configure_new_app
58
- update_ruby_version
59
- initialize_git
60
- end
61
-
62
- def update_ruby_version
63
- prototype_ruby_patch_level = File.read(File.expand_path("../../#{prototype}/.ruby-version", __FILE__)).strip
64
- prototype_ruby_version = prototype_ruby_patch_level.match(/(\d\.\d\.\d).*/)[1]
65
- current_ruby_version = RUBY_VERSION
66
- current_ruby_patch_level = "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
67
-
68
- Dir.chdir(app_dir) do
69
- shell "#{sed_i} 's/#{prototype_ruby_patch_level}/#{current_ruby_patch_level}/g' .ruby-version README.md"
70
- shell "#{sed_i} 's/#{prototype_ruby_version}/#{current_ruby_version}/g' Gemfile"
71
- end
72
- end
73
-
74
- def initialize_git
75
- Dir.chdir(app_dir) do
76
- shell 'git init'
77
- shell 'git add -A .'
78
- shell 'git commit -m "raygun-zapped skeleton"'
79
- end
80
- end
81
-
82
- def print_plan
83
-
84
- project_template = (prototype == 'rails_32') ? '3.2' : '4'
85
-
86
- puts ' ____ '.colorize(:light_yellow)
87
- puts ' / __ \____ ___ ______ ___ ______ '.colorize(:light_yellow)
88
- puts ' / /_/ / __ `/ / / / __ `/ / / / __ \ '.colorize(:light_yellow)
89
- puts ' / _, _/ /_/ / /_/ / /_/ / /_/ / / / / '.colorize(:light_yellow)
90
- puts ' /_/ |_|\__,_/\__, /\__, /\__,_/_/ /_/ '.colorize(:light_yellow)
91
- puts ' /____//____/ '.colorize(:light_yellow)
92
- puts
93
- puts "Creating new app in directory".colorize(:yellow) + " #{target_dir}".colorize(:yellow) + "...".colorize(:yellow)
94
- puts
95
- puts "-".colorize(:blue) + " Application Name:".colorize(:light_blue) + " #{title_name}".colorize(:light_reen)
96
- puts "-".colorize(:blue) + " Project Template:".colorize(:light_blue) + " Rails #{project_template}".colorize(:light_reen)
97
- puts "-".colorize(:blue) + " Ruby Version: ".colorize(:light_blue) + " #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}".colorize(:light_reen)
98
- puts
99
- end
100
-
101
- def print_next_steps
102
- puts "Done! Next steps...".colorize(:yellow)
103
- puts ""
104
- puts "# Install updated dependencies".colorize(:light_green)
105
- puts "$".colorize(:blue) + " cd #{target_dir}".colorize(:light_blue)
106
- puts "$".colorize(:blue) + " gem install bundler".colorize(:light_blue)
107
- puts "$".colorize(:blue) + " bundle update".colorize(:light_blue)
108
- puts ""
109
- puts "# Prepare the database: schema and reference / sample data".colorize(:light_green)
110
- puts "$".colorize(:blue) + " rake db:setup db:sample_data".colorize(:light_blue)
111
- puts ""
112
- puts "# Run the specs (they should all pass)".colorize(:light_green)
113
- puts "$".colorize(:blue) + " rake".colorize(:light_blue)
114
- puts ""
115
- puts "# Run the app and check things out".colorize(:light_green)
116
- puts "$".colorize(:blue) + " foreman start".colorize(:light_blue)
117
- puts "$".colorize(:blue) + " open http://0.0.0.0:3000".colorize(:light_blue)
118
- puts ""
119
- puts "Enjoy your Carbon Five flavored Rails application!".colorize(:yellow)
120
- end
121
-
122
- protected
123
-
124
- def camelize(string)
125
- result = string.sub(/^[a-z\d]*/) { $&.capitalize }
126
- result.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }
127
- end
128
-
129
- def titleize(underscored_string)
130
- result = underscored_string.gsub(/_/, ' ')
131
- result.gsub(/\b('?[a-z])/) { $1.capitalize }
132
- end
133
-
134
- # Distinguish BSD vs GNU sed with the --version flag (only present in GNU sed).
135
- def sed_i
136
- @sed_format ||= begin
137
- %x{sed --version &> /dev/null}
138
- $?.success? ? "sed -i" : "sed -i ''"
139
- end
140
- end
141
-
142
- # Run a shell command and raise an exception if it fails.
143
- def shell(command)
144
- %x{#{command}}
145
- raise "#{command} failed with status #{$?.exitstatus}." unless $?.success?
146
- end
147
-
148
- def self.parse(args)
149
- raygun = nil
150
- options = OpenStruct.new
151
- options.target_dir = nil
152
- options.prototype = 'rails_40'
153
-
154
- parser = OptionParser.new do |opts|
155
- opts.banner = "Usage: raygun [options] NEW_APP_DIRECTORY"
156
-
157
- opts.on('-h', '--help', "Show raygun usage") do |variable|
158
- usage_and_exit(opts)
159
- end
160
-
161
- opts.on('-r', '--rails (32|40)', "Rails version, 32 for 3.2.x or 40 for 4.0.x") do |ext|
162
- ext = '40' if ext == '4'
163
- options.prototype = "rails_#{ext}"
164
- end
165
- end
166
-
167
- begin
168
- parser.parse!
169
- options.target_dir = ARGV.first
170
-
171
- raise OptionParser::InvalidOption if options.target_dir.nil?
172
-
173
- raygun = Raygun::Runner.new(options.target_dir, options.prototype)
174
-
175
- rescue OptionParser::InvalidOption
176
- usage_and_exit(parser)
177
- end
178
-
179
- raygun
180
- end
181
-
182
- def self.usage_and_exit(parser)
183
- puts parser
184
- exit 1
185
- end
186
- end
187
- end
7
+ require 'raygun/raygun'
188
8
 
189
9
  raygun = Raygun::Runner.parse(ARGV)
10
+
190
11
  raygun.check_target
191
12
  raygun.print_plan
13
+ raygun.fetch_prototype
14
+ raygun.check_raygun_version
192
15
  raygun.copy_prototype
193
16
  raygun.rename_new_app
194
17
  raygun.configure_new_app
data/cleanup.sh CHANGED
@@ -3,15 +3,10 @@
3
3
  # All git ignored files: git ls-files --others -i --exclude-standard
4
4
 
5
5
  git clean -df
6
- git checkout rails_32/config/routes.rb app_prototype/db/schema.rb
6
+ git checkout rails_40/config/routes.rb app_prototype/db/schema.rb
7
7
 
8
8
  find . -name ".DS_Store" -exec rm -f {} \;
9
9
 
10
- rm -rfv rails_32/.DS_Store
11
- rm -rfv rails_32/log/*
12
- rm -rfv rails_32/tmp/*
13
- rm -rfv rails_32/coverage
14
-
15
10
  rm -rfv rails_40/.DS_Store
16
11
  rm -rfv rails_40/log/*
17
12
  rm -rfv rails_40/tmp/*
@@ -0,0 +1,238 @@
1
+ require 'optparse'
2
+ require 'ostruct'
3
+ require 'fileutils'
4
+ require 'securerandom'
5
+ require 'net/http'
6
+ require 'json'
7
+ require 'colorize'
8
+
9
+ require_relative 'version'
10
+
11
+ module Raygun
12
+ class Runner
13
+ attr_accessor :target_dir, :app_dir, :app_name, :dash_name, :snake_name, :camel_name, :title_name, :prototype_repo
14
+
15
+ def initialize(target_dir, prototype_repo)
16
+ @target_dir = target_dir
17
+ @app_dir = File.expand_path(target_dir.strip.to_s)
18
+ @app_name = File.basename(app_dir).gsub(/\s+/, '-')
19
+ @dash_name = app_name.gsub('_', '-')
20
+ @snake_name = app_name.gsub('-', '_')
21
+ @camel_name = camelize(snake_name)
22
+ @title_name = titleize(snake_name)
23
+ @prototype_repo = prototype_repo
24
+ end
25
+
26
+ def check_target
27
+ unless Dir["#{@app_dir}/*"].empty?
28
+ puts "Misfire! The target directory isn't empty... aim elsewhere."
29
+ exit 1
30
+ end
31
+ end
32
+
33
+ def fetch_prototype
34
+ print "Checking for the latest application prototype...".colorize(:yellow)
35
+ $stdout.flush
36
+
37
+ # Check if we can connect, or fail gracefully and use the latest cached version.
38
+ latest_tag_obj = JSON.parse(Net::HTTP.get(URI("https://api.github.com/repos/#{@prototype_repo}/tags"))).first
39
+ latest_tag = latest_tag_obj['name']
40
+ tarball_url = latest_tag_obj['tarball_url']
41
+
42
+ print " #{latest_tag}.".colorize(:white)
43
+ $stdout.flush
44
+
45
+ cached_prototypes_dir = File.join(Dir.home, ".raygun")
46
+ @prototype = "#{cached_prototypes_dir}/#{prototype_repo.sub('/', '--')}-#{latest_tag}.tar.gz"
47
+
48
+ # Do we already have the tarball cached under ~/.raygun?
49
+ if File.exists?(@prototype)
50
+ puts " Using cached version.".colorize(:yellow)
51
+ else
52
+ print " Downloading...".colorize(:yellow)
53
+ $stdout.flush
54
+
55
+ # Download the tarball and install in the cache.
56
+ Dir.mkdir(cached_prototypes_dir, 0755) unless Dir.exists?(cached_prototypes_dir)
57
+
58
+ shell "wget -q #{tarball_url} -O #{@prototype}"
59
+ puts " done!".colorize(:yellow)
60
+ end
61
+ end
62
+
63
+ def check_raygun_version
64
+ required_raygun_version =
65
+ %x{tar xfz #{@prototype} --include "*.raygun-version" -O 2> /dev/null}.chomp ||
66
+ ::Raygun::VERSION
67
+
68
+ if Gem::Version.new(required_raygun_version) > Gem::Version.new(::Raygun::VERSION)
69
+ puts ""
70
+ print "Hold up!".colorize(:red)
71
+ print " This version of the raygun gem (".colorize(:light_red)
72
+ print "#{::Raygun::VERSION})".colorize(:white)
73
+ print " is too old to generate this application (needs ".colorize(:light_red)
74
+ print "#{required_raygun_version}".colorize(:white)
75
+ puts " or newer).".colorize(:light_red)
76
+ puts ""
77
+ print "Please update the gem by running ".colorize(:light_red)
78
+ print "gem update raygun".colorize(:white)
79
+ puts ", and try again. Thanks!".colorize(:light_red)
80
+ puts ""
81
+ exit 1
82
+ end
83
+ end
84
+
85
+ def copy_prototype
86
+ FileUtils.mkdir_p(app_dir)
87
+
88
+ shell "tar xfz #{@prototype} -C #{app_dir}"
89
+
90
+ extraneous_dir = Dir.glob("#{app_dir}/*").first
91
+ dirs_to_move = Dir.glob("#{extraneous_dir}/*", File::FNM_DOTMATCH)
92
+ .reject { |d| %w{. ..}.include?(File.basename(d)) }
93
+
94
+ FileUtils.mv dirs_to_move, app_dir
95
+ FileUtils.remove_dir extraneous_dir
96
+ end
97
+
98
+ def rename_new_app
99
+ Dir.chdir(app_dir) do
100
+ {
101
+ 'AppPrototype' => camel_name,
102
+ 'app-prototype' => dash_name,
103
+ 'app_prototype' => snake_name,
104
+ 'App Prototype' => title_name
105
+ }.each do |proto_name, new_name|
106
+ shell "find . -type f -print | xargs #{sed_i} 's/#{proto_name}/#{new_name}/g'"
107
+ end
108
+ end
109
+ end
110
+
111
+ def configure_new_app
112
+ update_ruby_version
113
+ initialize_git
114
+ end
115
+
116
+ def update_ruby_version
117
+ prototype_ruby_patch_level = File.read(File.expand_path("#{app_dir}/.ruby-version", __FILE__)).strip
118
+ prototype_ruby_version = prototype_ruby_patch_level.match(/(\d\.\d\.\d).*/)[1]
119
+ current_ruby_version = RUBY_VERSION
120
+ current_ruby_patch_level = "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
121
+
122
+ Dir.chdir(app_dir) do
123
+ shell "#{sed_i} 's/#{prototype_ruby_patch_level}/#{current_ruby_patch_level}/g' .ruby-version README.md"
124
+ shell "#{sed_i} 's/#{prototype_ruby_version}/#{current_ruby_version}/g' Gemfile"
125
+ end
126
+ end
127
+
128
+ def initialize_git
129
+ Dir.chdir(app_dir) do
130
+ shell "git init"
131
+ shell "git add -A ."
132
+ shell "git commit -m 'Raygun-zapped skeleton.'"
133
+ end
134
+ end
135
+
136
+ def print_plan
137
+ puts ' ____ '.colorize(:light_yellow)
138
+ puts ' / __ \____ ___ ______ ___ ______ '.colorize(:light_yellow)
139
+ puts ' / /_/ / __ `/ / / / __ `/ / / / __ \ '.colorize(:light_yellow)
140
+ puts ' / _, _/ /_/ / /_/ / /_/ / /_/ / / / / '.colorize(:light_yellow)
141
+ puts ' /_/ |_|\__,_/\__, /\__, /\__,_/_/ /_/ '.colorize(:light_yellow)
142
+ puts ' /____//____/ '.colorize(:light_yellow)
143
+ puts
144
+ puts "Raygun will creating new app in directory".colorize(:yellow) + " #{target_dir}".colorize(:yellow) + "...".colorize(:yellow)
145
+ puts
146
+ puts "-".colorize(:blue) + " Application Name:".colorize(:light_blue) + " #{title_name}".colorize(:light_reen)
147
+ puts "-".colorize(:blue) + " Project Template:".colorize(:light_blue) + " #{prototype_repo}".colorize(:light_reen)
148
+ puts "-".colorize(:blue) + " Ruby Version: ".colorize(:light_blue) + " #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}".colorize(:light_reen)
149
+ puts
150
+ end
151
+
152
+ def print_next_steps
153
+ puts ""
154
+ puts "Zap! Your application is ready. Next steps...".colorize(:yellow)
155
+ puts ""
156
+ puts "# Install updated dependencies".colorize(:light_green)
157
+ puts "$".colorize(:blue) + " cd #{target_dir}".colorize(:light_blue)
158
+ puts "$".colorize(:blue) + " gem install bundler".colorize(:light_blue)
159
+ puts "$".colorize(:blue) + " bundle".colorize(:light_blue)
160
+ puts ""
161
+ puts "# Prepare the database: schema and reference / sample data".colorize(:light_green)
162
+ puts "$".colorize(:blue) + " rake db:setup db:sample_data".colorize(:light_blue)
163
+ puts ""
164
+ puts "# Run the specs (they should all pass)".colorize(:light_green)
165
+ puts "$".colorize(:blue) + " rake".colorize(:light_blue)
166
+ puts ""
167
+ puts "# Run the app and check things out".colorize(:light_green)
168
+ puts "$".colorize(:blue) + " foreman start".colorize(:light_blue)
169
+ puts "$".colorize(:blue) + " open http://0.0.0.0:3000".colorize(:light_blue)
170
+ puts ""
171
+ puts "Enjoy your Carbon Five flavored Rails application!".colorize(:yellow)
172
+ end
173
+
174
+ protected
175
+
176
+ def camelize(string)
177
+ result = string.sub(/^[a-z\d]*/) { $&.capitalize }
178
+ result.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }
179
+ end
180
+
181
+ def titleize(underscored_string)
182
+ result = underscored_string.gsub(/_/, ' ')
183
+ result.gsub(/\b('?[a-z])/) { $1.capitalize }
184
+ end
185
+
186
+ # Distinguish BSD vs GNU sed with the --version flag (only present in GNU sed).
187
+ def sed_i
188
+ @sed_format ||= begin
189
+ %x{sed --version &> /dev/null}
190
+ $?.success? ? "sed -i" : "sed -i ''"
191
+ end
192
+ end
193
+
194
+ # Run a shell command and raise an exception if it fails.
195
+ def shell(command)
196
+ %x{#{command}}
197
+ raise "#{command} failed with status #{$?.exitstatus}." unless $?.success?
198
+ end
199
+
200
+ def self.parse(args)
201
+ raygun = nil
202
+
203
+ options = OpenStruct.new
204
+ options.target_dir = nil
205
+ options.prototype_repo = 'carbonfive/raygun-rails4'
206
+
207
+ parser = OptionParser.new do |opts|
208
+ opts.banner = "Usage: raygun [options] NEW_APP_DIRECTORY"
209
+
210
+ opts.on('-h', '--help', "Show raygun usage") do |variable|
211
+ usage_and_exit(opts)
212
+ end
213
+ #opts.on('-p', '--prototype', "Prototype github repo (e.g. carbonfive/raygun).") do |prototype|
214
+ # options.prototype_repo = prototype_repo
215
+ #end
216
+ end
217
+
218
+ begin
219
+ parser.parse!
220
+ options.target_dir = ARGV.first
221
+
222
+ raise OptionParser::InvalidOption if options.target_dir.nil?
223
+
224
+ raygun = Raygun::Runner.new(options.target_dir, options.prototype_repo)
225
+
226
+ rescue OptionParser::InvalidOption
227
+ usage_and_exit(parser)
228
+ end
229
+
230
+ raygun
231
+ end
232
+
233
+ def self.usage_and_exit(parser)
234
+ puts parser
235
+ exit 1
236
+ end
237
+ end
238
+ end
@@ -1,3 +1,3 @@
1
1
  module Raygun
2
- VERSION = "0.0.34"
2
+ VERSION = "0.9.0.pre"
3
3
  end