suspenders 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/NEWS.md CHANGED
@@ -1,4 +1,10 @@
1
- New for 1.0.0:
1
+ 1.0.1 (August 2, 2012)
2
+
3
+ * Fix broken install on Ruby 1.8.
4
+ * Remove db/schema.rb from .gitignore.
5
+ * Remove Factory Girl step definitions.
6
+
7
+ 1.0.0 (June 29, 2012)
2
8
 
3
9
  * Ignore `bin/`, `.rake_tasks`, `.bundle/`, and `.gem/`.
4
10
  * Create a root route only with `--clearance`.
@@ -6,12 +12,12 @@ New for 1.0.0:
6
12
  * Style static error pages.
7
13
  * Cucumber requires everything under `features/`, regardless of pwd.
8
14
  * Added gems:
9
- * foreman
10
- * therubyracer
15
+ * `foreman`
16
+ * `therubyracer`
11
17
  * Removed gems:
12
- * copycopter_client
13
- * heroku
14
- * ruby-debug
15
- * sass
16
- * sprockets-redirect
17
- * email_spec
18
+ * `copycopter_client`
19
+ * `heroku`
20
+ * `ruby-debug`
21
+ * `sass`
22
+ * `sprockets-redirect`
23
+ * `email_spec`
@@ -10,7 +10,7 @@ if ['create', '--create'].include? ARGV[0]
10
10
  end
11
11
 
12
12
  templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
13
- Suspenders::Generator.source_root templates_root
14
- Suspenders::Generator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
13
+ Suspenders::AppGenerator.source_root templates_root
14
+ Suspenders::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
15
15
 
16
- Suspenders::Generator.start
16
+ Suspenders::AppGenerator.start
@@ -3,7 +3,7 @@ module Suspenders
3
3
  include Suspenders::Actions
4
4
 
5
5
  def readme
6
- template "README.md.erb", "README.md"
6
+ template 'README.md.erb', 'README.md'
7
7
  end
8
8
 
9
9
  def remove_public_index
@@ -15,56 +15,57 @@ module Suspenders
15
15
  end
16
16
 
17
17
  def raise_delivery_errors
18
- replace_in_file "config/environments/development.rb", "raise_delivery_errors = false", "raise_delivery_errors = true"
18
+ replace_in_file 'config/environments/development.rb',
19
+ 'raise_delivery_errors = false', 'raise_delivery_errors = true'
19
20
  end
20
21
 
21
22
  def enable_factory_girl_syntax
22
- copy_file "factory_girl_syntax_rspec.rb", "spec/support/factory_girl.rb"
23
- copy_file "factory_girl_syntax_cucumber.rb", "features/support/factory_girl.rb"
23
+ copy_file 'factory_girl_syntax_rspec.rb', 'spec/support/factory_girl.rb'
24
24
  end
25
25
 
26
26
  def setup_staging_environment
27
- run "cp config/environments/production.rb config/environments/staging.rb"
27
+ run 'cp config/environments/production.rb config/environments/staging.rb'
28
28
  end
29
29
 
30
- def create_views_shared
31
- empty_directory "app/views/shared"
30
+ def create_partials_directory
31
+ empty_directory 'app/views/application'
32
32
  end
33
33
 
34
34
  def create_shared_flashes
35
- copy_file "_flashes.html.erb", "app/views/shared/_flashes.html.erb"
35
+ copy_file '_flashes.html.erb', 'app/views/application/_flashes.html.erb'
36
36
  end
37
37
 
38
38
  def create_shared_javascripts
39
- copy_file "_javascript.html.erb", "app/views/shared/_javascript.html.erb"
39
+ copy_file '_javascript.html.erb', 'app/views/application/_javascript.html.erb'
40
40
  end
41
41
 
42
42
  def create_application_layout
43
- template "suspenders_layout.html.erb.erb",
44
- "app/views/layouts/application.html.erb",
45
- :force => true
43
+ template 'suspenders_layout.html.erb.erb',
44
+ 'app/views/layouts/application.html.erb',
45
+ :force => true
46
46
  end
47
47
 
48
48
  def create_common_javascripts
49
- directory "javascripts", "app/assets/javascripts"
49
+ directory 'javascripts', 'app/assets/javascripts'
50
50
  end
51
51
 
52
52
  def add_jquery_ui
53
- inject_into_file "app/assets/javascripts/application.js", "//= require jquery-ui\n", :before => "//= require_tree ."
53
+ inject_into_file 'app/assets/javascripts/application.js',
54
+ '//= require jquery-ui\n', :before => '//= require_tree .'
54
55
  end
55
56
 
56
57
  def use_postgres_config_template
57
- template "postgresql_database.yml.erb", "config/database.yml", :force => true
58
+ template 'postgresql_database.yml.erb', 'config/database.yml', :force => true
58
59
  end
59
60
 
60
61
  def create_database
61
- bundle_command('exec rake db:create')
62
+ bundle_command 'exec rake db:create'
62
63
  end
63
64
 
64
65
  def include_custom_gems
65
66
  additions_path = find_in_source_paths 'Gemfile_additions'
66
67
  new_gems = File.open(additions_path).read
67
- inject_into_file("Gemfile", "\n#{new_gems}", :after => /gem 'jquery-rails'/)
68
+ inject_into_file 'Gemfile', "\n#{new_gems}", :after => /gem 'jquery-rails'/
68
69
  end
69
70
 
70
71
  def configure_rspec
@@ -73,68 +74,66 @@ module Suspenders
73
74
  generate.test_framework :rspec
74
75
  end
75
76
  RUBY
76
- inject_into_class "config/application.rb", "Application", generators_config
77
+ inject_into_class 'config/application.rb', 'Application', generators_config
77
78
  end
78
79
 
79
80
  def configure_action_mailer
80
- action_mailer_host "development", "#{app_name}.local"
81
- action_mailer_host "test", "example.com"
82
- action_mailer_host "staging", "staging.#{app_name}.com"
83
- action_mailer_host "production", "#{app_name}.com"
81
+ action_mailer_host 'development', "#{app_name}.local"
82
+ action_mailer_host 'test', 'example.com'
83
+ action_mailer_host 'staging', "staging.#{app_name}.com"
84
+ action_mailer_host 'production', "#{app_name}.com"
84
85
  end
85
86
 
86
87
  def generate_rspec
87
- generate "rspec:install"
88
- replace_in_file "spec/spec_helper.rb", "# config.mock_with :mocha", "config.mock_with :mocha"
88
+ generate 'rspec:install'
89
+ replace_in_file 'spec/spec_helper.rb',
90
+ '# config.mock_with :mocha', 'config.mock_with :mocha'
89
91
  end
90
92
 
91
93
  def generate_cucumber
92
- generate "cucumber:install", "--rspec", "--capybara"
93
- inject_into_file "features/support/env.rb",
94
- %{Capybara.save_and_open_page_path = 'tmp'\n} +
95
- %{Capybara.javascript_driver = :webkit\n},
96
- :before => %{Capybara.default_selector = :css}
97
- inject_into_file 'config/cucumber.yml', ' -r features', :after => %{default: <%= std_opts %> features}
94
+ generate 'cucumber:install', '--rspec', '--capybara'
95
+ inject_into_file 'features/support/env.rb',
96
+ %{Capybara.save_and_open_page_path = 'tmp'\n} +
97
+ %{Capybara.javascript_driver = :webkit\n},
98
+ :before => %{Capybara.default_selector = :css}
99
+ inject_into_file 'config/cucumber.yml',
100
+ ' -r features', :after => %{default: <%= std_opts %> features}
98
101
  end
99
102
 
100
103
  def generate_clearance
101
- generate "clearance:install"
102
- generate "clearance:features"
103
- end
104
-
105
- def install_factory_girl_steps
106
- copy_file "factory_girl_steps.rb", "features/step_definitions/factory_girl_steps.rb"
104
+ generate 'clearance:install'
105
+ generate 'clearance:features'
107
106
  end
108
107
 
109
108
  def setup_stylesheets
110
- copy_file "app/assets/stylesheets/application.css", "app/assets/stylesheets/application.css.scss"
111
- remove_file "app/assets/stylesheets/application.css"
112
- concat_file "import_scss_styles", "app/assets/stylesheets/application.css.scss"
113
- create_file "app/assets/stylesheets/_screen.scss"
109
+ copy_file 'app/assets/stylesheets/application.css', 'app/assets/stylesheets/application.css.scss'
110
+ remove_file 'app/assets/stylesheets/application.css'
111
+ concat_file 'import_scss_styles', 'app/assets/stylesheets/application.css.scss'
112
+ create_file 'app/assets/stylesheets/_screen.scss'
114
113
  end
115
114
 
116
115
  def gitignore_files
117
- concat_file "suspenders_gitignore", ".gitignore"
118
- ["app/models",
119
- "app/assets/images",
120
- "app/views/pages",
121
- "db/migrate",
122
- "log",
123
- "spec/support",
124
- "spec/lib",
125
- "spec/models",
126
- "spec/views",
127
- "spec/controllers",
128
- "spec/helpers",
129
- "spec/support/matchers",
130
- "spec/support/mixins",
131
- "spec/support/shared_examples"].each do |dir|
116
+ concat_file 'suspenders_gitignore', '.gitignore'
117
+ ['app/models',
118
+ 'app/assets/images',
119
+ 'app/views/pages',
120
+ 'db/migrate',
121
+ 'log',
122
+ 'spec/support',
123
+ 'spec/lib',
124
+ 'spec/models',
125
+ 'spec/views',
126
+ 'spec/controllers',
127
+ 'spec/helpers',
128
+ 'spec/support/matchers',
129
+ 'spec/support/mixins',
130
+ 'spec/support/shared_examples'].each do |dir|
132
131
  empty_directory_with_gitkeep dir
133
132
  end
134
133
  end
135
134
 
136
135
  def init_git
137
- run "git init"
136
+ run 'git init'
138
137
  end
139
138
 
140
139
  def create_heroku_apps
@@ -150,25 +149,25 @@ module Suspenders
150
149
  def document_heroku
151
150
  heroku_readme_path = find_in_source_paths 'HEROKU_README.md'
152
151
  documentation = File.open(heroku_readme_path).read
153
- inject_into_file("README.md", "#{documentation}\n", :before => "Most importantly")
152
+ inject_into_file('README.md', "#{documentation}\n", :before => 'Most importantly')
154
153
  end
155
154
 
156
155
  def copy_miscellaneous_files
157
- copy_file "errors.rb", "config/initializers/errors.rb"
158
- copy_file "time_formats.rb", "config/initializers/time_formats.rb"
159
- copy_file "Procfile"
156
+ copy_file 'errors.rb', 'config/initializers/errors.rb'
157
+ copy_file 'time_formats.rb', 'config/initializers/time_formats.rb'
158
+ copy_file 'Procfile'
160
159
  end
161
160
 
162
161
  def customize_error_pages
163
162
  meta_tags =<<-EOS
164
- <meta charset="utf-8" />
165
- <meta name="ROBOTS" content="NOODP" />
163
+ <meta charset='utf-8' />
164
+ <meta name='ROBOTS' content='NOODP' />
166
165
  EOS
167
166
  style_tags =<<-EOS
168
- <link href="/assets/application.css" media="all" rel="stylesheet" type="text/css" />
167
+ <link href='/assets/application.css' media='all' rel='stylesheet' type='text/css' />
169
168
  EOS
170
169
  %w(500 404 422).each do |page|
171
- inject_into_file "public/#{page}.html", meta_tags, :after => "<head>\n"
170
+ inject_into_file "public/#{page}.html", meta_tags, :after => '<head>\n'
172
171
  replace_in_file "public/#{page}.html", /<style.+>.+<\/style>/mi, style_tags.strip
173
172
  replace_in_file "public/#{page}.html", /<!--.+-->\n/, ''
174
173
  end
@@ -179,27 +178,27 @@ module Suspenders
179
178
  end
180
179
 
181
180
  def set_attr_accessibles_on_user
182
- inject_into_file "app/models/user.rb",
183
- " attr_accessible :email, :password\n",
181
+ inject_into_file 'app/models/user.rb',
182
+ ' attr_accessible :email, :password\n',
184
183
  :after => /include Clearance::User\n/
185
184
  end
186
185
 
187
186
  def add_email_validator
188
- copy_file "email_validator.rb", "app/validators/email_validator.rb"
187
+ copy_file 'email_validator.rb', 'app/validators/email_validator.rb'
189
188
  end
190
189
 
191
190
  def include_clearance_matchers
192
- create_file "spec/support/clearance.rb", "require 'clearance/testing'"
191
+ create_file 'spec/support/clearance.rb', "require 'clearance/testing'"
193
192
  end
194
193
 
195
194
  def setup_default_rake_task
196
- append_file "Rakefile" do
197
- "task(:default).clear\ntask :default => [:spec, :cucumber]"
195
+ append_file 'Rakefile' do
196
+ 'task(:default).clear\ntask :default => [:spec, :cucumber]'
198
197
  end
199
198
  end
200
199
 
201
200
  def add_clearance_gem
202
- inject_into_file("Gemfile", "\ngem 'clearance'", :after => /gem 'jquery-rails'/)
201
+ inject_into_file 'Gemfile', "\ngem 'clearance'", :after => /gem 'jquery-rails'/
203
202
  end
204
203
  end
205
204
  end
@@ -2,19 +2,18 @@ require 'rails/generators'
2
2
  require 'rails/generators/rails/app/app_generator'
3
3
 
4
4
  module Suspenders
5
- class Generator < Rails::Generators::AppGenerator
6
- # let's use postgres by default
7
- class_option :database, :type => :string, :aliases => "-d", :default => "postgresql",
8
- :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
9
- # no Test::Unit by default
10
- class_option :skip_test_unit, :type => :boolean, :aliases => "-T", :default => true,
11
- :desc => "Skip Test::Unit files"
5
+ class AppGenerator < Rails::Generators::AppGenerator
6
+ class_option :database, :type => :string, :aliases => '-d', :default => 'postgresql',
7
+ :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
12
8
 
13
- class_option :heroku, :type => :boolean, :aliases => "-H", :default => false,
14
- :desc => "Create staging and production heroku apps"
9
+ class_option :skip_test_unit, :type => :boolean, :aliases => '-T', :default => true,
10
+ :desc => 'Skip Test::Unit files'
15
11
 
16
- class_option :clearance, :type => :boolean, :aliases => "-C", :default => true,
17
- :desc => "Add the clearance Rails authentication library"
12
+ class_option :heroku, :type => :boolean, :aliases => '-H', :default => false,
13
+ :desc => 'Create staging and production heroku apps'
14
+
15
+ class_option :clearance, :type => :boolean, :aliases => '-C', :default => true,
16
+ :desc => 'Add the clearance Rails authentication library'
18
17
 
19
18
  def finish_template
20
19
  invoke :suspenders_customization
@@ -41,123 +40,122 @@ module Suspenders
41
40
  end
42
41
 
43
42
  def remove_files_we_dont_need
44
- build(:remove_public_index)
45
- build(:remove_rails_logo_image)
43
+ build :remove_public_index
44
+ build :remove_rails_logo_image
46
45
  end
47
46
 
48
47
  def setup_development_environment
49
- say "Setting up the development environment"
50
- build(:raise_delivery_errors)
51
- build(:enable_factory_girl_syntax)
48
+ say 'Setting up the development environment'
49
+ build :raise_delivery_errors
50
+ build :enable_factory_girl_syntax
52
51
  end
53
52
 
54
53
  def setup_staging_environment
55
- say "Setting up the staging environment"
56
- build(:setup_staging_environment)
54
+ say 'Setting up the staging environment'
55
+ build :setup_staging_environment
57
56
  end
58
57
 
59
58
  def create_suspenders_views
60
- say "Creating suspenders views"
61
- build(:create_views_shared)
62
- build(:create_shared_flashes)
63
- build(:create_shared_javascripts)
64
- build(:create_application_layout)
59
+ say 'Creating suspenders views'
60
+ build :create_partials_directory
61
+ build :create_shared_flashes
62
+ build :create_shared_javascripts
63
+ build :create_application_layout
65
64
  end
66
65
 
67
66
  def create_common_javascripts
68
- say "Pulling in some common javascripts"
69
- build(:create_common_javascripts)
67
+ say 'Pulling in some common javascripts'
68
+ build :create_common_javascripts
70
69
  end
71
70
 
72
71
  def add_jquery_ui
73
- say "Add jQuery ui to the standard application.js"
74
- build(:add_jquery_ui)
72
+ say 'Add jQuery ui to the standard application.js'
73
+ build :add_jquery_ui
75
74
  end
76
75
 
77
76
  def customize_gemfile
78
- build(:include_custom_gems)
77
+ build :include_custom_gems
79
78
  if options[:clearance]
80
- build(:add_clearance_gem)
79
+ build :add_clearance_gem
81
80
  end
82
- bundle_command('install')
81
+ bundle_command 'install'
83
82
  end
84
83
 
85
84
  def setup_database
86
- say "Setting up database"
85
+ say 'Setting up database'
87
86
  if 'postgresql' == options[:database]
88
- build(:use_postgres_config_template)
87
+ build :use_postgres_config_template
89
88
  end
90
- build(:create_database)
89
+ build :create_database
91
90
  end
92
91
 
93
92
  def configure_app
94
- say "Configuring app"
95
- build(:configure_rspec)
96
- build(:configure_action_mailer)
97
- build(:generate_rspec)
98
- build(:generate_cucumber)
99
- build(:install_factory_girl_steps)
100
- build(:add_email_validator)
101
- build(:setup_default_rake_task)
102
- build(:setup_clearance)
93
+ say 'Configuring app'
94
+ build :configure_rspec
95
+ build :configure_action_mailer
96
+ build :generate_rspec
97
+ build :generate_cucumber
98
+ build :add_email_validator
99
+ build :setup_default_rake_task
100
+ build :setup_clearance
103
101
  end
104
102
 
105
103
  def setup_clearance
106
104
  if options[:clearance]
107
- build(:generate_clearance)
108
- build(:include_clearance_matchers)
105
+ build :generate_clearance
106
+ build :include_clearance_matchers
109
107
  if using_active_record?
110
- build(:set_attr_accessibles_on_user)
108
+ build :set_attr_accessibles_on_user
111
109
  end
112
110
  end
113
111
  end
114
112
 
115
113
  def setup_stylesheets
116
- say "Set up stylesheets"
117
- build(:setup_stylesheets)
114
+ say 'Set up stylesheets'
115
+ build :setup_stylesheets
118
116
  end
119
117
 
120
118
  def setup_git
121
- say "Initializing git"
119
+ say 'Initializing git'
122
120
  invoke :setup_gitignore
123
121
  invoke :init_git
124
122
  end
125
123
 
126
124
  def create_heroku_apps
127
125
  if options['heroku']
128
- say "Creating heroku apps"
129
- build(:create_heroku_apps)
130
- build(:document_heroku)
126
+ say 'Creating heroku apps'
127
+ build :create_heroku_apps
128
+ build :document_heroku
131
129
  end
132
130
  end
133
131
 
134
132
  def setup_gitignore
135
- build(:gitignore_files)
133
+ build :gitignore_files
136
134
  end
137
135
 
138
136
  def init_git
139
- build(:init_git)
137
+ build :init_git
140
138
  end
141
139
 
142
140
  def copy_miscellaneous_files
143
- say "Copying miscellaneous support files"
144
- build(:copy_miscellaneous_files)
141
+ say 'Copying miscellaneous support files'
142
+ build :copy_miscellaneous_files
145
143
  end
146
144
 
147
145
  def customize_error_pages
148
- say "Customizing the 500/404/422 pages"
149
- build(:customize_error_pages)
146
+ say 'Customizing the 500/404/422 pages'
147
+ build :customize_error_pages
150
148
  end
151
149
 
152
150
  def setup_root_route
153
151
  if options[:clearance]
154
- say "Setting up a root route"
155
- build(:setup_root_route)
152
+ say 'Setting up a root route'
153
+ build :setup_root_route
156
154
  end
157
155
  end
158
156
 
159
157
  def outro
160
- say "Congratulations! You just pulled our suspenders."
158
+ say 'Congratulations! You just pulled our suspenders.'
161
159
  say "Remember to run 'rails generate airbrake' with your API key."
162
160
  end
163
161
 
@@ -1,3 +1,3 @@
1
1
  module Suspenders
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -1,4 +1,3 @@
1
- db/schema.rb
2
1
  public/system
3
2
  *.DS_Store
4
3
  coverage/*
@@ -15,8 +15,8 @@
15
15
  <%%= link_to "Sign in", sign_in_path %>
16
16
  <%% end -%>
17
17
  </header>
18
- <%%= render 'shared/flashes' -%>
18
+ <%%= render 'flashes' -%>
19
19
  <%%= yield %>
20
- <%%= render 'shared/javascript' %>
20
+ <%%= render 'javascript' %>
21
21
  </body>
22
22
  </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suspenders
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-11 00:00:00.000000000 Z
12
+ date: 2012-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -122,8 +122,6 @@ files:
122
122
  - templates/_javascript.html.erb
123
123
  - templates/email_validator.rb
124
124
  - templates/errors.rb
125
- - templates/factory_girl_steps.rb
126
- - templates/factory_girl_syntax_cucumber.rb
127
125
  - templates/factory_girl_syntax_rspec.rb
128
126
  - templates/import_scss_styles
129
127
  - templates/javascripts/prefilled_input.js
@@ -144,18 +142,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
142
  - - ! '>='
145
143
  - !ruby/object:Gem::Version
146
144
  version: '0'
147
- segments:
148
- - 0
149
- hash: 1021739957831646571
150
145
  required_rubygems_version: !ruby/object:Gem::Requirement
151
146
  none: false
152
147
  requirements:
153
148
  - - ! '>='
154
149
  - !ruby/object:Gem::Version
155
150
  version: '0'
156
- segments:
157
- - 0
158
- hash: 1021739957831646571
159
151
  requirements: []
160
152
  rubyforge_project:
161
153
  rubygems_version: 1.8.24
@@ -1 +0,0 @@
1
- require 'factory_girl/step_definitions'
@@ -1 +0,0 @@
1
- World(FactoryGirl::Syntax::Methods)