rails-maker 0.1.7 → 0.1.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: 1f17f2ca99a5193c6d19db65c73087559df95154
4
- data.tar.gz: 4c86713d6c2a43900aee81a5b168eca7dfd1039b
5
- !binary "U0hBNTEy":
6
- metadata.gz: ea21b8a0fa59c64c514f613a83b3a3de931f4c86f0316f702f6e24958ad12750a22846c387a1faeaa092ada63f1a7aad39459ae422f41c3d440d1c264a966774
7
- data.tar.gz: 08d9790b892def204769c7b8775493ca0254da2dd3ab9dd2d174426018c6ce5562a480b63bcc7e75fb9b49eb890170aab6205ecc472b2f3f4fdbe47fc631dab8
2
+ SHA1:
3
+ metadata.gz: ece579678df0bd20eb5b84cf8b497d77c1680a15
4
+ data.tar.gz: d2f225fccce9a69cb8206f7d0fccbf914924bda4
5
+ SHA512:
6
+ metadata.gz: 60576cfa6792c32927239713941471253f5dc6000c49d6b7dca1262fe07fe96779a1a428275517fee60d95339f9a1a4c0bb834517e361e83b483344f3361b6fe
7
+ data.tar.gz: 64a3f777370e40988ffffa099d16db48603787139b04fff7899d694bcb8ec15898745e0632c5010f90bc54733a184c7bc06dfe9b4781495b9fd200256564a5e7
data/README.md CHANGED
@@ -26,6 +26,10 @@ We hope it saves you a mess of time!
26
26
 
27
27
  rails-maker new my_app async
28
28
 
29
+ * Base: A Rails application with the basic setup of gems, including newrelic, sidekiq, raven.l2, and rspec.
30
+
31
+ rails-maker new my_app base
32
+
29
33
 
30
34
  ### Quick Start
31
35
 
@@ -1,3 +1,3 @@
1
1
  module RailsMaker
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -0,0 +1,307 @@
1
+ ### FILES FOR REMOVE
2
+ run 'rm public/index.html'
3
+ run 'rm public/images/rails.png'
4
+ run 'rm README'
5
+ run 'rm README.rdoc'
6
+ run 'rm public/favicon.ico'
7
+ file 'README.md', <<-FILE
8
+ #{app_name.humanize}
9
+ ===========
10
+ FILE
11
+ run 'mkdir app/workers'
12
+ run 'mkdir app/uploaders'
13
+
14
+ ### GIT
15
+ git :init
16
+
17
+ run "rm .gitignore"
18
+ file '.gitignore', <<-END
19
+ # Ignore bundler config
20
+ /.bundle
21
+
22
+ # Ignore the default SQLite database.
23
+ /db/*.sqlite3
24
+
25
+ config/database.yml
26
+
27
+ # Ignore all logfiles and tempfiles.
28
+ /log/*.log
29
+ /tmp
30
+
31
+ /public/uploads
32
+ /public/assets
33
+
34
+ # Ignore Rubymine project files
35
+ .idea/
36
+
37
+ # Ignore Ctags file
38
+ .tags
39
+
40
+ .rvmrc
41
+ .zeus.sock
42
+ .DS_Store
43
+ public/system/**/**/**/*
44
+ .sass-cache/**/*
45
+ *.swp
46
+
47
+ # Ignore sublime workspace files
48
+ *.sublime-project
49
+ *.sublime-workspace
50
+ END
51
+
52
+ file 'config/example-databse.yml', <<-END
53
+ defaults: &defaults
54
+ adapter: postgresql
55
+ encoding: unicode
56
+ pool: 25
57
+ username: username
58
+ password: password
59
+ host: localhost
60
+
61
+ development:
62
+ <<: *defaults
63
+ database: dev_#{app_name.underscore}
64
+
65
+ test:
66
+ <<: *defaults
67
+ database: test_#{app_name.underscore}
68
+
69
+ production:
70
+ <<: *defaults
71
+ database: prod_#{app_name.underscore}
72
+ END
73
+
74
+ ### GEMS
75
+ run "rm Gemfile"
76
+ file 'Gemfile'
77
+
78
+ add_source 'https://rubygems.org'
79
+
80
+ gem 'rails'
81
+ ## database gem
82
+ gem 'pg'
83
+ ## form builder
84
+ gem 'simple_form'
85
+ ## yml settings for app
86
+ gem 'settingslogic'
87
+ ## pagination
88
+ gem 'kaminari'
89
+
90
+ gem 'state_machine'
91
+ ## templates language
92
+ gem 'haml'
93
+
94
+ gem 'wirble'
95
+ gem 'letter_opener'
96
+ gem 'meta_request'
97
+ ## authentication
98
+ gem 'devise'
99
+ ## authorization
100
+ gem 'cancan'
101
+ ## image uploading
102
+ gem 'carrierwave'
103
+
104
+ gem 'progressbar'
105
+ gem 'awesome_print'
106
+ ## error catching
107
+ gem "sentry-raven", :git => "https://github.com/getsentry/raven-ruby.git", :require => "raven"
108
+ ## background processing
109
+ gem "sidekiq"
110
+ gem "sinatra", require: false
111
+ gem "slim"
112
+ ### monitoring
113
+ gem 'newrelic_rpm'
114
+ gem 'turbolinks'
115
+
116
+ gem 'coffee-rails'
117
+ gem 'jquery-rails'
118
+ gem 'sass-rails'
119
+ gem 'bootstrap-sass'
120
+ gem_group :assets do
121
+ gem 'compass-rails'
122
+ gem "uglifier"
123
+ end
124
+
125
+ gem_group :development do
126
+ ## better console
127
+ gem "pry-rails"
128
+ ## no assets in logs
129
+ gem 'quiet_assets'
130
+ ## development server
131
+ gem 'thin'
132
+ ## deploying
133
+ gem "capistrano"
134
+ gem "capistrano-ext"
135
+ gem "capistrano_colors"
136
+ end
137
+
138
+ gem_group :test, :development do
139
+ ## test gems
140
+ gem "rspec-rails"
141
+ gem 'factory_girl_rails'
142
+ gem 'database_cleaner'
143
+ end
144
+
145
+ run 'bundle install'
146
+
147
+ ## INITIALIZERS
148
+ initializer 'raven.rb', <<-END
149
+ require 'raven'
150
+
151
+ Raven.configure do |config|
152
+ config.dsn = 'https://secret:public@app.getsentry.com/appid'
153
+ end
154
+ END
155
+
156
+ ## ROUTES
157
+ prepend_file 'config/routes.rb', "require 'sidekiq/web'\n\n"
158
+ route "mount Sidekiq::Web, at: '/sidekiq'"
159
+
160
+ ## PUBLIC LAYOUT
161
+ file 'app/views/application/_flash_messages.html.haml', <<-END
162
+ - flash.each do |key, value|
163
+ .alert{ class: "alert-" + key.to_s }
164
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"}
165
+ &times;
166
+ = value
167
+ END
168
+
169
+ run 'rm app/views/layouts/application.html.erb'
170
+ file 'app/views/layouts/application.html.haml', <<-END
171
+ !!! 5
172
+ %html{ lang: I18n.locale }
173
+ %head
174
+ %meta{ charset: 'utf-8'}
175
+ %title #{app_name.humanize}
176
+ = csrf_meta_tag
177
+ = stylesheet_link_tag "application"
178
+
179
+ %body{ "data-locale" => I18n.locale }
180
+
181
+ .container
182
+ =render partial: 'flash_messages'
183
+
184
+ = yield
185
+
186
+ = javascript_include_tag "application"
187
+ END
188
+
189
+ ## ADMIN PART
190
+ # admin javascript
191
+ gsub_file 'app/assets/javascripts/application.js', /\/\/= require_tree ./, ''
192
+ file 'app/assets/javascripts/admin.js', <<-END
193
+ //= require jquery
194
+ //= require jquery_ujs
195
+ //= require bootstrap
196
+ END
197
+ # admin stylesheet
198
+ gsub_file 'app/assets/stylesheets/application.css', /\*= require_tree ./, ''
199
+ file 'app/assets/stylesheets/admin.css.scss', <<-END
200
+ @import "bootstrap";
201
+ END
202
+ inject_into_file 'config/application.rb', after: "class Application < Rails::Application\n" do
203
+ "\n config.assets.precompile += ['admin.css.scss']\n\n"
204
+ end
205
+ # admin base controller
206
+ run 'mkdir "app/controllers/admin"'
207
+ create_file 'app/controllers/admin/application_controller.rb', <<-END
208
+ class Admin::ApplicationController < ApplicationController
209
+ layout 'admin'
210
+ before_filter :authenticate_user!
211
+ before_filter :verify_admin
212
+
213
+ private
214
+
215
+ def verify_admin
216
+ redirect_to root_url unless current_user.admin?
217
+ end
218
+ end
219
+ END
220
+ # admin layout with menu, flash messages
221
+ run 'mkdir app/views/admin'
222
+ run 'mkdir app/views/admin/application'
223
+
224
+ file 'app/views/admin/application/_header.html.haml', <<-END
225
+ .navbar.navbar-fixed-top
226
+ .navbar-inner
227
+ .container
228
+ %a.btn.btn-navbar{ "data-target" => ".nav-collapse", "data-toggle" => "collapse" }
229
+ %span.icon-bar
230
+ %span.icon-bar
231
+ %span.icon-bar
232
+ %a.brand{ href: root_path } #{app_name.humanize}
233
+ .nav-collapse
234
+ =render partial: 'navigation_menu'
235
+ END
236
+
237
+ file 'app/views/admin/application/_flash_messages.html.haml', <<-END
238
+ - flash.each do |key, value|
239
+ .alert{ class: "alert-" + key.to_s }
240
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"}
241
+ &times;
242
+ = value
243
+ END
244
+
245
+ file 'app/views/admin/application/_footer.html.haml'
246
+
247
+ file 'app/views/admin/application/_navigation_menu.html.haml', <<-END
248
+ %ul.nav
249
+ %li= link_to "Dashboard", admin_root_path
250
+ END
251
+
252
+ file 'app/views/layouts/admin.html.haml', <<-END
253
+ !!! 5
254
+ %html{ lang: I18n.locale }
255
+ %head
256
+ %meta{ charset: 'utf-8'}
257
+ %title #{app_name.humanize} - AdminPanel
258
+ = csrf_meta_tag
259
+ = stylesheet_link_tag "admin"
260
+
261
+ %body{ "data-locale" => I18n.locale }
262
+
263
+ =render partial: 'header'
264
+
265
+ .container
266
+ =render partial: 'flash_messages'
267
+
268
+ = yield
269
+
270
+ = javascript_include_tag "admin"
271
+ END
272
+ # admin namespace in routes
273
+ inject_into_file 'config/routes.rb', after: "mount Sidekiq::Web, at: '/sidekiq'" do
274
+ <<-END
275
+ \n
276
+ namespace :admin do
277
+ \n
278
+ end
279
+ END
280
+ end
281
+ # add cancan ability with admin can manage all
282
+ file 'app/models/ability.rb', <<-END
283
+ class Ability
284
+ include CanCan::Ability
285
+
286
+ def initialize(user)
287
+ if user.admin?
288
+ can :manage, :all
289
+ end
290
+ end
291
+ end
292
+ END
293
+
294
+ ## FURTHER INSTRUCTIONS
295
+ say <<-D
296
+
297
+ Next:
298
+ 1 - copy content of config/example-databse.yml to config/database.yml; write your username and password for database access, write your database names or leave default for all environments in database.yml
299
+ 2 - write your secret, public keys and appid in initializers/raven.rb
300
+ 3 - generate and copy newrelic.yml file to config directory
301
+ 4 - in terminal change your directory to application root
302
+ 5 - run 'rake db:create'
303
+ 6 - run 'rails generate devise:install' and 'rails generate devise User'
304
+ 7 - run 'rake db:migrate'
305
+ 8 - run 'rails s' from your project directory
306
+
307
+ D
@@ -1,35 +1,24 @@
1
-
2
- #require "net/http"
3
- #require "net/https"
4
- #require "uri"
5
- #require 'rbconfig'
6
-
7
1
  say 'Building Application with the rails-maker...'
8
2
 
9
3
  files = []
10
4
  files << 'general'
11
5
  files << 'git'
12
- files << 'gemfile'
13
6
  files << 'db'
14
- files << 'application_layout'
15
- #files << 'home_controller'
16
- files << 'css'
17
- #files << 'test_suite'
18
- #files << 'authentication'
19
- #files << 'authorization'
20
- #files << 'admin'
21
- files << 'routes'
7
+ files << 'gemfile'
22
8
  files << 'initializers'
9
+ files << 'simple_routes'
10
+ files << 'public_layout'
11
+ files << 'admin_part'
23
12
 
24
13
  files.each do |file|
25
14
  apply File.expand_path("../lib/#{file}.rb", __FILE__)
26
15
  end
27
16
 
28
17
  ## INITIAL COMMIT
29
- git add: "."
30
- git commit: "-a -m 'Initial commit'"
18
+ # git add: "."
19
+ # git commit: "-a -m 'Initial commit'"
31
20
 
32
- ## FURTHER INSTRUCTIONS
21
+ ## FURTHER INSTRUCTIONS
33
22
  say <<-D
34
23
 
35
24
  ########################################################################
@@ -37,14 +26,14 @@ say <<-D
37
26
  The rails-maker just added like 6 hours to your life.
38
27
 
39
28
  Next:
40
- 1 - copy content of config/example-databse.yml to config/database.yml
41
- 2 - write your username and password for database access, write your database names or leave default for all environments in database.yml
42
- 3 - run 'rake db:create'
43
- 4 - write your secret, public keys and appid in initializers/raven.rb
44
- 5 - generate and copy newrelic.yml file to config directory
45
- 6 - run 'rails s' from your project directory
46
-
47
- Login to admin with email admin@local.host and password admin123
29
+ 1 - copy content of config/example-databse.yml to config/database.yml; write your username and password for database access, write your database names or leave default for all environments in database.yml
30
+ 2 - write your secret, public keys and appid in initializers/raven.rb
31
+ 3 - generate and copy newrelic.yml file to config directory
32
+ 4 - in terminal change your directory to application root
33
+ 5 - run 'rake db:create'
34
+ 6 - run 'rails generate devise:install' and 'rails generate devise User'
35
+ 7 - run 'rake db:migrate'
36
+ 8 - run 'rails s' from your project directory
48
37
 
49
38
  ########################################################################
50
39
  D
@@ -0,0 +1,107 @@
1
+ say '## ADMIN PART >>'
2
+
3
+ # admin javascript
4
+ gsub_file 'app/assets/javascripts/application.js', /\/\/= require_tree ./, ''
5
+ file 'app/assets/javascripts/admin.js', <<-END
6
+ //= require jquery
7
+ //= require jquery_ujs
8
+ //= require jquery.ui.all
9
+ //= require bootstrap
10
+ //= require turbolinks
11
+ END
12
+ # admin stylesheet
13
+ gsub_file 'app/assets/stylesheets/application.css', /\*= require_tree ./, ''
14
+ file 'app/assets/stylesheets/admin.css.scss', <<-END
15
+ @import "bootstrap";
16
+ END
17
+ inject_into_file 'config/application.rb', after: "class Application < Rails::Application\n" do
18
+ "\n config.assets.precompile += ['admin.css.scss']\n\n"
19
+ end
20
+ # admin base controller
21
+ run 'mkdir "app/controllers/admin"'
22
+ create_file 'app/controllers/admin/application_controller.rb', <<-END
23
+ class Admin::ApplicationController < ApplicationController
24
+ layout 'admin'
25
+ before_filter :authenticate_user!
26
+ before_filter :verify_admin
27
+
28
+ private
29
+
30
+ def verify_admin
31
+ redirect_to root_url unless current_user.admin?
32
+ end
33
+ end
34
+ END
35
+ # admin layout with menu, flash messages
36
+ run 'mkdir app/views/admin'
37
+ run 'mkdir app/views/admin/application'
38
+
39
+ file 'app/views/admin/application/_header.html.haml', <<-END
40
+ .navbar.navbar-fixed-top
41
+ .navbar-inner
42
+ .container
43
+ %a.btn.btn-navbar{ "data-target" => ".nav-collapse", "data-toggle" => "collapse" }
44
+ %span.icon-bar
45
+ %span.icon-bar
46
+ %span.icon-bar
47
+ %a.brand{ href: root_path } #{app_name.humanize}
48
+ .nav-collapse
49
+ =render partial: 'navigation_menu'
50
+ END
51
+
52
+ file 'app/views/admin/application/_flash_messages.html.haml', <<-END
53
+ - flash.each do |key, value|
54
+ .alert{ class: "alert-" + key.to_s }
55
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"}
56
+ &times;
57
+ = value
58
+ END
59
+
60
+ file 'app/views/admin/application/_footer.html.haml'
61
+
62
+ file 'app/views/admin/application/_navigation_menu.html.haml', <<-END
63
+ %ul.nav
64
+ %li= link_to "Dashboard", admin_root_path
65
+ END
66
+
67
+ file 'app/views/layouts/admin.html.haml', <<-END
68
+ !!! 5
69
+ %html{ lang: I18n.locale }
70
+ %head
71
+ %meta{ charset: 'utf-8'}
72
+ %title #{app_name.humanize} - AdminPanel
73
+ = csrf_meta_tag
74
+ = stylesheet_link_tag "admin"
75
+
76
+ %body{ "data-locale" => I18n.locale }
77
+
78
+ =render partial: 'header'
79
+
80
+ .container
81
+ =render partial: 'flash_messages'
82
+
83
+ = yield
84
+
85
+ = javascript_include_tag "admin"
86
+ END
87
+ # admin namespace in routes
88
+ inject_into_file 'config/routes.rb', after: "mount Sidekiq::Web, at: '/sidekiq'" do
89
+ <<-END
90
+ \n
91
+ namespace :admin do
92
+ \n
93
+ end
94
+ END
95
+ end
96
+ # add cancan ability with admin can manage all
97
+ file 'app/models/ability.rb', <<-END
98
+ class Ability
99
+ include CanCan::Ability
100
+
101
+ def initialize(user)
102
+ if user.admin?
103
+ can :manage, :all
104
+ end
105
+ end
106
+ end
107
+ END
@@ -1,7 +1,5 @@
1
1
  say '## DB >>'
2
2
 
3
- run 'rm config/database.yml'
4
-
5
3
  file 'config/example-databse.yml', <<-END
6
4
  defaults: &defaults
7
5
  adapter: postgresql
@@ -10,16 +8,16 @@ defaults: &defaults
10
8
  username: username
11
9
  password: password
12
10
  host: localhost
13
-
11
+
14
12
  development:
15
13
  <<: *defaults
16
- database: dev_#{ARGV[0].underscore}
17
-
14
+ database: dev_#{app_name.underscore}
15
+
18
16
  test:
19
17
  <<: *defaults
20
- database: test_#{ARGV[0].underscore}
21
-
18
+ database: test_#{app_name.underscore}
19
+
22
20
  production:
23
21
  <<: *defaults
24
- database: prod_#{ARGV[0].underscore}
22
+ database: prod_#{app_name.underscore}
25
23
  END
@@ -2,9 +2,9 @@ say '## GEMFILE >>'
2
2
 
3
3
  run "rm Gemfile"
4
4
  file 'Gemfile'
5
-
5
+
6
6
  add_source 'https://rubygems.org'
7
-
7
+
8
8
  gem 'rails'
9
9
  ## database gem
10
10
  gem 'pg'
@@ -14,19 +14,21 @@ gem 'simple_form'
14
14
  gem 'settingslogic'
15
15
  ## pagination
16
16
  gem 'kaminari'
17
-
17
+
18
18
  gem 'state_machine'
19
19
  ## templates language
20
20
  gem 'haml'
21
-
21
+
22
22
  gem 'wirble'
23
23
  gem 'letter_opener'
24
24
  gem 'meta_request'
25
25
  ## authentication
26
26
  gem 'devise'
27
+ ## authorization
28
+ gem 'cancan'
27
29
  ## image uploading
28
30
  gem 'carrierwave'
29
-
31
+
30
32
  gem 'progressbar'
31
33
  gem 'awesome_print'
32
34
  ## error catching
@@ -37,15 +39,18 @@ gem "sinatra", require: false
37
39
  gem "slim"
38
40
  ### monitoring
39
41
  gem 'newrelic_rpm'
40
-
41
- gem_group :assets do
42
- gem 'sass-rails'
42
+ gem 'turbolinks'
43
+
44
+ gem 'coffee-rails'
45
+ gem 'jquery-rails'
46
+ gem 'jquery-ui-rails'
47
+ gem 'sass-rails'
48
+ gem 'bootstrap-sass'
49
+ gem_group :assets do
43
50
  gem 'compass-rails'
44
51
  gem "uglifier"
45
- gem 'coffee-rails'
46
- gem 'jquery-rails'
47
52
  end
48
-
53
+
49
54
  gem_group :development do
50
55
  ## better console
51
56
  gem "pry-rails"
@@ -58,12 +63,12 @@ gem_group :development do
58
63
  gem "capistrano-ext"
59
64
  gem "capistrano_colors"
60
65
  end
61
-
66
+
62
67
  gem_group :test, :development do
63
68
  ## test gems
64
69
  gem "rspec-rails"
65
70
  gem 'factory_girl_rails'
66
71
  gem 'database_cleaner'
67
72
  end
68
-
73
+
69
74
  run 'bundle install'
@@ -5,11 +5,9 @@ run 'rm public/images/rails.png'
5
5
  run 'rm README'
6
6
  run 'rm README.rdoc'
7
7
  run 'rm public/favicon.ico'
8
-
9
8
  file 'README.md', <<-FILE
10
- #{ARGV[0].humanize}
9
+ #{app_name.humanize}
11
10
  ===========
12
11
  FILE
13
-
14
12
  run 'mkdir app/workers'
15
13
  run 'mkdir app/uploaders'
@@ -1,38 +1,38 @@
1
1
  say '## GIT >>'
2
2
 
3
3
  git :init
4
-
5
- run "rm .gitignore"
6
4
 
5
+ run "rm .gitignore"
7
6
  file '.gitignore', <<-END
8
7
  # Ignore bundler config
9
8
  /.bundle
10
-
9
+
11
10
  # Ignore the default SQLite database.
12
11
  /db/*.sqlite3
13
-
12
+
14
13
  config/database.yml
15
-
14
+
16
15
  # Ignore all logfiles and tempfiles.
17
16
  /log/*.log
18
17
  /tmp
19
-
18
+ /pids
19
+
20
20
  /public/uploads
21
21
  /public/assets
22
-
22
+
23
23
  # Ignore Rubymine project files
24
24
  .idea/
25
-
25
+
26
26
  # Ignore Ctags file
27
27
  .tags
28
-
28
+
29
29
  .rvmrc
30
30
  .zeus.sock
31
31
  .DS_Store
32
32
  public/system/**/**/**/*
33
33
  .sass-cache/**/*
34
34
  *.swp
35
-
35
+
36
36
  # Ignore sublime workspace files
37
37
  *.sublime-project
38
38
  *.sublime-workspace
@@ -0,0 +1,29 @@
1
+ say '## PUBLIC LAYOUT >>'
2
+
3
+ file 'app/views/application/_flash_messages.html.haml', <<-END
4
+ - flash.each do |key, value|
5
+ .alert{ class: "alert-" + key.to_s }
6
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"}
7
+ &times;
8
+ = value
9
+ END
10
+
11
+ run 'rm app/views/layouts/application.html.erb'
12
+ file 'app/views/layouts/application.html.haml', <<-END
13
+ !!! 5
14
+ %html{ lang: I18n.locale }
15
+ %head
16
+ %meta{ charset: 'utf-8'}
17
+ %title #{app_name.humanize}
18
+ = csrf_meta_tag
19
+ = stylesheet_link_tag "application"
20
+
21
+ %body{ "data-locale" => I18n.locale }
22
+
23
+ .container
24
+ =render partial: 'flash_messages'
25
+
26
+ = yield
27
+
28
+ = javascript_include_tag "application"
29
+ END
@@ -0,0 +1,4 @@
1
+ say '## ROUTES >>'
2
+
3
+ prepend_file 'config/routes.rb', "require 'sidekiq/web'\n\n"
4
+ route "mount Sidekiq::Web, at: '/sidekiq'"
@@ -0,0 +1,39 @@
1
+ say 'Building Rails2 Application with the rails-maker...'
2
+
3
+ files = []
4
+ files << 'general'
5
+ files << 'git'
6
+ files << 'db'
7
+ files << 'gemfile'
8
+ files << 'initializers'
9
+ files << 'routes'
10
+ files << 'public_layout'
11
+ files << 'admin_part'
12
+
13
+ files.each do |file|
14
+ apply File.expand_path("../lib/#{file}.rb", __FILE__)
15
+ end
16
+
17
+ ## INITIAL COMMIT
18
+ # git add: "."
19
+ # git commit: "-a -m 'Initial commit'"
20
+
21
+ ## FURTHER INSTRUCTIONS
22
+ say <<-D
23
+
24
+ ########################################################################
25
+
26
+ The rails-maker just added like 6 hours to your life.
27
+
28
+ Next:
29
+ 1 - copy content of config/example-databse.yml to config/database.yml; write your username and password for database access, write your database names or leave default for all environments in database.yml
30
+ 2 - write your secret, public keys and appid in initializers/raven.rb
31
+ 3 - generate and copy newrelic.yml file to config directory
32
+ 4 - in terminal change your directory to application root
33
+ 5 - run 'rake db:create'
34
+ 6 - run 'rails generate devise:install' and 'rails generate devise User'
35
+ 7 - run 'rake db:migrate'
36
+ 8 - run 'rails s' from your project directory
37
+
38
+ ########################################################################
39
+ D
@@ -0,0 +1,106 @@
1
+ say '## ADMIN PART >>'
2
+
3
+ # admin javascript
4
+ gsub_file 'app/assets/javascripts/application.js', /\/\/= require_tree ./, ''
5
+ file 'app/assets/javascripts/admin.js', <<-END
6
+ //= require jquery
7
+ //= require jquery_ujs
8
+ //= require jquery-ui
9
+ //= require bootstrap
10
+ END
11
+ # admin stylesheet
12
+ gsub_file 'app/assets/stylesheets/application.css', /\*= require_tree ./, ''
13
+ file 'app/assets/stylesheets/admin.css.scss', <<-END
14
+ @import "bootstrap";
15
+ END
16
+ inject_into_file 'config/application.rb', after: "class Application < Rails::Application\n" do
17
+ "\n config.assets.precompile += ['admin.css.scss']\n\n"
18
+ end
19
+ # admin base controller
20
+ run 'mkdir "app/controllers/admin"'
21
+ create_file 'app/controllers/admin/application_controller.rb', <<-END
22
+ class Admin::ApplicationController < ApplicationController
23
+ layout 'admin'
24
+ before_filter :authenticate_user!
25
+ before_filter :verify_admin
26
+
27
+ private
28
+
29
+ def verify_admin
30
+ redirect_to root_url unless current_user.admin?
31
+ end
32
+ end
33
+ END
34
+ # admin layout with menu, flash messages
35
+ run 'mkdir app/views/admin'
36
+ run 'mkdir app/views/admin/application'
37
+
38
+ file 'app/views/admin/application/_header.html.haml', <<-END
39
+ .navbar.navbar-fixed-top
40
+ .navbar-inner
41
+ .container
42
+ %a.btn.btn-navbar{ "data-target" => ".nav-collapse", "data-toggle" => "collapse" }
43
+ %span.icon-bar
44
+ %span.icon-bar
45
+ %span.icon-bar
46
+ %a.brand{ href: root_path } #{app_name.humanize}
47
+ .nav-collapse
48
+ =render partial: 'navigation_menu'
49
+ END
50
+
51
+ file 'app/views/admin/application/_flash_messages.html.haml', <<-END
52
+ - flash.each do |key, value|
53
+ .alert{ class: "alert-" + key.to_s }
54
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"}
55
+ &times;
56
+ = value
57
+ END
58
+
59
+ file 'app/views/admin/application/_footer.html.haml'
60
+
61
+ file 'app/views/admin/application/_navigation_menu.html.haml', <<-END
62
+ %ul.nav
63
+ %li= link_to "Dashboard", admin_root_path
64
+ END
65
+
66
+ file 'app/views/layouts/admin.html.haml', <<-END
67
+ !!! 5
68
+ %html{ lang: I18n.locale }
69
+ %head
70
+ %meta{ charset: 'utf-8'}
71
+ %title #{app_name.humanize} - AdminPanel
72
+ = csrf_meta_tag
73
+ = stylesheet_link_tag "admin"
74
+
75
+ %body{ "data-locale" => I18n.locale }
76
+
77
+ =render partial: 'header'
78
+
79
+ .container
80
+ =render partial: 'flash_messages'
81
+
82
+ = yield
83
+
84
+ = javascript_include_tag "admin"
85
+ END
86
+ # admin namespace in routes
87
+ inject_into_file 'config/routes.rb', after: "mount Sidekiq::Web, at: '/sidekiq'" do
88
+ <<-END
89
+ \n
90
+ namespace :admin do
91
+ \n
92
+ end
93
+ END
94
+ end
95
+ # add cancan ability with admin can manage all
96
+ file 'app/models/ability.rb', <<-END
97
+ class Ability
98
+ include CanCan::Ability
99
+
100
+ def initialize(user)
101
+ if user.admin?
102
+ can :manage, :all
103
+ end
104
+ end
105
+ end
106
+ END
@@ -0,0 +1,23 @@
1
+ say '## DB >>'
2
+
3
+ file 'config/example-databse.yml', <<-END
4
+ defaults: &defaults
5
+ adapter: postgresql
6
+ encoding: unicode
7
+ pool: 25
8
+ username: username
9
+ password: password
10
+ host: localhost
11
+
12
+ development:
13
+ <<: *defaults
14
+ database: dev_#{app_name.underscore}
15
+
16
+ test:
17
+ <<: *defaults
18
+ database: test_#{app_name.underscore}
19
+
20
+ production:
21
+ <<: *defaults
22
+ database: prod_#{app_name.underscore}
23
+ END
@@ -0,0 +1,72 @@
1
+ say '## GEMFILE >>'
2
+
3
+ run "rm Gemfile"
4
+ file 'Gemfile'
5
+
6
+ add_source 'https://rubygems.org'
7
+
8
+ gem 'rails', '~> 2.0'
9
+ ## database gem
10
+ gem 'pg'
11
+ ## form builder
12
+ gem 'simple_form'
13
+ ## yml settings for app
14
+ gem 'settingslogic'
15
+ ## pagination
16
+ gem 'kaminari'
17
+
18
+ gem 'state_machine'
19
+ ## templates language
20
+ gem 'haml'
21
+
22
+ gem 'wirble'
23
+ gem 'letter_opener'
24
+ gem 'meta_request'
25
+ ## authentication
26
+ gem 'devise'
27
+ ## authorization
28
+ gem 'cancan'
29
+ ## image uploading
30
+ gem 'carrierwave'
31
+
32
+ gem 'progressbar'
33
+ gem 'awesome_print'
34
+ ## error catching
35
+ gem "sentry-raven", :git => "https://github.com/getsentry/raven-ruby.git", :require => "raven"
36
+ ## background processing
37
+ gem "sidekiq"
38
+ gem "sinatra", require: false
39
+ gem "slim"
40
+ ### monitoring
41
+ gem 'newrelic_rpm'
42
+
43
+ gem 'coffee-rails'
44
+ gem 'jquery-rails', "~> 2.3.0"
45
+ gem 'sass-rails'
46
+ gem 'bootstrap-sass'
47
+ gem_group :assets do
48
+ gem 'compass-rails'
49
+ gem "uglifier"
50
+ end
51
+
52
+ gem_group :development do
53
+ ## better console
54
+ gem "pry-rails"
55
+ ## no assets in logs
56
+ gem 'quiet_assets'
57
+ ## development server
58
+ gem 'thin'
59
+ ## deploying
60
+ gem "capistrano"
61
+ gem "capistrano-ext"
62
+ gem "capistrano_colors"
63
+ end
64
+
65
+ gem_group :test, :development do
66
+ ## test gems
67
+ gem "rspec-rails"
68
+ gem 'factory_girl_rails'
69
+ gem 'database_cleaner'
70
+ end
71
+
72
+ run 'bundle install'
@@ -0,0 +1,13 @@
1
+ say '## GENERAL >>'
2
+
3
+ run 'rm public/index.html'
4
+ run 'rm public/images/rails.png'
5
+ run 'rm README'
6
+ run 'rm README.rdoc'
7
+ run 'rm public/favicon.ico'
8
+ file 'README.md', <<-FILE
9
+ #{app_name.humanize}
10
+ ===========
11
+ FILE
12
+ run 'mkdir app/workers'
13
+ run 'mkdir app/uploaders'
@@ -0,0 +1,39 @@
1
+ say '## GIT >>'
2
+
3
+ git :init
4
+
5
+ run "rm .gitignore"
6
+ file '.gitignore', <<-END
7
+ # Ignore bundler config
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+
13
+ config/database.yml
14
+
15
+ # Ignore all logfiles and tempfiles.
16
+ /log/*.log
17
+ /tmp
18
+ /pids
19
+
20
+ /public/uploads
21
+ /public/assets
22
+
23
+ # Ignore Rubymine project files
24
+ .idea/
25
+
26
+ # Ignore Ctags file
27
+ .tags
28
+
29
+ .rvmrc
30
+ .zeus.sock
31
+ .DS_Store
32
+ public/system/**/**/**/*
33
+ .sass-cache/**/*
34
+ *.swp
35
+
36
+ # Ignore sublime workspace files
37
+ *.sublime-project
38
+ *.sublime-workspace
39
+ END
@@ -0,0 +1,9 @@
1
+ say '## INITIALIZERS >>'
2
+
3
+ initializer 'raven.rb', <<-END
4
+ require 'raven'
5
+
6
+ Raven.configure do |config|
7
+ config.dsn = 'https://secret:public@app.getsentry.com/appid'
8
+ end
9
+ END
@@ -0,0 +1,29 @@
1
+ say '## PUBLIC LAYOUT >>'
2
+
3
+ file 'app/views/application/_flash_messages.html.haml', <<-END
4
+ - flash.each do |key, value|
5
+ .alert{ class: "alert-" + key.to_s }
6
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"}
7
+ &times;
8
+ = value
9
+ END
10
+
11
+ run 'rm app/views/layouts/application.html.erb'
12
+ file 'app/views/layouts/application.html.haml', <<-END
13
+ !!! 5
14
+ %html{ lang: I18n.locale }
15
+ %head
16
+ %meta{ charset: 'utf-8'}
17
+ %title #{app_name.humanize}
18
+ = csrf_meta_tag
19
+ = stylesheet_link_tag "application"
20
+
21
+ %body{ "data-locale" => I18n.locale }
22
+
23
+ .container
24
+ =render partial: 'flash_messages'
25
+
26
+ = yield
27
+
28
+ = javascript_include_tag "application"
29
+ END
@@ -0,0 +1,4 @@
1
+ say '## ROUTES >>'
2
+
3
+ prepend_file 'config/routes.rb', "require 'sidekiq/web'\n\n"
4
+ route "mount Sidekiq::Web, at: '/sidekiq'"
@@ -0,0 +1,15 @@
1
+ module RailsMaker
2
+
3
+ module Templates
4
+
5
+ class Rails2 < RailsMaker::TemplateRunner
6
+
7
+ # Descriptions
8
+ desc "Runs the default rails-maker Rails stack task"
9
+
10
+ end
11
+
12
+ end
13
+
14
+ end
15
+
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-maker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Kalbazov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-31 00:00:00.000000000 Z
11
+ date: 2013-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thor
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: hpricot
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ruby_parser
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: thor
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ! '>='
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: Generate a Rails app with application templates
@@ -140,6 +140,7 @@ files:
140
140
  - spec/railsmaker_cli_spec.rb
141
141
  - spec/railsmaker_template_runner_spec.rb
142
142
  - spec/spec_helper.rb
143
+ - templates/base/base.rb
143
144
  - templates/default/bootstrap.rb
144
145
  - templates/default/default.rb
145
146
  - templates/default/lib/admin.rb
@@ -147,6 +148,7 @@ files:
147
148
  - templates/default/lib/admin/layout.rb
148
149
  - templates/default/lib/admin/users.rb
149
150
  - templates/default/lib/admin/users_spec.rb
151
+ - templates/default/lib/admin_part.rb
150
152
  - templates/default/lib/application_layout.rb
151
153
  - templates/default/lib/authentication.rb
152
154
  - templates/default/lib/authentication/header_login_items.rb
@@ -163,8 +165,20 @@ files:
163
165
  - templates/default/lib/git.rb
164
166
  - templates/default/lib/home_controller.rb
165
167
  - templates/default/lib/initializers.rb
168
+ - templates/default/lib/public_layout.rb
166
169
  - templates/default/lib/routes.rb
170
+ - templates/default/lib/simple_routes.rb
167
171
  - templates/default/lib/test_suite.rb
172
+ - templates/rails2/bootstrap.rb
173
+ - templates/rails2/lib/admin_part.rb
174
+ - templates/rails2/lib/db.rb
175
+ - templates/rails2/lib/gemfile.rb
176
+ - templates/rails2/lib/general.rb
177
+ - templates/rails2/lib/git.rb
178
+ - templates/rails2/lib/initializers.rb
179
+ - templates/rails2/lib/public_layout.rb
180
+ - templates/rails2/lib/routes.rb
181
+ - templates/rails2/rails2.rb
168
182
  homepage: http://github.com/koteus/rails-maker
169
183
  licenses:
170
184
  - MIT
@@ -175,12 +189,12 @@ require_paths:
175
189
  - lib
176
190
  required_ruby_version: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - ! '>='
192
+ - - '>='
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
195
  required_rubygems_version: !ruby/object:Gem::Requirement
182
196
  requirements:
183
- - - ! '>='
197
+ - - '>='
184
198
  - !ruby/object:Gem::Version
185
199
  version: '0'
186
200
  requirements: []
@@ -188,5 +202,5 @@ rubyforge_project:
188
202
  rubygems_version: 2.0.3
189
203
  signing_key:
190
204
  specification_version: 4
191
- summary: rails-maker-0.1.7
205
+ summary: rails-maker-0.1.9
192
206
  test_files: []