rails_init_gem 0.0.5
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 +7 -0
- data/.gitignore +25 -0
- data/Gemfile +4 -0
- data/Gemfile_sources +96 -0
- data/LICENSE +201 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/lib/generators/new/new_generator.rb +410 -0
- data/lib/generators/new/templates/Gemfile +98 -0
- data/lib/generators/new/templates/_navigation.html.erb +23 -0
- data/lib/generators/new/templates/_navigation_links.html.erb +22 -0
- data/lib/generators/new/templates/about.html.erb +29 -0
- data/lib/generators/new/templates/application.html.erb +35 -0
- data/lib/generators/new/templates/custom.js +91 -0
- data/lib/generators/new/templates/database.yml +17 -0
- data/lib/generators/new/templates/docs.css +1197 -0
- data/lib/generators/new/templates/home.html.erb +12 -0
- data/lib/generators/new/templates/i18n_backend.rb +4 -0
- data/lib/generators/new/templates/redis.rb +7 -0
- data/lib/generators/new/templates/secret.yml +8 -0
- data/lib/generators/new/templates/secret_token.rb +27 -0
- data/lib/generators/new/templates/simple.css +26 -0
- data/lib/generators/new/templates/unicorn.rb +82 -0
- data/lib/generators/new/templates/unicorn_init.sh +84 -0
- data/lib/rails_init_gem/version.rb +3 -0
- data/lib/rails_init_gem.rb +5 -0
- data/rails_init_gem.gemspec +23 -0
- metadata +98 -0
@@ -0,0 +1,410 @@
|
|
1
|
+
class NewGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
class_option :lastest_gems, :type => :boolean, :default => true, :desc => "Include latest gems."
|
4
|
+
$oi = source_root
|
5
|
+
|
6
|
+
|
7
|
+
def gemfile_update
|
8
|
+
project_name = Rails.application.class.parent_name
|
9
|
+
project_path = Rails.root
|
10
|
+
project_user = ENV['USER']
|
11
|
+
|
12
|
+
|
13
|
+
# --------------------------------------------
|
14
|
+
remove_file "Gemfile"
|
15
|
+
create_file 'Gemfile' do
|
16
|
+
<<-GEMFILE
|
17
|
+
source 'https://rubygems.org'
|
18
|
+
|
19
|
+
# Basic needs
|
20
|
+
gem 'rails'
|
21
|
+
gem "pg"
|
22
|
+
gem 'RailsInitializerGem'
|
23
|
+
gem 'sass-rails'
|
24
|
+
gem 'coffee-rails'
|
25
|
+
gem 'jbuilder'
|
26
|
+
gem 'jquery-rails'
|
27
|
+
|
28
|
+
# Speedup gems
|
29
|
+
gem 'uglifier'
|
30
|
+
gem 'turbolinks'
|
31
|
+
gem 'rails_serve_static_assets'
|
32
|
+
gem 'multi_fetch_fragments'
|
33
|
+
gem 'therubyracer'
|
34
|
+
gem 'htmlcompressor'
|
35
|
+
|
36
|
+
# Preitify gems
|
37
|
+
gem 'bootstrap-sass'
|
38
|
+
gem 'chosen-rails'
|
39
|
+
gem 'country_select'
|
40
|
+
gem 'friendly_id'
|
41
|
+
gem 'high_voltage'
|
42
|
+
|
43
|
+
# Security and Authentication gems
|
44
|
+
gem 'cancan'
|
45
|
+
gem 'devise', git: 'https://github.com/plataformatec/devise.git'
|
46
|
+
gem 'devise-encryptable'
|
47
|
+
gem 'devise_invitable'
|
48
|
+
gem 'devise-i18n'
|
49
|
+
gem 'devise-guests'
|
50
|
+
gem 'rolify'
|
51
|
+
|
52
|
+
# Forms Gem
|
53
|
+
gem 'simple_form', git: 'https://github.com/plataformatec/simple_form.git'
|
54
|
+
|
55
|
+
# Pagination Gem
|
56
|
+
gem 'will_paginate'
|
57
|
+
gem 'will_paginate-bootstrap'
|
58
|
+
|
59
|
+
# Cache Gem
|
60
|
+
gem 'redis-rails'
|
61
|
+
gem 'redis-namespace'
|
62
|
+
|
63
|
+
# Full-Text Search Gem
|
64
|
+
gem 'elasticsearch-model'
|
65
|
+
gem 'elasticsearch-rails'
|
66
|
+
|
67
|
+
# Jobs Gems
|
68
|
+
gem 'whenever'
|
69
|
+
gem "resque"
|
70
|
+
|
71
|
+
# Payment
|
72
|
+
gem 'activemerchant'
|
73
|
+
gem 'paypal-sdk-rest'
|
74
|
+
|
75
|
+
# Email
|
76
|
+
gem 'mandrill-api'
|
77
|
+
gem 'mandrill_mailer'
|
78
|
+
|
79
|
+
|
80
|
+
group :development do
|
81
|
+
# gem 'sqlite3'
|
82
|
+
gem 'better_errors'
|
83
|
+
gem 'binding_of_caller'
|
84
|
+
gem 'capistrano'
|
85
|
+
gem 'capistrano-bundler'
|
86
|
+
gem 'capistrano-rails'
|
87
|
+
gem 'capistrano-rails-console'
|
88
|
+
gem 'capistrano-rvm'
|
89
|
+
gem 'guard-bundler'
|
90
|
+
gem 'guard-rails'
|
91
|
+
gem 'guard-rspec'
|
92
|
+
gem 'quiet_assets'
|
93
|
+
gem 'rails_layout'
|
94
|
+
# gem 'active_reload'
|
95
|
+
gem 'annotate'
|
96
|
+
end
|
97
|
+
group :development, :test do
|
98
|
+
gem 'factory_girl_rails'
|
99
|
+
gem 'pry-rails'
|
100
|
+
gem 'pry-rescue'
|
101
|
+
gem 'pry-stack_explorer'
|
102
|
+
gem 'rspec-rails'
|
103
|
+
end
|
104
|
+
group :production do
|
105
|
+
gem 'unicorn'
|
106
|
+
gem 'yui-compressor'
|
107
|
+
end
|
108
|
+
group :test do
|
109
|
+
gem 'capybara'
|
110
|
+
gem 'database_cleaner'
|
111
|
+
gem 'email_spec'
|
112
|
+
gem 'colored'
|
113
|
+
gem 'deadweight', :require => 'deadweight/hijack/rails'
|
114
|
+
end
|
115
|
+
GEMFILE
|
116
|
+
end
|
117
|
+
inside Rails.root do
|
118
|
+
run "bundle install"
|
119
|
+
end
|
120
|
+
# --------------------------------------------
|
121
|
+
rake("db:drop")
|
122
|
+
rake("db:create")
|
123
|
+
generate "annotate:install"
|
124
|
+
generate "jquery:install"
|
125
|
+
generate "simple_form:install --bootstrap"
|
126
|
+
generate "layout:install"
|
127
|
+
generate "friendly_id"
|
128
|
+
generate "controller StaticPages home help about contact"
|
129
|
+
rake("db:migrate")
|
130
|
+
generate "devise:install"
|
131
|
+
generate "devise_invitable:install"
|
132
|
+
generate "devise:views"
|
133
|
+
generate "paypal:sdk:install"
|
134
|
+
generate "rspec:install"
|
135
|
+
generate "devise User"
|
136
|
+
rake("db:migrate")
|
137
|
+
generate "devise_guests User"
|
138
|
+
generate "cancan:ability"
|
139
|
+
generate "rolify Role User"
|
140
|
+
filename = Dir.glob("db/migrate/*rolify_create_roles")[0]
|
141
|
+
copy_file File.join(project_path, filename), filename + ".rb"
|
142
|
+
remove_file File.join(project_path, filename)
|
143
|
+
rake("db:migrate")
|
144
|
+
generate "devise_invitable User"
|
145
|
+
rake("db:migrate")
|
146
|
+
generate "devise_invitable:views"
|
147
|
+
generate "email_spec:steps"
|
148
|
+
generate "migration add_slug_to_users slug:string:uniq"
|
149
|
+
generate "migration add_name_to_users name:string cpf:string cnpj:string"
|
150
|
+
generate "migration add_provider_to_users provider:boolean"
|
151
|
+
generate "migration add_client_to_users client:boolean"
|
152
|
+
filename = Dir.glob("db/migrate/*add_client_to_users.rb")[0]
|
153
|
+
inject_into_file filename,", default: false",after: "boolean"
|
154
|
+
filename = Dir.glob("db/migrate/*add_provider_to_users.rb")[0]
|
155
|
+
inject_into_file filename,", default: false",after: "boolean"
|
156
|
+
rake("db:migrate")
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
# --------------------------------------------
|
161
|
+
# gsub_file("#$oi/database.yml", "database: Ww_production", "database: "+project_name+"_production")
|
162
|
+
# gsub_file("#$oi/unicorn.rb", "Ww", project_name)
|
163
|
+
# gsub_file("#$oi/unicorn.rb", "root = \"/home/ziongh/railsProjects/current/ww\"", "root = \"#{project_path}\"")
|
164
|
+
# gsub_file("#$oi/unicorn_init.sh", "APP_ROOT=\"/home/ziongh/railsProjects/current/ww\"", "APP_ROOT=\"#{project_path}\"" )
|
165
|
+
# gsub_file("#$oi/secret_token.rb", "Ww::Application.config.secret_key_base = secret_token", project_name+"::Application.config.secret_key_base = secret_token")
|
166
|
+
|
167
|
+
# --------------------------------------------
|
168
|
+
# copy_file "database.yml", "config/database.yml"
|
169
|
+
# gsub_file("config/database.yml", "database: Ww_production", "database: "+project_name+"_production")
|
170
|
+
copy_file "redis.rb", "config/initializers/redis.rb"
|
171
|
+
copy_file "secret_token.rb", "config/initializers/secret_token.rb"
|
172
|
+
gsub_file("config/initializers/secret_token.rb", "Ww::Application.config.secret_key_base = secret_token", project_name+"::Application.config.secret_key_base = secret_token")
|
173
|
+
copy_file "secret.yml", "config/secrets.yml"
|
174
|
+
# copy_file "i18n_backend.rb", "config/initializers/i18n_backend.rb"
|
175
|
+
copy_file "unicorn.rb", "config/unicorn.rb"
|
176
|
+
gsub_file("config/unicorn.rb", "Ww", project_name)
|
177
|
+
gsub_file("config/unicorn.rb", "root = \"/home/ziongh/railsProjects/current/ww\"", "root = \"#{project_path}\"")
|
178
|
+
copy_file "unicorn_init.sh", "config/unicorn_init.sh"
|
179
|
+
gsub_file("config/unicorn_init.sh", "APP_ROOT=\"/home/EXAMPLE_USER/railsProjects/current/ww\"", "APP_ROOT=\"#{project_path}\"" )
|
180
|
+
gsub_file("config/unicorn_init.sh", "AS_USER=EXAMPLE_USER", "AS_USER=\"#{project_user}\"" )
|
181
|
+
|
182
|
+
# --------------------------------------------
|
183
|
+
inject_into_file "app/assets/stylesheets/application.css.scss", "\n *= require bootstrap
|
184
|
+
*= require chosen", after: "*= require_tree ."
|
185
|
+
|
186
|
+
# --------------------------------------------
|
187
|
+
inject_into_file "config/routes.rb", " match '/contact', to: 'static_pages#contact' , via: 'get'\n", :after => "Rails.application.routes.draw do\n"
|
188
|
+
inject_into_file "config/routes.rb", " match '/about', to: 'static_pages#about' , via: 'get'\n", :after => "Rails.application.routes.draw do\n"
|
189
|
+
inject_into_file "config/routes.rb", " match '/help', to: 'static_pages#help' , via: 'get'\n", :after => "Rails.application.routes.draw do\n"
|
190
|
+
inject_into_file "config/routes.rb", " root to: \"static_pages#home\"\n", :after => "Rails.application.routes.draw do\n"
|
191
|
+
inject_into_file "config/application.rb", "\n I18n.enforce_available_locales = true\n", :before => "end\nend"
|
192
|
+
inject_into_file "config/application.rb", "\n config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)\n", :before => "end\nend"
|
193
|
+
inject_into_file "config/application.rb", "\n config.assets.initialize_on_precompile = false\n", :before => "end\nend"
|
194
|
+
# inject_into_file "config/application.rb", "\n config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 90.minutes }\n", :before => "end\nend"
|
195
|
+
inject_into_file "config/application.rb", "\n config.cache_store = :memory_store, { expires_in: 90.minutes }\n", :before => "end\nend"
|
196
|
+
inject_into_file "config/application.rb", "\n config.hosts = {
|
197
|
+
\"development\" => \"localhost:3000\",
|
198
|
+
\"test\" => \"localhost:3000\",
|
199
|
+
\"production\" => \"#{project_name}.com\"
|
200
|
+
}\n", :before => "end\nend"
|
201
|
+
|
202
|
+
# --------------------------------------------
|
203
|
+
inject_into_file "config/environments/production.rb", " config.static_cache_control = \"public, max-age=3600000\"\n", :after => "pplication.configure do\n"
|
204
|
+
inject_into_file "config/environments/production.rb", " config.assets.css_compressor = :yui\n", :after => "pplication.configure do\n"
|
205
|
+
gsub_file("config/environments/production.rb",'config.assets.compile = false','config.assets.compile = true')
|
206
|
+
|
207
|
+
inject_into_file "config/environments/production.rb", "\n\n config.action_mailer.default_url_options = { :host => config.hosts[Rails.env] }
|
208
|
+
# ActionMailer Config
|
209
|
+
# Setup for production - deliveries, no errors raised
|
210
|
+
config.action_mailer.delivery_method = :smtp
|
211
|
+
config.action_mailer.perform_deliveries = true
|
212
|
+
config.action_mailer.raise_delivery_errors = false
|
213
|
+
config.action_mailer.default :charset => \"utf-8\"
|
214
|
+
|
215
|
+
# Mandrill Connectivity
|
216
|
+
config.action_mailer.smtp_settings = {
|
217
|
+
:address => \"smtp.mandrillapp.com\",
|
218
|
+
:port => 587, # ports 587 and 2525 are also supported with STARTTLS
|
219
|
+
:enable_starttls_auto => true, # detects and uses STARTTLS
|
220
|
+
:user_name => \"example@example.com\",
|
221
|
+
:password => \"PASSWORD_EXAMPLE\", # SMTP password is any valid API key
|
222
|
+
:authentication => 'plain', # Mandrill supports 'plain' or 'login'
|
223
|
+
:domain => config.hosts[Rails.env]
|
224
|
+
}\n\n", :after => "pplication.configure do\n"
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
# --------------------------------------------
|
230
|
+
inject_into_file "config/environments/development.rb", "\n\n config.action_mailer.default_url_options = { :host => config.hosts[Rails.env] }
|
231
|
+
config.action_mailer.delivery_method = :smtp
|
232
|
+
# change to true to allow email to be sent during development
|
233
|
+
config.action_mailer.perform_deliveries = false
|
234
|
+
config.action_mailer.raise_delivery_errors = true
|
235
|
+
config.action_mailer.default :charset => \"utf-8\"
|
236
|
+
\n\n", after: "pplication.configure do\n"
|
237
|
+
|
238
|
+
# --------------------------------------------
|
239
|
+
|
240
|
+
inject_into_file "config/environments/test.rb", "# ActionMailer Config
|
241
|
+
config.action_mailer.default_url_options = { :host => config.hosts[Rails.env] }
|
242
|
+
\n", before: "end"
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
# --------------------------------------------
|
247
|
+
inject_into_file "config/environments/production.rb", "\n options = {
|
248
|
+
:enabled => true,
|
249
|
+
:remove_multi_spaces => true,
|
250
|
+
:remove_comments => true,
|
251
|
+
:remove_intertag_spaces => false,
|
252
|
+
:remove_quotes => false,
|
253
|
+
:compress_css => false,
|
254
|
+
:compress_javascript => false,
|
255
|
+
:simple_doctype => false,
|
256
|
+
:remove_script_attributes => false,
|
257
|
+
:remove_style_attributes => false,
|
258
|
+
:remove_link_attributes => false,
|
259
|
+
:remove_form_attributes => false,
|
260
|
+
:remove_input_attributes => false,
|
261
|
+
:remove_javascript_protocol => false,
|
262
|
+
:remove_http_protocol => false,
|
263
|
+
:remove_https_protocol => false,
|
264
|
+
:preserve_line_breaks => false,
|
265
|
+
:simple_boolean_attributes => false
|
266
|
+
}\n
|
267
|
+
config.middleware.use HtmlCompressor::Rack, options", :before => "\nend"
|
268
|
+
|
269
|
+
# --------------------------------------------
|
270
|
+
create_file (".secret")
|
271
|
+
prepend_file(".secret", %x[rake secret])
|
272
|
+
|
273
|
+
# --------------------------------------------
|
274
|
+
# gsub_file("config/initializers/session_store.rb", "Rails.application.config.session_store :cookie_store", "Rails.application.config.session_store :redis_store")
|
275
|
+
gsub_file("config/initializers/simple_form.rb", "b.optional :pattern", "#b.optional :pattern")
|
276
|
+
gsub_file("config/initializers/simple_form.rb", "# config.collection_wrapper_class = nil", "config.collection_wrapper_class = nil")
|
277
|
+
gsub_file("config/initializers/simple_form.rb", "# config.form_class = :simple_form", "config.form_class = nil")
|
278
|
+
gsub_file("config/initializers/simple_form.rb", "config.browser_validations = false", "config.browser_validations = true")
|
279
|
+
gsub_file("config/initializers/simple_form.rb", "# config.translate_labels = true", "config.translate_labels = true")
|
280
|
+
gsub_file("config/initializers/simple_form.rb", "# config.input_class = nil", "config.input_class = nil")
|
281
|
+
gsub_file("config/initializers/simple_form.rb", "# config.cache_discovery = !Rails.env.development?", "config.cache_discovery = !Rails.env.development?")
|
282
|
+
|
283
|
+
# --------------------------------------------
|
284
|
+
inject_into_file "config/initializers/simple_form_bootstrap.rb", "\n # b.use :pattern\n", after:"b.use :placeholder"
|
285
|
+
|
286
|
+
# --------------------------------------------
|
287
|
+
inject_into_file "app/helpers/application_helper.rb", "\n def title
|
288
|
+
base_title = \"#{project_name}\"
|
289
|
+
if @title.nil?
|
290
|
+
base_title
|
291
|
+
else
|
292
|
+
\"#\{base_title} | #\{@title}\"
|
293
|
+
end
|
294
|
+
end
|
295
|
+
", :after => "module ApplicationHelper"
|
296
|
+
|
297
|
+
# --------------------------------------------
|
298
|
+
inject_into_file "app/controllers/static_pages_controller.rb", "\n @title = nil\n", after: "def home"
|
299
|
+
inject_into_file "app/controllers/static_pages_controller.rb", "\n @title = \"About\"\n", after: "def about"
|
300
|
+
inject_into_file "app/controllers/static_pages_controller.rb", "\n @title = \"Help\"\n", after: "def help"
|
301
|
+
inject_into_file "app/controllers/static_pages_controller.rb", "\n @title = \"Contact\"\n", after: "def contact"
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
# --------------------------------------------
|
306
|
+
inject_into_file "app/controllers/application_controller.rb", "\n # before_action :authenticate_user!
|
307
|
+
before_action :configure_permitted_parameters, if: :devise_controller?
|
308
|
+
|
309
|
+
rescue_from CanCan::AccessDenied do |exception|
|
310
|
+
redirect_to root_path, :alert => exception.message
|
311
|
+
end
|
312
|
+
|
313
|
+
protected
|
314
|
+
|
315
|
+
def configure_permitted_parameters
|
316
|
+
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit({ roles: [] }, :email, :password, :password_confirmation, :name, :cpf, :cnpj, :client, :provider) }
|
317
|
+
devise_parameter_sanitizer.for(:account_update) { |u| u.permit({ roles: [] }, :email, :password, :password_confirmation, :current_password, :name,:cpf, :cnpj, :client, :provider) }
|
318
|
+
end\n", after: "protect_from_forgery with: :exception"
|
319
|
+
|
320
|
+
# --------------------------------------------
|
321
|
+
copy_file "_navigation.html.erb" , "app/views/layouts/_navigation.html.erb"
|
322
|
+
copy_file "_navigation_links.html.erb" , "app/views/layouts/_navigation_links.html.erb"
|
323
|
+
copy_file "application.html.erb" , "app/views/layouts/application.html.erb"
|
324
|
+
|
325
|
+
# --------------------------------------------
|
326
|
+
copy_file "about.html.erb" , "app/views/static_pages/about.html.erb"
|
327
|
+
copy_file "about.html.erb" , "app/views/static_pages/contact.html.erb"
|
328
|
+
copy_file "about.html.erb" , "app/views/static_pages/help.html.erb"
|
329
|
+
gsub_file("app/views/static_pages/help.html.erb", "<h1>About</h1>", "<h1>Help</h1>")
|
330
|
+
gsub_file("app/views/static_pages/contact.html.erb", "<h1>About</h1>", "<h1>Contact</h1>")
|
331
|
+
copy_file "home.html.erb" , "app/views/static_pages/home.html.erb"
|
332
|
+
|
333
|
+
# --------------------------------------------
|
334
|
+
#
|
335
|
+
|
336
|
+
copy_file "docs.css" , "app/assets/stylesheets/docs.css"
|
337
|
+
copy_file "custom.js" , "app/assets/javascripts/custom.js"
|
338
|
+
|
339
|
+
# --------------------------------------------
|
340
|
+
gsub_file("config/initializers/devise.rb","# config.scoped_views = false","config.scoped_views = true")
|
341
|
+
inject_into_file "app/models/user.rb","\nextend FriendlyId
|
342
|
+
friendly_id :name, use: :slugged
|
343
|
+
", after: "ActiveRecord::Base"
|
344
|
+
gsub_file("config/initializers/devise.rb","# config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'","config.mailer_sender = 'info@#{project_name}.com'")
|
345
|
+
#inject_into_file "app/models/user.rb","\n config.mailer_sender = 'info@#{project_name}.com'", after: "ActiveRecord::Base"
|
346
|
+
|
347
|
+
# --------------------------------------------
|
348
|
+
|
349
|
+
|
350
|
+
inject_into_file "app/models/ability.rb","\n user ||= User.new # guest user (not logged in)
|
351
|
+
if user.has_role? :admin
|
352
|
+
can :manage, :all
|
353
|
+
else
|
354
|
+
can :read, :all
|
355
|
+
end
|
356
|
+
", after: "def initialize(user)"
|
357
|
+
|
358
|
+
# --------------------------------------------
|
359
|
+
|
360
|
+
gsub_file("app/assets/stylesheets/application.css.scss", "*= require_tree .
|
361
|
+
*= require bootstrap
|
362
|
+
*= require chosen
|
363
|
+
*= require_self", "*= require bootstrap
|
364
|
+
*= require chosen
|
365
|
+
*= require_tree .
|
366
|
+
*= require_self")
|
367
|
+
remove_file "app/assets/stylesheets/simple.css"
|
368
|
+
copy_file "simple.css", "app/assets/stylesheets/simple.css"
|
369
|
+
|
370
|
+
inject_into_file "app/assets/javascripts/application.js", "//= require bootstrap\n", before: "//= require_tree ."
|
371
|
+
|
372
|
+
# --------------------------------------------
|
373
|
+
#
|
374
|
+
gsub_file("config/database.yml", "username:", "# username:" )
|
375
|
+
gsub_file("config/database.yml", "password:", "# password:" )
|
376
|
+
|
377
|
+
|
378
|
+
# --------------------------------------------
|
379
|
+
#
|
380
|
+
rake("db:drop")
|
381
|
+
rake("db:schema:cache:clear")
|
382
|
+
rake("db:create")
|
383
|
+
rake("db:migrate")
|
384
|
+
rake("db:schema:cache:dump ")
|
385
|
+
rake("assets:clean")
|
386
|
+
rake("assets:precompile")
|
387
|
+
rake("cache_digests:dependencies")
|
388
|
+
rake("cache_digests:nested_dependencies")
|
389
|
+
|
390
|
+
|
391
|
+
inside Rails.root do
|
392
|
+
run "rake db:drop RAILS_ENV=production"
|
393
|
+
run "rake db:schema:cache:clear RAILS_ENV=production"
|
394
|
+
run "rake db:create RAILS_ENV=production"
|
395
|
+
run "rake db:migrate RAILS_ENV=production"
|
396
|
+
run "rake db:schema:cache:dump RAILS_ENV=production"
|
397
|
+
run "rake assets:clean RAILS_ENV=production"
|
398
|
+
run "rake assets:precompile RAILS_ENV=production"
|
399
|
+
run "mkdir ./tmp/pids"
|
400
|
+
end
|
401
|
+
|
402
|
+
# --------------------------------------------
|
403
|
+
end
|
404
|
+
|
405
|
+
private
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Basic needs
|
4
|
+
gem 'rails'
|
5
|
+
gem 'sass-rails'
|
6
|
+
gem 'coffee-rails'
|
7
|
+
gem 'jbuilder'
|
8
|
+
gem 'jquery-rails'
|
9
|
+
gem 'RailsInitializerGem'
|
10
|
+
|
11
|
+
# Speedup gems
|
12
|
+
gem 'uglifier'
|
13
|
+
gem 'turbolinks'
|
14
|
+
gem 'rails_serve_static_assets'
|
15
|
+
gem 'multi_fetch_fragments'
|
16
|
+
gem 'therubyracer'
|
17
|
+
gem 'htmlcompressor'
|
18
|
+
|
19
|
+
# Preitify gems
|
20
|
+
gem 'bootstrap-sass'
|
21
|
+
gem 'chosen-rails'
|
22
|
+
gem 'country_select'
|
23
|
+
gem 'friendly_id'
|
24
|
+
gem 'high_voltage'
|
25
|
+
|
26
|
+
# Security and Authentication gems
|
27
|
+
gem 'cancan'
|
28
|
+
gem 'devise', git: 'https://github.com/plataformatec/devise.git'
|
29
|
+
gem 'devise-encryptable'
|
30
|
+
gem 'devise_invitable'
|
31
|
+
gem 'devise-i18n'
|
32
|
+
gem 'devise-guests'
|
33
|
+
gem 'rolify'
|
34
|
+
|
35
|
+
# Forms Gem
|
36
|
+
gem 'simple_form', git: 'https://github.com/plataformatec/simple_form.git'
|
37
|
+
|
38
|
+
# Pagination Gem
|
39
|
+
gem 'will_paginate'
|
40
|
+
gem 'will_paginate-bootstrap'
|
41
|
+
|
42
|
+
# Cache Gem
|
43
|
+
gem 'redis-rails'
|
44
|
+
gem 'redis-namespace'
|
45
|
+
|
46
|
+
# Full-Text Search Gem
|
47
|
+
gem 'elasticsearch-model'
|
48
|
+
gem 'elasticsearch-rails'
|
49
|
+
|
50
|
+
# Jobs Gems
|
51
|
+
gem 'whenever'
|
52
|
+
gem "resque"
|
53
|
+
|
54
|
+
# Payment
|
55
|
+
gem 'activemerchant'
|
56
|
+
gem 'paypal-sdk-rest'
|
57
|
+
|
58
|
+
# Email
|
59
|
+
gem 'mandrill-api'
|
60
|
+
gem 'mandrill_mailer'
|
61
|
+
|
62
|
+
|
63
|
+
group :development do
|
64
|
+
gem 'sqlite3'
|
65
|
+
gem 'better_errors'
|
66
|
+
gem 'binding_of_caller'
|
67
|
+
gem 'capistrano'
|
68
|
+
gem 'capistrano-bundler'
|
69
|
+
gem 'capistrano-rails'
|
70
|
+
gem 'capistrano-rails-console'
|
71
|
+
gem 'capistrano-rvm'
|
72
|
+
gem 'guard-bundler'
|
73
|
+
gem 'guard-rails'
|
74
|
+
gem 'guard-rspec'
|
75
|
+
gem 'quiet_assets'
|
76
|
+
gem 'rails_layout'
|
77
|
+
# gem 'active_reload'
|
78
|
+
gem 'annotate'
|
79
|
+
end
|
80
|
+
group :development, :test do
|
81
|
+
gem 'factory_girl_rails'
|
82
|
+
gem 'pry-rails'
|
83
|
+
gem 'pry-rescue'
|
84
|
+
gem 'pry-stack_explorer'
|
85
|
+
gem 'rspec-rails'
|
86
|
+
end
|
87
|
+
group :production do
|
88
|
+
gem "pg"
|
89
|
+
gem 'unicorn'
|
90
|
+
gem 'yui-compressor'
|
91
|
+
end
|
92
|
+
group :test do
|
93
|
+
gem 'capybara'
|
94
|
+
gem 'database_cleaner'
|
95
|
+
gem 'email_spec'
|
96
|
+
gem 'colored'
|
97
|
+
gem 'deadweight', :require => 'deadweight/hijack/rails'
|
98
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<header class="navbar navbar-inverse navbar-static-top bs-docs-nav" id="top" role="banner">
|
2
|
+
<div class="container">
|
3
|
+
<div class="navbar-header">
|
4
|
+
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">
|
5
|
+
<span class="sr-only">Toggle navigation</span>
|
6
|
+
<span class="icon-bar"></span>
|
7
|
+
<span class="icon-bar"></span>
|
8
|
+
<span class="icon-bar"></span>
|
9
|
+
</button>
|
10
|
+
<%= link_to "Website Title", root_path, class: "navbar-brand" %>
|
11
|
+
</div>
|
12
|
+
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation" >
|
13
|
+
<ul class="nav navbar-nav">
|
14
|
+
<%= render 'layouts/navigation_links' %>
|
15
|
+
</ul>
|
16
|
+
<% if user_signed_in? %>
|
17
|
+
<ul class="nav navbar-nav pull-right">
|
18
|
+
<li><a href="#">Logged in as <strong><%= current_user.name %></strong></a></li>
|
19
|
+
</ul>
|
20
|
+
<% end %>
|
21
|
+
</nav>
|
22
|
+
</div>
|
23
|
+
</header>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%# add navigation links to this file %>
|
2
|
+
<li class="<%= 'active' if @title == nil %>"><%= link_to "Home", root_path %></li>
|
3
|
+
<li class="<%= 'active' if @title == 'Help' %>"><%= link_to "Help", help_path %></li>
|
4
|
+
<li class="<%= 'active' if @title == 'About' %>"><%= link_to "About", about_path %></li>
|
5
|
+
<li class="<%= 'active' if @title == 'Contact' %>"><%= link_to "Contact", contact_path %></li>
|
6
|
+
<% if user_signed_in? %>
|
7
|
+
<li id="fat-menu" class="dropdown">
|
8
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
9
|
+
Account <b class="caret"></b>
|
10
|
+
</a>
|
11
|
+
<ul class="dropdown-menu">
|
12
|
+
<li><%= link_to "Profile", edit_user_registration_path %></li>
|
13
|
+
<li><%= link_to "Settings", '#' %></li>
|
14
|
+
<li class="divider"></li>
|
15
|
+
<li><%= link_to "Sign out", destroy_user_session_path, :method =>:delete %></li>
|
16
|
+
</ul>
|
17
|
+
</li>
|
18
|
+
|
19
|
+
<% else %>
|
20
|
+
<li><%= link_to "Sign up", new_user_registration_path %></li>
|
21
|
+
<li ><%= link_to "Sign in", new_user_session_path %></li>
|
22
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<%- content_for :top do -%>
|
2
|
+
<h1>About</h1>
|
3
|
+
<p>About us</p>
|
4
|
+
<%- end -%>
|
5
|
+
|
6
|
+
<%- content_for :sidebar do -%>
|
7
|
+
<div class="col-md-3">
|
8
|
+
<div class="bs-sidebar hidden-print" role="complementary">
|
9
|
+
<ul class="nav bs-sidenav">
|
10
|
+
<li><%= link_to "Home", root_path, class: 'button' %></li>
|
11
|
+
<li><%= link_to "Help", help_path, class: 'button' %></li>
|
12
|
+
<li><%= link_to "Contact", contact_path, class: 'button' %></li>
|
13
|
+
<li><%= link_to "About", about_path, class: 'button' %></li>
|
14
|
+
</ul>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<%- end -%>
|
18
|
+
|
19
|
+
<%- content_for :bottom do -%>
|
20
|
+
<div class="col-md-9" role="main">
|
21
|
+
<div class="bs-docs-section">
|
22
|
+
<div class="page-header">
|
23
|
+
<h1 id="js-overview">Overview</h1>
|
24
|
+
</div>
|
25
|
+
<p>blablabla</p>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<%- end -%>
|
29
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<title><%= title %></title>
|
7
|
+
<meta name="description" content="<%= content_for?(:description) ? yield(:description) : "Vamo" %>">
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
9
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
10
|
+
|
11
|
+
</head>
|
12
|
+
<body class="<%= (request.path == root_path)? 'bs-docs-home' : nil %>">
|
13
|
+
|
14
|
+
<%= render 'layouts/navigation' %>
|
15
|
+
<%= render 'layouts/messages' %>
|
16
|
+
<!-- Banner No Top com informaçoes da página -->
|
17
|
+
<div class= "<%= (request.path == root_path)? 'bs-masthead' : 'bs-header' %>" id="content">
|
18
|
+
<div class="container">
|
19
|
+
<%= yield :top %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<% if request.path != root_path %>
|
23
|
+
<main role="main">
|
24
|
+
<!-- corpo do site -->
|
25
|
+
<div class="container bs-docs-container">
|
26
|
+
<div class="row">
|
27
|
+
<%= yield :sidebar %>
|
28
|
+
<%= yield :bottom %>
|
29
|
+
<%= yield %>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</main>
|
33
|
+
<% end %>
|
34
|
+
</body>
|
35
|
+
</html>
|