da-suspenders 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,173 +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 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
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
173
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
@@ -1,30 +1,43 @@
1
- source :rubygems
2
-
3
- gem "rails", "3.0.4"
4
- gem "mysql"
5
-
6
- gem "app_config", :git => "git://github.com/die-antwort/app_config.git"
7
- gem "compass", "~> 0.10.6"
8
- gem "formtastic", ">= 1.2.1"
9
- gem "hoptoad_notifier"
10
- gem "sprockets", "~> 1.0.2"
11
- gem "will_paginate"
12
-
13
- # Uncomment if you want to use any of those
14
- #gem "paperclip"
15
-
16
- # RSpec needs to be in :development group to expose generators
17
- # and rake tasks without having to type RAILS_ENV=test.
18
- group :development, :test do
19
- gem "rspec-rails", "~> 2.4.0"
20
- end
21
-
22
- group :test do
23
- gem "akephalos", :git => "git://github.com/die-antwort/akephalos.git"
24
- gem "cucumber-rails"
25
- gem "factory_girl_rails"
26
- gem "capybara"
27
- gem "database_cleaner"
28
- gem "launchy"
29
- gem "timecop"
30
- end
1
+ source :rubygems
2
+
3
+ gem "rake", "0.8.7"
4
+ gem "rails", "3.0.7"
5
+ gem "mysql"
6
+
7
+ gem "app_config", :git => "git://github.com/die-antwort/app_config.git"
8
+ gem "compass", "~> 0.11.1"
9
+ gem "formtastic", "~> 1.2.3"
10
+ gem "hoptoad_notifier"
11
+ gem "sprockets", "~> 1.0.2"
12
+ gem "will_paginate", "~> 3.0.pre2"
13
+
14
+
15
+ # Uncomment if you want to use any of those
16
+
17
+ #gem "paperclip"
18
+ #gem "carrierwave"
19
+ #gem "devise"
20
+ #gem "cancan"
21
+
22
+ ## RMagick as used by RefineryCMS, to make sure it works on Windows
23
+ #rmagick_options = { :require => false }
24
+ #if Bundler::WINDOWS
25
+ # rmagick_options.merge!(:git => 'git://github.com/refinerycms/rmagick.git', :branch => 'windows')
26
+ #end
27
+ #gem "rmagick", "2.12.0", rmagick_options
28
+
29
+ # RSpec needs to be in :development group to expose generators
30
+ # and rake tasks without having to type RAILS_ENV=test.
31
+ group :development, :test do
32
+ gem "rspec-rails", "~> 2.4.0"
33
+ end
34
+
35
+ group :test do
36
+ gem "akephalos", :git => "git://github.com/die-antwort/akephalos.git"
37
+ gem "cucumber-rails"
38
+ gem "factory_girl_rails"
39
+ gem "capybara"
40
+ gem "database_cleaner"
41
+ gem "launchy"
42
+ gem "timecop"
43
+ end
@@ -1,6 +1,6 @@
1
- module BodyClassHelper
2
- def body_class
3
- qualified_controller_name = controller.controller_path.gsub('/','-')
4
- "#{qualified_controller_name} #{controller.action_name}"
5
- end
6
- end
1
+ module BodyClassHelper
2
+ def body_class
3
+ qualified_controller_name = controller.controller_path.gsub('/','-')
4
+ "#{qualified_controller_name} #{controller.action_name}"
5
+ end
6
+ end
@@ -1,10 +1,10 @@
1
- //= require <modernizr>
2
- //= require <jquery.min>
3
- //= require <rails>
4
-
5
- // activate if you want to use jrails:
6
- // = require <jquery-ui.min>
7
- // = require <jrails>
8
-
9
- // activate if you want to localize jQuery UI Datepicker:
10
- // = require <jquery-ui-i18n.min>
1
+ //= require <modernizr>
2
+ //= require <jquery.min>
3
+ //= require <rails>
4
+
5
+ // activate if you want to use jrails:
6
+ // = require <jquery-ui.min>
7
+ // = require <jrails>
8
+
9
+ // activate if you want to localize jQuery UI Datepicker:
10
+ // = require <jquery-ui-i18n.min>
@@ -1,16 +1,16 @@
1
- <!DOCTYPE html>
2
- <html lang="de" class="no-js">
3
- <head>
4
- <title>Testapp</title>
5
- <link href="/stylesheets/application.css" type="text/css" rel="stylesheet">
6
- <!--[if lte IE 7]><link href="/stylesheets/ie.css" type="text/css" rel="stylesheet"><![endif]-->
7
- <%= sprockets_include_tag %>
8
- <%= javascript_tag "$.ajaxSetup({ async: false });" if Rails.env.test?%>
9
- <%= csrf_meta_tag %>
10
- </head>
11
- <body class="<%= body_class %>">
12
- <%= render :partial => "shared/flashes" %>
13
- <%= yield %>
14
- </body>
15
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="de" class="no-js">
3
+ <head>
4
+ <title>Testapp</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <!--[if lte IE 7]><%= stylesheet_link_tag "ie", :media => "all" %><![endif]-->
7
+ <%= sprockets_include_tag %>
8
+ <%= javascript_tag "$.ajaxSetup({ async: false });" if Rails.env.test? %>
9
+ <%= csrf_meta_tag %>
10
+ </head>
11
+ <body class="<%= body_class %>">
12
+ <%= render :partial => "shared/flashes" %>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
16
16
  <!-- Created with care by DIE ANTWORT · Büro für Informationstechnik GmbH -->
@@ -1,5 +1,5 @@
1
- <div id="flash">
2
- <% flash.each do |key, value| -%>
3
- <div id="flash_<%= key %>"><%= value %></div>
4
- <% end -%>
5
- </div>
1
+ <div id="flash">
2
+ <% flash.each do |key, value| -%>
3
+ <div id="flash_<%= key %>"><%= value %></div>
4
+ <% end -%>
5
+ </div>
@@ -1,26 +1,26 @@
1
- require 'net/smtp'
2
- # Example:
3
- # begin
4
- # some http call
5
- # rescue *HTTP_ERRORS => error
6
- # notify_hoptoad error
7
- # end
8
-
9
- HTTP_ERRORS = [Timeout::Error,
10
- Errno::EINVAL,
11
- Errno::ECONNRESET,
12
- EOFError,
13
- Net::HTTPBadResponse,
14
- Net::HTTPHeaderSyntaxError,
15
- Net::ProtocolError]
16
-
17
- SMTP_SERVER_ERRORS = [TimeoutError,
18
- IOError,
19
- Net::SMTPUnknownError,
20
- Net::SMTPServerBusy,
21
- Net::SMTPAuthenticationError]
22
-
23
- SMTP_CLIENT_ERRORS = [Net::SMTPFatalError,
24
- Net::SMTPSyntaxError]
25
-
26
- SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
1
+ require 'net/smtp'
2
+ # Example:
3
+ # begin
4
+ # some http call
5
+ # rescue *HTTP_ERRORS => error
6
+ # notify_hoptoad error
7
+ # end
8
+
9
+ HTTP_ERRORS = [Timeout::Error,
10
+ Errno::EINVAL,
11
+ Errno::ECONNRESET,
12
+ EOFError,
13
+ Net::HTTPBadResponse,
14
+ Net::HTTPHeaderSyntaxError,
15
+ Net::ProtocolError]
16
+
17
+ SMTP_SERVER_ERRORS = [TimeoutError,
18
+ IOError,
19
+ Net::SMTPUnknownError,
20
+ Net::SMTPServerBusy,
21
+ Net::SMTPAuthenticationError]
22
+
23
+ SMTP_CLIENT_ERRORS = [Net::SMTPFatalError,
24
+ Net::SMTPSyntaxError]
25
+
26
+ SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
@@ -0,0 +1,4 @@
1
+ WillPaginate::ViewHelpers.pagination_options.merge!(
2
+ :previous_label => '« Vorige Seite',
3
+ :next_label => 'Nächste Seite »'
4
+ )
@@ -1,3 +1,3 @@
1
- Then 'the javascript expression "$expression" should return "$result"' do |expression, result|
2
- page.evaluate_script(expression).to_s.should == result
3
- end
1
+ Then 'the javascript expression "$expression" should return "$result"' do |expression, result|
2
+ page.evaluate_script(expression).to_s.should == result
3
+ end