raygun 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. data/CHANGES.md +9 -0
  2. data/README.md +18 -10
  3. data/TODO.md +0 -3
  4. data/app_prototype/.env +6 -0
  5. data/app_prototype/.gitignore +1 -0
  6. data/app_prototype/{.rbenv-version → .ruby-version} +0 -0
  7. data/app_prototype/.rvmrc +1 -1
  8. data/app_prototype/Gemfile +6 -3
  9. data/app_prototype/Procfile +2 -1
  10. data/app_prototype/README.md +45 -18
  11. data/app_prototype/app/assets/stylesheets/_navbar.less +5 -0
  12. data/app_prototype/app/assets/stylesheets/application.css.less +1 -6
  13. data/app_prototype/app/controllers/users_controller.rb +4 -4
  14. data/app_prototype/app/models/user.rb +1 -1
  15. data/app_prototype/app/views/layouts/application.html.slim +1 -1
  16. data/app_prototype/app/views/user_mailer/activation_needed_email.html.erb +2 -2
  17. data/app_prototype/app/views/user_mailer/activation_needed_email.text.erb +2 -2
  18. data/app_prototype/app/views/user_mailer/activation_success_email.html.erb +3 -3
  19. data/app_prototype/app/views/user_mailer/activation_success_email.text.erb +3 -3
  20. data/app_prototype/app/views/user_mailer/reset_password_email.html.erb +2 -2
  21. data/app_prototype/app/views/user_mailer/reset_password_email.text.erb +3 -3
  22. data/app_prototype/config/database.yml +1 -1
  23. data/app_prototype/config/environments/acceptance.rb +2 -2
  24. data/app_prototype/config/environments/production.rb +1 -1
  25. data/app_prototype/config/environments/test.rb +1 -1
  26. data/app_prototype/config/initializers/email.rb +4 -2
  27. data/app_prototype/db/migrate/20121128215324_sorcery_core.rb +3 -1
  28. data/app_prototype/db/schema.rb +1 -0
  29. data/app_prototype/spec/mailers/user_mailer_spec.rb +1 -1
  30. data/bin/raygun +10 -2
  31. data/lib/raygun/version.rb +1 -1
  32. metadata +5 -3
data/CHANGES.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.17 [2013-01-17]
4
+
5
+ * Configure .rbenv-version, .rvmrc, and Gemfile with the version of ruby used to execute raygun.
6
+ * Improve the detfault email content.
7
+ * Improve the raygun and app_prototype READMEs.
8
+ * Use $PORT to set the server port for Heroku compatibility, with default set in .env.
9
+ * .ruby-version instead of .rbenv-version (as recommended by rbenv).
10
+ * Add a unique database constraint on users.email.
11
+
3
12
  ## 0.0.16 [2013-01-04]
4
13
 
5
14
  * Improved authorization rules so that users can't delete themselves and non-admin can't access users controller :new.
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  # Raygun
4
4
 
5
5
  Rails application generator that builds a new project skeleton configured with Carbon Five preferences and
6
- best practices baked right in. Spend less time configuring stuff and more building cool stuff.
6
+ best practices baked right in. Spend less time configuring and more building cool features.
7
7
 
8
8
  Major tools/libraries:
9
9
 
@@ -17,9 +17,13 @@ Major tools/libraries:
17
17
  * RSpec
18
18
  * Factory Girl
19
19
  * Jasmine
20
+ * SimpleCov
20
21
  * Guard (rspec, jasmine, livereload)
22
+ * And many tweaks, patterns and common recipes.
21
23
 
22
- And many tweaks, patterns and common recipes.
24
+ Raygun includes generator templates for controllers, views, and specs so that generated code follows best
25
+ practices. For example, view generation produces bootstrap compatible markup and rspec specs use factory
26
+ girl when appropriate.
23
27
 
24
28
  Inspired by Xavier Shay and ThoughtBot's Suspenders. Thanks!
25
29
 
@@ -27,9 +31,10 @@ Inspired by Xavier Shay and ThoughtBot's Suspenders. Thanks!
27
31
 
28
32
  Raygun...
29
33
 
30
- * should generate a new rails application that's ready for feature development immediately.
31
- * should generate an application that has best practices that apply to most projects baked in.
32
- * is a forum for discussing what should or should not be included as part of a standard stack.
34
+ * Generates a new rails application that's ready for immediate feature development.
35
+ * Generates an application that has best practices that apply to most projects baked in.
36
+ * Generates an application that includes specs for all build in functionality.
37
+ * Is a forum for discussing what should or should not be included as part of a standard stack.
33
38
 
34
39
  ## Installation
35
40
 
@@ -37,19 +42,22 @@ Raygun...
37
42
 
38
43
  ## Prerequisites
39
44
 
40
- Be sure you met these requirements before using raygun, otherwise you won't make it very far (misfire!).
45
+ To generate an application, you only need the raygun gem.
46
+
47
+ To run your new application's specs or fire up its server, you'll need to meet these requirements.
41
48
 
42
- * Ruby 1.9.3-p327 (rvm and rbenv supported)
43
49
  * PostgreSQL 9.x with superuser 'postgres' with no password (```createuser -s postgres```)
44
50
  * PhantomJS for JavaScript testing (```brew install phantomjs```)
45
51
 
46
- If you're using another ruby, just change the Gemfile, .rvmrc and/or .rbenv as necessary before running bundle.
52
+ The generated app will be configured to use the ruby version that was used to invoke raygun. If you're using
53
+ another ruby, just change the ```Gemfile```, ```.rvmrc``` and/or ```.rbenv-version``` as necessary.
47
54
 
48
55
  ## Usage
49
56
 
50
57
  $ raygun your-project
51
58
 
52
- Once your project is baked out, you can easily kick the wheels:
59
+ Once your project is baked out, you can easily kick the wheels. Be sure that you have the prerequities
60
+ covered (see above).
53
61
 
54
62
  $ cd your-project
55
63
  $ gem install bundler
@@ -77,7 +85,7 @@ Once your project is baked out, you can easily kick the wheels:
77
85
 
78
86
  Generate an example app using your local development version of raygun:
79
87
 
80
- ./bin/raygun tmp/example_app
88
+ $ ./bin/raygun tmp/example_app
81
89
 
82
90
  ## Changes
83
91
 
data/TODO.md CHANGED
@@ -3,11 +3,8 @@
3
3
  Looking for inspiration? Here are some ideas for things that still could be done. Don't forget to check the open issus too.
4
4
 
5
5
  * Automated testing of raygun (e.g. generate an app and run its specs?)
6
- * Raygun on CI
7
6
  * Invite user flow
8
- * Use cancan to allow users to edit only themselves and admins to edit any user
9
7
  * Continue to improve bootstrap view templates
10
- * CSS/less best practices for file organization
11
8
  * JS/coffeescript best practices
12
9
  * Add pagination to the default index scaffold (kaminari)
13
10
  * Use foreigner for database constraints
@@ -0,0 +1,6 @@
1
+ # Set environment variables needed for development here. These values will be
2
+ # used unless they're already set.
3
+ #
4
+ # http://ddollar.github.com/foreman/#ENVIRONMENT
5
+
6
+ PORT=3000
@@ -6,6 +6,7 @@
6
6
 
7
7
  # Ignore bundler config
8
8
  /.bundle
9
+ /gem_graph.png
9
10
 
10
11
  # Ignore the default SQLite database
11
12
  /db/*.sqlite3
File without changes
data/app_prototype/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use ruby-1.9.3-p327@app_prototype --create
1
+ rvm use ruby-1.9.3-p327@app-prototype --create
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  ruby '1.9.3'
5
5
 
6
6
  gem 'thin'
7
- gem 'rails', '~> 3.2.9'
7
+ gem 'rails', '~> 3.2.11'
8
8
  gem 'slim-rails'
9
9
  gem 'jquery-rails'
10
10
  gem 'sorcery'
@@ -20,12 +20,15 @@ group :assets do
20
20
  gem 'less-rails-bootstrap'
21
21
  gem 'coffee-rails'
22
22
  gem 'uglifier'
23
- gem 'therubyracer', platforms: :ruby
23
+
24
+ # Heroku suggests that these gems aren't necessary, but they're required to compile less assets on deploy.
25
+ gem 'therubyracer'
26
+ gem 'libv8', '~> 3.11.8'
24
27
  end
25
28
 
26
29
  group :test, :development do
27
30
  gem 'rspec-rails', '~> 2.12.0'
28
- gem 'capybara', github: 'jnicklas/capybara' # Switch from github once issue #882 is resolved.
31
+ gem 'capybara', '~> 2.0'
29
32
  gem 'capybara-email'
30
33
  gem 'factory_girl_rails'
31
34
  gem 'jasminerice'
@@ -1 +1,2 @@
1
- web: rails server -p 3000
1
+ web: rails server -p $PORT
2
+ #worker: bundle exec rake jobs:work
@@ -1,31 +1,58 @@
1
- Overview
2
- ========
1
+ # App Prototype
3
2
 
4
3
  ...
5
4
 
6
- Requirements
7
- ============
5
+ Generated with [Raygun](https://github.com/carbonfive/raygun).
8
6
 
9
- * ruby 1.9.3-p327
10
- * postgresql 9.? (user 'postgres' with no password)
7
+ # Requirements
11
8
 
12
- Running the Specs
13
- =================
9
+ To run the specs or fire up the server, be sure you have these:
14
10
 
15
- $ rake db:setup db:test:prepare
16
- $ rake
11
+ * Ruby 1.9.3-p327
12
+ * PostgreSQL 9.x with superuser 'postgres' with no password (```createuser -s postgres```)
13
+ * PhantomJS for JavaScript testing (```brew install phantomjs```)
17
14
 
18
- Running the Application
19
- =======================
15
+ # Development
20
16
 
21
- $ foreman start
17
+ ### First Time Setup
22
18
 
23
- Using Guard
24
- ===========
19
+ After cloning, run these commands to install missing gems and prepare the database.
25
20
 
26
- $ bundle exec guard -c
21
+ $ gem install bundler
22
+ $ bundle update
23
+ $ rake db:setup db:sample_data
27
24
 
28
- Considerations
29
- ==============
25
+ Note, ```rake db:sample_data``` loads a small set of data for development. Check out ```db/sample_data.rb``` for details.
26
+
27
+ ### Running the Specs
28
+
29
+ To run all ruby and jasmine specs.
30
+
31
+ $ rake
32
+
33
+ Again, with coverage for the ruby specs:
34
+
35
+ $ rake spec:coverage
36
+
37
+ ### Running the Application Locally
38
+
39
+ $ foreman start
40
+ $ open http://0.0.0.0:3000"
41
+
42
+ ### Using Guard
43
+
44
+ Guard is configured to run ruby and jasmine specs, and also listen for livereload connections. Growl is used for notifications.
45
+
46
+ $ bundle exec guard
47
+
48
+ ### Deploying to Heroku
49
+
50
+ Install the heroku toolbelt if you don't already have it (https://toolbelt.heroku.com/).
51
+
52
+ $ heroku apps:create app-prototype
53
+ $ git push heroku master
54
+ $ heroku run rake db:setup
55
+
56
+ # Considerations
30
57
 
31
58
  ...
@@ -0,0 +1,5 @@
1
+ // Navbar
2
+
3
+ .wrapper > .container {
4
+ padding-top: 60px; // Push the content down so that it's below our pinned navbar.
5
+ }
@@ -1,8 +1,3 @@
1
1
  @import 'twitter/bootstrap';
2
+ @import '_navbar';
2
3
  @import '_footer';
3
-
4
- // Navbar
5
-
6
- .wrapper > .container {
7
- padding-top: 60px; // Push the content down so that it's below our pinned navbar.
8
- }
@@ -20,17 +20,17 @@ class UsersController < ApplicationController
20
20
  @user = User.new(params[:user])
21
21
 
22
22
  if @user.save
23
- redirect_to @user, notice: 'User was successfully created.'
23
+ redirect_to @user, notice: "User was successfully created."
24
24
  else
25
- render action: "new"
25
+ render action: 'new'
26
26
  end
27
27
  end
28
28
 
29
29
  def update
30
30
  if @user.update_attributes(params[:user])
31
- redirect_to @user, notice: 'User was successfully updated.'
31
+ redirect_to @user, notice: "User was successfully updated."
32
32
  else
33
- render action: "edit"
33
+ render action: 'edit'
34
34
  end
35
35
  end
36
36
 
@@ -1,6 +1,6 @@
1
1
  class User < ActiveRecord::Base
2
2
 
3
- attr_accessible :name, :email, :password, :password_confirmation
3
+ attr_accessible :name, :email, :password
4
4
 
5
5
  authenticates_with_sorcery!
6
6
 
@@ -33,4 +33,4 @@ html
33
33
 
34
34
  footer
35
35
  .container
36
- p &copy; 2012 All rights reserved.
36
+ p &copy; 2013 All rights reserved.
@@ -4,9 +4,9 @@
4
4
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
5
  </head>
6
6
  <body>
7
- <h1>Welcome to example.com, <%= @user.email %></h1>
7
+ <h1>Welcome to App Prototype, <%= @user.email %></h1>
8
8
  <p>
9
- You have successfully signed up to example.com,
9
+ You have successfully signed up to app-prototype.herokuapp.com,
10
10
  your username is: <%= @user.email %>.<br/>
11
11
  </p>
12
12
  <p>
@@ -1,7 +1,7 @@
1
- Welcome to example.com, <%= @user.email %>
1
+ Welcome to App Prototype, <%= @user.email %>!
2
2
  ===============================================
3
3
 
4
- You have successfully signed up to example.com,
4
+ You have successfully signed up to app-prototype.herokuapp.com,
5
5
  your username is: <%= @user.email %>.
6
6
 
7
7
  To login to the site, just follow this link: <%= activation_url(@user.activation_token) %>
@@ -4,13 +4,13 @@
4
4
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
5
  </head>
6
6
  <body>
7
- <h1>Congratz, <%= @user.email %></h1>
7
+ <h1>Congratulations, <%= @user.email %>!</h1>
8
8
  <p>
9
- You have successfully activated your example.com account,
9
+ You have successfully activated your App Prototype account,
10
10
  your username is: <%= @user.email %>.<br/>
11
11
  </p>
12
12
  <p>
13
- To login to the site, just follow this link: <%= link_to sign_in_url, sign_in_url %>.
13
+ <%= link_to "Sign In Now", sign_in_url %>.
14
14
  </p>
15
15
  <p>Thanks for joining and have a great day!</p>
16
16
  </body>
@@ -1,9 +1,9 @@
1
- Congratz, <%= @user.email %>
1
+ Congratulations, <%= @user.email %>!
2
2
  ===============================================
3
3
 
4
- You have successfully activated your example.com account,
4
+ You have successfully activated your App Prototype account,
5
5
  your username is: <%= @user.email %>.
6
6
 
7
- To login to the site, just follow this link: <%= sign_in_url %>
7
+ Go ahead and sign in to the site: <%= sign_in_url %>
8
8
 
9
9
  Thanks for joining and have a great day!
@@ -6,10 +6,10 @@
6
6
  <body>
7
7
  <h1>Hello, <%= @user.email %></h1>
8
8
  <p>
9
- You have requested to reset your password.
9
+ Someone requested to reset your password. If it wasn't you, just disregard this email.
10
10
  </p>
11
11
  <p>
12
- To choose a new password, just follow this link: <%= link_to reset_password_url(@user.reset_password_token), reset_password_url(@user.reset_password_token) %>.
12
+ To choose a new password, follow this link: <%= link_to reset_password_url(@user.reset_password_token), reset_password_url(@user.reset_password_token) %>.
13
13
  </p>
14
14
  <p>Have a great day!</p>
15
15
  </body>
@@ -1,8 +1,8 @@
1
1
  Hello, <%= @user.email %>
2
2
  ===============================================
3
+
4
+ Someone requested to reset your password. If it wasn't you, just disregard this email.
3
5
 
4
- You have requested to reset your password.
5
-
6
- To choose a new password, just follow this link: <%= reset_password_url(@user.reset_password_token) %>
6
+ To choose a new password, follow this link: <%= reset_password_url(@user.reset_password_token) %>
7
7
 
8
8
  Have a great day!
@@ -7,7 +7,7 @@ development: &default
7
7
  pool: 5
8
8
  timeout: 5000
9
9
 
10
- test: &TEST
10
+ test:
11
11
  <<: *default
12
12
  database: app_prototype_test
13
13
  min_messages: warning
@@ -63,7 +63,7 @@ AppPrototype::Application.configure do
63
63
 
64
64
  # Log the query plan for queries taking more than this (works
65
65
  # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
66
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
67
67
 
68
- config.action_mailer.default_url_options = { host: 'app_prototype-acceptance.herokuapp.com' }
68
+ config.action_mailer.default_url_options = { host: 'app-prototype-acceptance.herokuapp.com' }
69
69
  end
@@ -65,5 +65,5 @@ AppPrototype::Application.configure do
65
65
  # with SQLite, MySQL, and PostgreSQL)
66
66
  # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
67
 
68
- config.action_mailer.default_url_options = { host: 'app_prototype.herokuapp.com' }
68
+ config.action_mailer.default_url_options = { host: 'app-prototype.herokuapp.com' }
69
69
  end
@@ -22,7 +22,7 @@ AppPrototype::Application.configure do
22
22
  config.action_dispatch.show_exceptions = false
23
23
 
24
24
  # Disable request forgery protection in test environment
25
- config.action_controller.allow_forgery_protection = false
25
+ config.action_controller.allow_forgery_protection = false
26
26
 
27
27
  # Tell Action Mailer not to deliver emails to the real world.
28
28
  # The :test delivery method accumulates sent emails in the
@@ -1,11 +1,13 @@
1
1
  # http://www.mikeperham.com/2012/12/09/12-gems-of-christmas-4-mailcatcher-and-mail_view/
2
2
 
3
+ mailcatcher_port = 1025
4
+
3
5
  begin
4
- sock = TCPSocket.new('localhost', 1025)
6
+ sock = TCPSocket.new('localhost', mailcatcher_port)
5
7
  sock.close
6
8
  catcher = true
7
9
  rescue
8
10
  catcher = false
9
11
  end
10
12
 
11
- ActionMailer::Base.smtp_settings = (Rails.env.development? && catcher) ? { host: 'localhost', port: '1025', } : {}
13
+ ActionMailer::Base.smtp_settings = (Rails.env.development? && catcher) ? { host: 'localhost', port: mailcatcher_port, } : {}
@@ -9,9 +9,11 @@ class SorceryCore < ActiveRecord::Migration
9
9
 
10
10
  t.timestamps
11
11
  end
12
+
13
+ add_index :users, :email, unique: true
12
14
  end
13
15
 
14
16
  def self.down
15
17
  drop_table :users
16
18
  end
17
- end
19
+ end
@@ -46,6 +46,7 @@ ActiveRecord::Schema.define(:version => 20121128215337) do
46
46
  end
47
47
 
48
48
  add_index "users", ["activation_token"], :name => "index_users_on_activation_token"
49
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
49
50
  add_index "users", ["last_logout_at", "last_activity_at"], :name => "index_users_on_last_logout_at_and_last_activity_at"
50
51
  add_index "users", ["remember_me_token"], :name => "index_users_on_remember_me_token"
51
52
  add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token"
@@ -41,7 +41,7 @@ describe UserMailer do
41
41
  end
42
42
 
43
43
  it "renders the body" do
44
- expect(mail.body.encoded).to match "You have requested to reset your password."
44
+ expect(mail.body.encoded).to match "Someone requested to reset your password."
45
45
  end
46
46
  end
47
47
 
data/bin/raygun CHANGED
@@ -19,11 +19,16 @@ unless ARGV[0]
19
19
  exit 1
20
20
  end
21
21
 
22
- app_dir = ARGV[0]
23
- app_name_snake = File.basename(app_dir).gsub('-', '_')
22
+ app_dir = ARGV[0]
23
+ app_name = File.basename(app_dir).gsub(/\s+/, '-')
24
+ app_name_dash = app_name.gsub('_', '-')
25
+ app_name_snake = app_name.gsub('-', '_')
24
26
  app_name_camel = camelize(app_name_snake)
25
27
  app_name_title = titleize(app_name_snake)
26
28
 
29
+ ruby_version_patchlevel = `ruby -e 'print "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"'`
30
+ ruby_version = `ruby -e 'print "#{RUBY_VERSION}"'`
31
+
27
32
  puts
28
33
  puts "Creating new app #{app_name_camel} in directory #{app_dir}..."
29
34
  puts
@@ -32,9 +37,12 @@ FileUtils.cp_r(File.expand_path('../../app_prototype', __FILE__), app_dir)
32
37
 
33
38
  Dir.chdir(app_dir) do
34
39
  `find . -type f -print | xargs sed -i '' 's/AppPrototype/#{app_name_camel}/g'`
40
+ `find . -type f -print | xargs sed -i '' 's/app-prototype/#{app_name_dash}/g'`
35
41
  `find . -type f -print | xargs sed -i '' 's/app_prototype/#{app_name_snake}/g'`
36
42
  `find . -type f -print | xargs sed -i '' 's/App Prototype/#{app_name_title}/g'`
37
43
  `sed -i '' 's/SUPER_SECRET_TOKEN_REPLACE_ME_TODO/#{SecureRandom.hex(128)}/' config/initializers/secret_token.rb`
44
+ `sed -i '' 's/1.9.3-p327/#{ruby_version_patchlevel}/g' .rvmrc .ruby-version`
45
+ `sed -i '' 's/1.9.3/#{ruby_version}/g' Gemfile`
38
46
 
39
47
  puts "Done! Next steps..."
40
48
  puts ""
@@ -1,3 +1,3 @@
1
1
  module Raygun
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.17"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raygun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-01-04 00:00:00.000000000 Z
14
+ date: 2013-01-17 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: Carbon Five Rails application generator
17
17
  email:
@@ -30,9 +30,10 @@ files:
30
30
  - README.md
31
31
  - Rakefile
32
32
  - TODO.md
33
+ - app_prototype/.env
33
34
  - app_prototype/.gitignore
34
- - app_prototype/.rbenv-version
35
35
  - app_prototype/.rspec
36
+ - app_prototype/.ruby-version
36
37
  - app_prototype/.rvmrc
37
38
  - app_prototype/Gemfile
38
39
  - app_prototype/Guardfile
@@ -42,6 +43,7 @@ files:
42
43
  - app_prototype/app/assets/javascripts/application.js
43
44
  - app_prototype/app/assets/javascripts/users.js.coffee
44
45
  - app_prototype/app/assets/stylesheets/_footer.less
46
+ - app_prototype/app/assets/stylesheets/_navbar.less
45
47
  - app_prototype/app/assets/stylesheets/application.css.less
46
48
  - app_prototype/app/controllers/application_controller.rb
47
49
  - app_prototype/app/controllers/password_resets_controller.rb