da-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/.gitignore +4 -4
- data/CHANGELOG.md +13 -0
- data/LICENSE +21 -21
- data/README.md +62 -62
- data/Rakefile +40 -40
- data/bin/da-suspenders +0 -0
- data/da-suspenders.gemspec +26 -26
- data/features/running_cucumber.feature +17 -17
- data/features/step_definitions/shell.rb +30 -30
- data/features/support/env.rb +1 -1
- data/lib/create.rb +55 -55
- data/lib/da-suspenders/version.rb +2 -2
- data/lib/errors.rb +12 -12
- data/template/da-suspenders.rb +172 -165
- data/template/files/factory_girl_steps.rb +1 -1
- data/template/files/mysql_database.yml.erb +39 -39
- data/template/trout/Gemfile +30 -30
- data/template/trout/app/helpers/body_class_helper.rb +6 -6
- data/template/trout/app/javascripts/application.js +10 -10
- data/template/trout/app/views/layouts/application.html.erb +15 -15
- data/template/trout/app/views/shared/_flashes.html.erb +5 -5
- data/template/trout/config/initializers/errors.rb +26 -26
- data/template/trout/features/step_definitions/js_steps.rb +3 -3
- data/template/trout/lib/templates/erb/scaffold/_form.html.erb +13 -13
- data/template/trout/vendor/sprockets/jquery-ujs/src/rails.js +169 -169
- data/template/trout/vendor/sprockets/modernizr/src/modernizr.js +29 -29
- metadata +17 -5
@@ -1,3 +1,3 @@
|
|
1
|
-
module DaSuspenders
|
2
|
-
VERSION = "1.0.
|
1
|
+
module DaSuspenders
|
2
|
+
VERSION = "1.0.1"
|
3
3
|
end
|
data/lib/errors.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# User errors
|
2
|
-
|
3
|
-
module DaSuspenders
|
4
|
-
class InvalidInput < Exception; end
|
5
|
-
|
6
|
-
module Errors
|
7
|
-
def error_with_message(msg)
|
8
|
-
STDERR.puts msg
|
9
|
-
exit 1
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
1
|
+
# User errors
|
2
|
+
|
3
|
+
module DaSuspenders
|
4
|
+
class InvalidInput < Exception; end
|
5
|
+
|
6
|
+
module Errors
|
7
|
+
def error_with_message(msg)
|
8
|
+
STDERR.puts msg
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/template/da-suspenders.rb
CHANGED
@@ -1,166 +1,173 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
require "pathname"
|
3
|
-
require "trout"
|
4
|
-
|
5
|
-
template_root = File.expand_path(File.join(File.dirname(__FILE__)))
|
6
|
-
source_paths << File.join(template_root, "files")
|
7
|
-
|
8
|
-
# Helpers
|
9
|
-
|
10
|
-
def action_mailer_host(rails_env, host)
|
11
|
-
inject_into_file(
|
12
|
-
"config/environments/#{rails_env}.rb",
|
13
|
-
"\n\n config.action_mailer.default_url_options = { :host => '#{host}' }",
|
14
|
-
:before => "\nend"
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
def origin
|
19
|
-
"git://github.com/die-antwort/da-suspenders.git"
|
20
|
-
end
|
21
|
-
|
22
|
-
def trout(destination_path)
|
23
|
-
parent = Pathname.new(destination_path).parent
|
24
|
-
FileUtils.mkdir_p(parent) unless File.exists?(parent)
|
25
|
-
run "trout checkout --source-root=template/trout #{destination_path} #{origin}"
|
26
|
-
end
|
27
|
-
|
28
|
-
# Actions
|
29
|
-
|
30
|
-
def create_gemfile_and_install_gems
|
31
|
-
say "Creating Gemfile and installing gems (this may take a while)", :yellow
|
32
|
-
trout "Gemfile"
|
33
|
-
run "bundle install"
|
34
|
-
end
|
35
|
-
|
36
|
-
def add_staging_environment
|
37
|
-
say "Adding staging environment", :yellow
|
38
|
-
run "cp config/environments/production.rb config/environments/staging.rb"
|
39
|
-
end
|
40
|
-
|
41
|
-
def setup_action_mailer
|
42
|
-
say "Setting up action mailer config", :yellow
|
43
|
-
action_mailer_host "development", "localhost:3000"
|
44
|
-
action_mailer_host "test", "example.com"
|
45
|
-
action_mailer_host "staging", "#{app_name}.dev.die-antwort.eu"
|
46
|
-
action_mailer_host "production", "FIXME"
|
47
|
-
end
|
48
|
-
|
49
|
-
def setup_database
|
50
|
-
say "Setting up database config", :yellow
|
51
|
-
template "mysql_database.yml.erb", "config/database.yml", :force => true
|
52
|
-
rake "db:create"
|
53
|
-
end
|
54
|
-
|
55
|
-
def setup_german_locale
|
56
|
-
say "Setting up german locale", :yellow
|
57
|
-
trout "config/locales/de.yml"
|
58
|
-
gsub_file 'config/application.rb', '# config.i18n.default_locale = :de', 'config.i18n.default_locale = :de'
|
59
|
-
end
|
60
|
-
|
61
|
-
def setup_viennese_timezone
|
62
|
-
say "Setting up viennese timezone", :yellow
|
63
|
-
gsub_file 'config/application.rb', "# config.time_zone = 'Central Time (US & Canada)'", "config.time_zone = 'Vienna'"
|
64
|
-
end
|
65
|
-
|
66
|
-
def
|
67
|
-
say "
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
RUBY
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
trout "
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
def
|
95
|
-
say "Installing
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
1
|
+
require "fileutils"
|
2
|
+
require "pathname"
|
3
|
+
require "trout"
|
4
|
+
|
5
|
+
template_root = File.expand_path(File.join(File.dirname(__FILE__)))
|
6
|
+
source_paths << File.join(template_root, "files")
|
7
|
+
|
8
|
+
# Helpers
|
9
|
+
|
10
|
+
def action_mailer_host(rails_env, host)
|
11
|
+
inject_into_file(
|
12
|
+
"config/environments/#{rails_env}.rb",
|
13
|
+
"\n\n config.action_mailer.default_url_options = { :host => '#{host}' }",
|
14
|
+
:before => "\nend"
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def origin
|
19
|
+
"git://github.com/die-antwort/da-suspenders.git"
|
20
|
+
end
|
21
|
+
|
22
|
+
def trout(destination_path)
|
23
|
+
parent = Pathname.new(destination_path).parent
|
24
|
+
FileUtils.mkdir_p(parent) unless File.exists?(parent)
|
25
|
+
run "trout checkout --source-root=template/trout #{destination_path} #{origin}"
|
26
|
+
end
|
27
|
+
|
28
|
+
# Actions
|
29
|
+
|
30
|
+
def create_gemfile_and_install_gems
|
31
|
+
say "Creating Gemfile and installing gems (this may take a while)", :yellow
|
32
|
+
trout "Gemfile"
|
33
|
+
run "bundle install"
|
34
|
+
end
|
35
|
+
|
36
|
+
def add_staging_environment
|
37
|
+
say "Adding staging environment", :yellow
|
38
|
+
run "cp config/environments/production.rb config/environments/staging.rb"
|
39
|
+
end
|
40
|
+
|
41
|
+
def setup_action_mailer
|
42
|
+
say "Setting up action mailer config", :yellow
|
43
|
+
action_mailer_host "development", "localhost:3000"
|
44
|
+
action_mailer_host "test", "example.com"
|
45
|
+
action_mailer_host "staging", "#{app_name}.dev.die-antwort.eu"
|
46
|
+
action_mailer_host "production", "FIXME"
|
47
|
+
end
|
48
|
+
|
49
|
+
def setup_database
|
50
|
+
say "Setting up database config", :yellow
|
51
|
+
template "mysql_database.yml.erb", "config/database.yml", :force => true
|
52
|
+
rake "db:create"
|
53
|
+
end
|
54
|
+
|
55
|
+
def setup_german_locale
|
56
|
+
say "Setting up german locale", :yellow
|
57
|
+
trout "config/locales/de.yml"
|
58
|
+
gsub_file 'config/application.rb', '# config.i18n.default_locale = :de', 'config.i18n.default_locale = :de'
|
59
|
+
end
|
60
|
+
|
61
|
+
def setup_viennese_timezone
|
62
|
+
say "Setting up viennese timezone", :yellow
|
63
|
+
gsub_file 'config/application.rb', "# config.time_zone = 'Central Time (US & Canada)'", "config.time_zone = 'Vienna'"
|
64
|
+
end
|
65
|
+
|
66
|
+
def disable_timestamped_migrations
|
67
|
+
say "Disabling timestamped migrations", :yellow
|
68
|
+
inject_into_class "config/application.rb", "Application", "\n config.active_record.timestamped_migrations = false\n\n"
|
69
|
+
end
|
70
|
+
|
71
|
+
def update_generators_config
|
72
|
+
say "Updating config for generators", :yellow
|
73
|
+
generators_config = <<-RUBY
|
74
|
+
config.generators do |generate|
|
75
|
+
generate.stylesheets false
|
76
|
+
generate.test_framework :rspec
|
77
|
+
end
|
78
|
+
RUBY
|
79
|
+
inject_into_class "config/application.rb", "Application", generators_config
|
80
|
+
end
|
81
|
+
|
82
|
+
def create_application_layout_and_views
|
83
|
+
say "Creating application layout and shared views", :yellow
|
84
|
+
trout "app/views/layouts/application.html.erb"
|
85
|
+
trout "app/views/shared/_flashes.html.erb"
|
86
|
+
end
|
87
|
+
|
88
|
+
def install_misc_support_files
|
89
|
+
say "Installing miscellaneous support files", :yellow
|
90
|
+
trout "config/initializers/errors.rb"
|
91
|
+
trout "app/helpers/body_class_helper.rb"
|
92
|
+
end
|
93
|
+
|
94
|
+
def install_app_config
|
95
|
+
say "Installing app_config", :yellow
|
96
|
+
generate "app_config:install staging"
|
97
|
+
end
|
98
|
+
|
99
|
+
def install_compass
|
100
|
+
say "Installing compass", :yellow
|
101
|
+
run "compass init rails . --sass-dir app/stylesheets --css-dir public/stylesheets -q"
|
102
|
+
inside 'app/stylesheets' do
|
103
|
+
remove_file 'ie.scss'
|
104
|
+
remove_file 'print.scss'
|
105
|
+
remove_file 'screen.scss'
|
106
|
+
empty_directory 'content'
|
107
|
+
empty_directory 'vendor'
|
108
|
+
end
|
109
|
+
trout "app/stylesheets/application.scss"
|
110
|
+
trout "app/stylesheets/ie.scss"
|
111
|
+
end
|
112
|
+
|
113
|
+
def install_formtastic
|
114
|
+
say "Installing formtastic", :yellow
|
115
|
+
generate "formtastic:install"
|
116
|
+
remove_file "public/stylesheets/formtastic.css"
|
117
|
+
remove_file "public/stylesheets/formtastic-changes.css"
|
118
|
+
trout "lib/templates/erb/scaffold/_form.html.erb"
|
119
|
+
end
|
120
|
+
|
121
|
+
def install_sprockets_and_jquery
|
122
|
+
say "Installing sprockets, jQuery, and some other javascripts", :yellow
|
123
|
+
plugin 'sprockets-rails', :git => 'git://github.com/gmoeck/sprockets-rails.git'
|
124
|
+
plugin 'jrails', :git => 'git://github.com/die-antwort/jrails.git'
|
125
|
+
route 'SprocketsApplication.routes(self)'
|
126
|
+
remove_dir 'public/javascripts'
|
127
|
+
remove_file "app/javascripts/application.js"
|
128
|
+
trout "app/javascripts/application.js"
|
129
|
+
trout "vendor/sprockets/modernizr/src/modernizr.js"
|
130
|
+
trout "vendor/sprockets/jquery-ujs/src/rails.js"
|
131
|
+
end
|
132
|
+
|
133
|
+
def install_rspec_and_cucumber
|
134
|
+
say "Installing rspec and cucumber", :yellow
|
135
|
+
generate "rspec:install"
|
136
|
+
generate "cucumber:install", "--rspec --capybara"
|
137
|
+
inject_into_file "features/support/env.rb",
|
138
|
+
%{Capybara.save_and_open_page_path = "tmp"\n} +
|
139
|
+
%{Capybara.javascript_driver = :akephalos\n},
|
140
|
+
:before => %{Capybara.default_selector = :css}
|
141
|
+
inject_into_file "features/support/paths.rb",
|
142
|
+
%{ when %r{"(/.*)?"}\n} +
|
143
|
+
%{ $1\n\n},
|
144
|
+
:before => " else"
|
145
|
+
copy_file "factory_girl_steps.rb", "features/step_definitions/factory_girl_steps.rb"
|
146
|
+
trout "features/step_definitions/js_steps.rb"
|
147
|
+
end
|
148
|
+
|
149
|
+
def cleanup
|
150
|
+
say "Cleaning up", :yellow
|
151
|
+
remove_file 'README'
|
152
|
+
remove_file 'public/index.html'
|
153
|
+
remove_file 'public/images/rails.png'
|
154
|
+
end
|
155
|
+
|
156
|
+
create_gemfile_and_install_gems
|
157
|
+
add_staging_environment
|
158
|
+
setup_database
|
159
|
+
setup_german_locale
|
160
|
+
setup_viennese_timezone
|
161
|
+
disable_timestamped_migrations
|
162
|
+
update_generators_config
|
163
|
+
create_application_layout_and_views
|
164
|
+
install_misc_support_files
|
165
|
+
install_app_config
|
166
|
+
install_compass
|
167
|
+
install_formtastic
|
168
|
+
install_sprockets_and_jquery
|
169
|
+
install_rspec_and_cucumber
|
170
|
+
cleanup
|
171
|
+
|
172
|
+
say "Rails app #{app_name} has been created successully!", :blue
|
166
173
|
say "Remember to run 'rails generate hoptoad' with your API key.", :blue
|
@@ -1 +1 @@
|
|
1
|
-
require 'factory_girl/step_definitions'
|
1
|
+
require 'factory_girl/step_definitions'
|
@@ -1,39 +1,39 @@
|
|
1
|
-
development:
|
2
|
-
adapter: mysql
|
3
|
-
encoding: utf8
|
4
|
-
reconnect: false
|
5
|
-
database: <%= app_name %>_dev
|
6
|
-
pool: 5
|
7
|
-
username: root
|
8
|
-
password: root
|
9
|
-
host: localhost
|
10
|
-
|
11
|
-
test:
|
12
|
-
adapter: mysql
|
13
|
-
encoding: utf8
|
14
|
-
reconnect: false
|
15
|
-
database: <%= app_name %>_test
|
16
|
-
pool: 5
|
17
|
-
username: root
|
18
|
-
password: root
|
19
|
-
host: localhost
|
20
|
-
|
21
|
-
staging:
|
22
|
-
adapter: mysql
|
23
|
-
encoding: utf8
|
24
|
-
reconnect: false
|
25
|
-
database: <%= app_name %>_staging
|
26
|
-
pool: 5
|
27
|
-
username: <%= app_name %>_s
|
28
|
-
password:
|
29
|
-
host: localhost
|
30
|
-
|
31
|
-
production:
|
32
|
-
adapter: mysql
|
33
|
-
encoding: utf8
|
34
|
-
reconnect: false
|
35
|
-
database: <%= app_name %>
|
36
|
-
pool: 5
|
37
|
-
username: <%= app_name %>
|
38
|
-
password:
|
39
|
-
host: localhost
|
1
|
+
development:
|
2
|
+
adapter: mysql
|
3
|
+
encoding: utf8
|
4
|
+
reconnect: false
|
5
|
+
database: <%= app_name %>_dev
|
6
|
+
pool: 5
|
7
|
+
username: root
|
8
|
+
password: root
|
9
|
+
host: localhost
|
10
|
+
|
11
|
+
test:
|
12
|
+
adapter: mysql
|
13
|
+
encoding: utf8
|
14
|
+
reconnect: false
|
15
|
+
database: <%= app_name %>_test
|
16
|
+
pool: 5
|
17
|
+
username: root
|
18
|
+
password: root
|
19
|
+
host: localhost
|
20
|
+
|
21
|
+
staging:
|
22
|
+
adapter: mysql
|
23
|
+
encoding: utf8
|
24
|
+
reconnect: false
|
25
|
+
database: <%= app_name %>_staging
|
26
|
+
pool: 5
|
27
|
+
username: <%= app_name %>_s
|
28
|
+
password:
|
29
|
+
host: localhost
|
30
|
+
|
31
|
+
production:
|
32
|
+
adapter: mysql
|
33
|
+
encoding: utf8
|
34
|
+
reconnect: false
|
35
|
+
database: <%= app_name %>
|
36
|
+
pool: 5
|
37
|
+
username: <%= app_name %>
|
38
|
+
password:
|
39
|
+
host: localhost
|