railslove-suspenders 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/.travis.yml +6 -0
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +94 -0
- data/LICENSE +21 -0
- data/NEWS.md +99 -0
- data/README.md +125 -0
- data/Rakefile +8 -0
- data/bin/railslove-suspenders +16 -0
- data/features/github_repo.feature +8 -0
- data/features/heroku_true.feature +9 -0
- data/features/rake_clean.feature +15 -0
- data/features/step_definitions/suspenders_steps.rb +68 -0
- data/features/support/bin/heroku +5 -0
- data/features/support/bin/hub +5 -0
- data/features/support/env.rb +10 -0
- data/features/support/fake_github.rb +21 -0
- data/features/support/fake_heroku.rb +21 -0
- data/lib/railslove-suspenders/actions.rb +40 -0
- data/lib/railslove-suspenders/app_builder.rb +335 -0
- data/lib/railslove-suspenders/generators/app_generator.rb +202 -0
- data/lib/railslove-suspenders/version.rb +4 -0
- data/railslove-suspenders.gemspec +33 -0
- data/templates/Gemfile_clean +42 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +9 -0
- data/templates/_flashes.html.haml +3 -0
- data/templates/_javascript.html.haml +3 -0
- data/templates/background_jobs_rspec.rb +19 -0
- data/templates/bin_setup +11 -0
- data/templates/config_locales_en.yml +11 -0
- data/templates/database_cleaner_rspec.rb +21 -0
- data/templates/disable_xml_params.rb +3 -0
- data/templates/email_validator.rb +7 -0
- data/templates/errors.rb +28 -0
- data/templates/factories_spec.rb +14 -0
- data/templates/factories_spec_rake_task.rb +9 -0
- data/templates/factory_girl_syntax_rspec.rb +3 -0
- data/templates/import_scss_styles +3 -0
- data/templates/javascripts/prefilled_input.js +59 -0
- data/templates/postgresql_database.yml.erb +11 -0
- data/templates/rack_timeout.rb +1 -0
- data/templates/rspec +3 -0
- data/templates/sample.env +2 -0
- data/templates/simplecov_init.rb +3 -0
- data/templates/smtp.rb +10 -0
- data/templates/strong_parameters.rb +1 -0
- data/templates/stylesheets/_shame.css.sass +0 -0
- data/templates/stylesheets/application.css.sass +14 -0
- data/templates/stylesheets/base/_colors.css.sass +7 -0
- data/templates/stylesheets/base/_dimension.css.sass +2 -0
- data/templates/stylesheets/base/_element_defaults.css.sass +5 -0
- data/templates/stylesheets/base/_global_mixins.css.sass +3 -0
- data/templates/stylesheets/base/_icon_font.css.sass +0 -0
- data/templates/stylesheets/base/_sprites.css.sass +0 -0
- data/templates/stylesheets/base/_typography.css.sass +3 -0
- data/templates/suspenders_gitignore +10 -0
- data/templates/suspenders_layout.html.haml +12 -0
- data/templates/unicorn.rb +26 -0
- metadata +175 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.before(:suite) do
|
3
|
+
DatabaseCleaner.clean_with(:deletion)
|
4
|
+
end
|
5
|
+
|
6
|
+
config.before(:each) do
|
7
|
+
DatabaseCleaner.strategy = :transaction
|
8
|
+
end
|
9
|
+
|
10
|
+
config.before(:each, :js => true) do
|
11
|
+
DatabaseCleaner.strategy = :deletion
|
12
|
+
end
|
13
|
+
|
14
|
+
config.before(:each) do
|
15
|
+
DatabaseCleaner.start
|
16
|
+
end
|
17
|
+
|
18
|
+
config.after(:each) do
|
19
|
+
DatabaseCleaner.clean
|
20
|
+
end
|
21
|
+
end
|
data/templates/errors.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'net/smtp'
|
3
|
+
|
4
|
+
# Example:
|
5
|
+
# begin
|
6
|
+
# some http call
|
7
|
+
# rescue *HTTP_ERRORS => error
|
8
|
+
# notify_hoptoad error
|
9
|
+
# end
|
10
|
+
|
11
|
+
HTTP_ERRORS = [Timeout::Error,
|
12
|
+
Errno::EINVAL,
|
13
|
+
Errno::ECONNRESET,
|
14
|
+
EOFError,
|
15
|
+
Net::HTTPBadResponse,
|
16
|
+
Net::HTTPHeaderSyntaxError,
|
17
|
+
Net::ProtocolError]
|
18
|
+
|
19
|
+
SMTP_SERVER_ERRORS = [TimeoutError,
|
20
|
+
IOError,
|
21
|
+
Net::SMTPUnknownError,
|
22
|
+
Net::SMTPServerBusy,
|
23
|
+
Net::SMTPAuthenticationError]
|
24
|
+
|
25
|
+
SMTP_CLIENT_ERRORS = [Net::SMTPFatalError,
|
26
|
+
Net::SMTPSyntaxError]
|
27
|
+
|
28
|
+
SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'validate FactoryGirl factories' do
|
4
|
+
FactoryGirl.factories.each do |factory|
|
5
|
+
context "with factory for :#{factory.name}" do
|
6
|
+
subject { FactoryGirl.build(factory.name) }
|
7
|
+
|
8
|
+
it 'is valid' do
|
9
|
+
is_valid = subject.valid?
|
10
|
+
expect(is_valid).to be_true, subject.errors.full_messages.join(',')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
// clear inputs with starter values
|
2
|
+
new function($) {
|
3
|
+
$.fn.prefilledInput = function() {
|
4
|
+
|
5
|
+
var focus = function () {
|
6
|
+
$(this).removeClass('prefilled');
|
7
|
+
if (this.value == this.prefilledValue) {
|
8
|
+
this.value = '';
|
9
|
+
}
|
10
|
+
};
|
11
|
+
|
12
|
+
var blur = function () {
|
13
|
+
if (this.value == '') {
|
14
|
+
$(this).addClass('prefilled').val(this.prefilledValue);
|
15
|
+
} else if (this.value != this.prefilledValue) {
|
16
|
+
$(this).removeClass('prefilled');
|
17
|
+
}
|
18
|
+
};
|
19
|
+
|
20
|
+
var extractPrefilledValue = function () {
|
21
|
+
if (this.title) {
|
22
|
+
this.prefilledValue = this.title;
|
23
|
+
this.title = '';
|
24
|
+
} else if (this.id) {
|
25
|
+
this.prefilledValue = $('label[for=' + this.id + ']').hide().text();
|
26
|
+
}
|
27
|
+
if (this.prefilledValue) {
|
28
|
+
this.prefilledValue = this.prefilledValue.replace(/\*$/, '');
|
29
|
+
}
|
30
|
+
};
|
31
|
+
|
32
|
+
var initialize = function (index) {
|
33
|
+
if (!this.prefilledValue) {
|
34
|
+
this.extractPrefilledValue = extractPrefilledValue;
|
35
|
+
this.extractPrefilledValue();
|
36
|
+
$(this).trigger('blur');
|
37
|
+
}
|
38
|
+
};
|
39
|
+
|
40
|
+
return this.filter(":input").
|
41
|
+
focus(focus).
|
42
|
+
blur(blur).
|
43
|
+
each(initialize);
|
44
|
+
};
|
45
|
+
|
46
|
+
var clearPrefilledInputs = function () {
|
47
|
+
var form = this.form || this;
|
48
|
+
$(form).find("input.prefilled, textarea.prefilled").val("");
|
49
|
+
};
|
50
|
+
|
51
|
+
var prefilledSetup = function () {
|
52
|
+
$('input.prefilled, textarea.prefilled').prefilledInput();
|
53
|
+
$('form').submit(clearPrefilledInputs);
|
54
|
+
$('input:submit, button:submit').click(clearPrefilledInputs);
|
55
|
+
};
|
56
|
+
|
57
|
+
$(document).ready(prefilledSetup);
|
58
|
+
$(document).ajaxComplete(prefilledSetup);
|
59
|
+
}(jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
Rack::Timeout.timeout = (ENV['TIMEOUT_IN_SECONDS'] || 5).to_i
|
data/templates/rspec
ADDED
data/templates/smtp.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
if Rails.env.staging? || Rails.env.production?
|
2
|
+
SMTP_SETTINGS = {
|
3
|
+
address: ENV['SMTP_ADDRESS'], # example: 'smtp.sendgrid.net'
|
4
|
+
authentication: :plain,
|
5
|
+
domain: ENV['SMTP_DOMAIN'], # example: 'this-app.com'
|
6
|
+
password: ENV['SMTP_PASSWORD'],
|
7
|
+
port: '587',
|
8
|
+
user_name: ENV['SMTP_USERNAME']
|
9
|
+
}
|
10
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ActiveRecord::Base.send :include, ActiveModel::ForbiddenAttributesProtection
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// gems
|
2
|
+
@import compass
|
3
|
+
|
4
|
+
// base
|
5
|
+
@import base/colors
|
6
|
+
@import base/dimensions
|
7
|
+
@import base/global_mixins
|
8
|
+
@import base/element_defaults
|
9
|
+
@import base/icon_font
|
10
|
+
@import base/sprites
|
11
|
+
@import base/typography
|
12
|
+
|
13
|
+
@import layout/*
|
14
|
+
@import modules/*
|
File without changes
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:charset => "utf-8"}/
|
5
|
+
%meta{:content => "NOODP", :name => "ROBOTS"}/
|
6
|
+
%title = page_title
|
7
|
+
= stylesheet_link_tag :application, :media => 'all'
|
8
|
+
= csrf_meta_tags
|
9
|
+
%body{class: controller_name, id: "#{controller_name}_#{action_name}"}
|
10
|
+
= render 'flashes'
|
11
|
+
= yield
|
12
|
+
= render 'javascript'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# https://devcenter.heroku.com/articles/rails-unicorn
|
2
|
+
|
3
|
+
worker_processes (ENV['WEB_CONCURRENCY'] || 3).to_i
|
4
|
+
timeout (ENV['WEB_TIMEOUT'] || 5).to_i
|
5
|
+
preload_app true
|
6
|
+
|
7
|
+
before_fork do |server, worker|
|
8
|
+
Signal.trap 'TERM' do
|
9
|
+
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
|
10
|
+
Process.kill 'QUIT', Process.pid
|
11
|
+
end
|
12
|
+
|
13
|
+
if defined? ActiveRecord::Base
|
14
|
+
ActiveRecord::Base.connection.disconnect!
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
after_fork do |server, worker|
|
19
|
+
Signal.trap 'TERM' do
|
20
|
+
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
|
21
|
+
end
|
22
|
+
|
23
|
+
if defined? ActiveRecord::Base
|
24
|
+
ActiveRecord::Base.establish_connection
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: railslove-suspenders
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- stephanpavlovic
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-06-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: hub
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.10'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.10'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rails
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - '='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.2.13
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.2.13
|
62
|
+
description: ! 'Suspenders is a base Rails project that you can upgrade. It is used
|
63
|
+
by
|
64
|
+
|
65
|
+
thoughtbot to get a jump start on a working app. Use Suspenders if you''re in a
|
66
|
+
|
67
|
+
rush to build something amazing; don''t use it if you like missing deadlines.
|
68
|
+
|
69
|
+
'
|
70
|
+
email: stephan@railslove.com
|
71
|
+
executables:
|
72
|
+
- railslove-suspenders
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files:
|
75
|
+
- README.md
|
76
|
+
- LICENSE
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- .travis.yml
|
80
|
+
- CONTRIBUTING.md
|
81
|
+
- Gemfile
|
82
|
+
- Gemfile.lock
|
83
|
+
- LICENSE
|
84
|
+
- NEWS.md
|
85
|
+
- README.md
|
86
|
+
- Rakefile
|
87
|
+
- bin/railslove-suspenders
|
88
|
+
- features/github_repo.feature
|
89
|
+
- features/heroku_true.feature
|
90
|
+
- features/rake_clean.feature
|
91
|
+
- features/step_definitions/suspenders_steps.rb
|
92
|
+
- features/support/bin/heroku
|
93
|
+
- features/support/bin/hub
|
94
|
+
- features/support/env.rb
|
95
|
+
- features/support/fake_github.rb
|
96
|
+
- features/support/fake_heroku.rb
|
97
|
+
- lib/railslove-suspenders/actions.rb
|
98
|
+
- lib/railslove-suspenders/app_builder.rb
|
99
|
+
- lib/railslove-suspenders/generators/app_generator.rb
|
100
|
+
- lib/railslove-suspenders/version.rb
|
101
|
+
- railslove-suspenders.gemspec
|
102
|
+
- templates/Gemfile_clean
|
103
|
+
- templates/Procfile
|
104
|
+
- templates/README.md.erb
|
105
|
+
- templates/_flashes.html.haml
|
106
|
+
- templates/_javascript.html.haml
|
107
|
+
- templates/background_jobs_rspec.rb
|
108
|
+
- templates/bin_setup
|
109
|
+
- templates/config_locales_en.yml
|
110
|
+
- templates/database_cleaner_rspec.rb
|
111
|
+
- templates/disable_xml_params.rb
|
112
|
+
- templates/email_validator.rb
|
113
|
+
- templates/errors.rb
|
114
|
+
- templates/factories_spec.rb
|
115
|
+
- templates/factories_spec_rake_task.rb
|
116
|
+
- templates/factory_girl_syntax_rspec.rb
|
117
|
+
- templates/import_scss_styles
|
118
|
+
- templates/javascripts/prefilled_input.js
|
119
|
+
- templates/postgresql_database.yml.erb
|
120
|
+
- templates/rack_timeout.rb
|
121
|
+
- templates/rspec
|
122
|
+
- templates/sample.env
|
123
|
+
- templates/simplecov_init.rb
|
124
|
+
- templates/smtp.rb
|
125
|
+
- templates/strong_parameters.rb
|
126
|
+
- templates/stylesheets/_shame.css.sass
|
127
|
+
- templates/stylesheets/application.css.sass
|
128
|
+
- templates/stylesheets/base/_colors.css.sass
|
129
|
+
- templates/stylesheets/base/_dimension.css.sass
|
130
|
+
- templates/stylesheets/base/_element_defaults.css.sass
|
131
|
+
- templates/stylesheets/base/_global_mixins.css.sass
|
132
|
+
- templates/stylesheets/base/_icon_font.css.sass
|
133
|
+
- templates/stylesheets/base/_sprites.css.sass
|
134
|
+
- templates/stylesheets/base/_typography.css.sass
|
135
|
+
- templates/suspenders_gitignore
|
136
|
+
- templates/suspenders_layout.html.haml
|
137
|
+
- templates/unicorn.rb
|
138
|
+
homepage: http://github.com/railslove/railslove-suspenders
|
139
|
+
licenses: []
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options:
|
142
|
+
- --charset=UTF-8
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 1.9.2
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
153
|
+
requirements:
|
154
|
+
- - ! '>='
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
segments:
|
158
|
+
- 0
|
159
|
+
hash: -4278784182071573656
|
160
|
+
requirements: []
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 1.8.21
|
163
|
+
signing_key:
|
164
|
+
specification_version: 3
|
165
|
+
summary: Generate a Rails app using thoughtbot's best practices.
|
166
|
+
test_files:
|
167
|
+
- features/github_repo.feature
|
168
|
+
- features/heroku_true.feature
|
169
|
+
- features/rake_clean.feature
|
170
|
+
- features/step_definitions/suspenders_steps.rb
|
171
|
+
- features/support/bin/heroku
|
172
|
+
- features/support/bin/hub
|
173
|
+
- features/support/env.rb
|
174
|
+
- features/support/fake_github.rb
|
175
|
+
- features/support/fake_heroku.rb
|