cybele 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +16 -2
- data/dump.rdb +1 -0
- data/lib/cybele/app_builder.rb +213 -220
- data/lib/cybele/generators/app_generator.rb +31 -20
- data/lib/cybele/version.rb +2 -2
- data/templates/.env.local.erb +11 -0
- data/templates/.env.production.erb +11 -0
- data/templates/.env.staging.erb +11 -0
- data/templates/README.md.erb +22 -0
- data/templates/app/assets/javascripts/application.js.coffee +63 -1
- data/templates/app/assets/javascripts/hq/application.js.coffee +93 -0
- data/templates/app/assets/stylesheets/application.css.sass +15 -4
- data/templates/app/assets/stylesheets/hq/application.css.sass +92 -0
- data/templates/app/controllers/application_controller.rb.erb +48 -0
- data/templates/app/controllers/concerns/basic_authentication.rb +18 -0
- data/templates/app/controllers/hq/admins_controller.rb +64 -0
- data/templates/app/controllers/hq/application_controller.rb +11 -0
- data/templates/app/controllers/hq/audits_controller.rb +16 -0
- data/templates/app/controllers/hq/cities_controller.rb +54 -0
- data/templates/app/controllers/hq/countries_controller.rb +54 -0
- data/templates/app/controllers/hq/dashboard_controller.rb +4 -1
- data/templates/app/controllers/hq/passwords_controller.rb +10 -0
- data/templates/app/controllers/hq/registrations_controller.rb +21 -0
- data/templates/app/controllers/hq/sessions_controller.rb +1 -1
- data/templates/app/controllers/hq/users_controller.rb +64 -0
- data/templates/app/controllers/user/dashboard_controller.rb +8 -0
- data/templates/app/controllers/user/passwords_controller.rb +10 -0
- data/templates/app/controllers/user/profiles_controller.rb +34 -0
- data/templates/app/controllers/user/registrations_controller.rb +20 -0
- data/templates/app/controllers/user/sessions_controller.rb +16 -0
- data/templates/app/controllers/user/user_application_controller.rb +20 -0
- data/templates/app/helpers/application_helper.rb.erb +27 -0
- data/templates/app/mailers/admin_mailer.rb +10 -0
- data/templates/app/mailers/base_mailer.rb +4 -0
- data/templates/app/mailers/user_mailer.rb +10 -0
- data/templates/app/models/admin.rb +51 -0
- data/templates/app/models/audit.rb +3 -0
- data/templates/app/models/city.rb +12 -0
- data/templates/app/models/country.rb +12 -0
- data/templates/app/models/user.rb +54 -0
- data/templates/app/views/admin_mailer/login_info.html.haml +13 -0
- data/templates/app/views/devise/confirmations/new.html.haml +6 -5
- data/templates/app/views/devise/mailer/confirmation_instructions.html.haml +5 -3
- data/templates/app/views/devise/mailer/reset_password_instructions.html.haml +2 -2
- data/templates/app/views/devise/passwords/edit.html.haml +3 -3
- data/templates/app/views/devise/passwords/new.html.haml +3 -3
- data/templates/app/views/devise/registrations/edit.html.haml +5 -11
- data/templates/app/views/devise/registrations/new.html.haml +18 -6
- data/templates/app/views/devise/sessions/new.html.haml +1 -1
- data/templates/app/views/devise/shared/_links.haml +3 -1
- data/templates/app/views/devise/unlocks/new.html.haml +4 -4
- data/templates/app/views/hq/admins/_admin.html.haml +21 -0
- data/templates/app/views/hq/admins/_blank.html.haml +9 -0
- data/templates/app/views/hq/admins/_filters.html.haml +20 -0
- data/templates/app/views/hq/admins/_form.html.haml +17 -0
- data/templates/app/views/hq/admins/_list.html.haml +15 -0
- data/templates/app/views/hq/admins/edit.html.haml +3 -0
- data/templates/app/views/hq/admins/index.html.haml +18 -0
- data/templates/app/views/hq/admins/new.html.haml +5 -0
- data/templates/app/views/hq/admins/show.html.haml +19 -0
- data/templates/app/views/hq/audits/_filters.html.haml +32 -0
- data/templates/app/views/hq/audits/_list.html.haml +37 -0
- data/templates/app/views/hq/audits/index.html.haml +5 -0
- data/templates/app/views/hq/audits/show.html.haml +5 -0
- data/templates/app/views/hq/cities/_blank.html.haml +9 -0
- data/templates/app/views/hq/cities/_city.html.haml +12 -0
- data/templates/app/views/hq/cities/_filters.html.haml +15 -0
- data/templates/app/views/hq/cities/_form.html.haml +15 -0
- data/templates/app/views/hq/cities/_list.html.haml +13 -0
- data/templates/app/views/hq/cities/edit.html.haml +3 -0
- data/templates/app/views/hq/cities/index.html.haml +18 -0
- data/templates/app/views/hq/cities/new.html.haml +3 -0
- data/templates/app/views/hq/cities/show.html.haml +13 -0
- data/templates/app/views/hq/countries/_blank.html.haml +9 -0
- data/templates/app/views/hq/countries/_country.html.haml +11 -0
- data/templates/app/views/hq/countries/_filters.html.haml +14 -0
- data/templates/app/views/hq/countries/_form.html.haml +14 -0
- data/templates/app/views/hq/countries/_list.html.haml +12 -0
- data/templates/app/views/hq/countries/edit.html.haml +3 -0
- data/templates/app/views/hq/countries/index.html.haml +18 -0
- data/templates/app/views/hq/countries/new.html.haml +3 -0
- data/templates/app/views/hq/countries/show.html.haml +14 -0
- data/templates/app/views/hq/dashboard/index.html.haml +8 -0
- data/templates/app/views/hq/passwords/edit.html.haml +12 -0
- data/templates/app/views/hq/passwords/new.html.haml +9 -0
- data/templates/app/views/hq/registrations/edit.html.haml +19 -0
- data/templates/app/views/hq/sessions/new.html.haml +7 -5
- data/templates/app/views/hq/users/_blank.html.haml +9 -0
- data/templates/app/views/hq/users/_filters.html.haml +20 -0
- data/templates/app/views/hq/users/_form.html.haml +18 -0
- data/templates/app/views/hq/users/_list.html.haml +15 -0
- data/templates/app/views/hq/users/_user.html.haml +20 -0
- data/templates/app/views/hq/users/edit.html.haml +3 -0
- data/templates/app/views/hq/users/index.html.haml +18 -0
- data/templates/app/views/hq/users/new.html.haml +5 -0
- data/templates/app/views/hq/users/show.html.haml +20 -0
- data/templates/app/views/layouts/application.html.haml.erb +16 -8
- data/templates/app/views/layouts/hq/application.html.haml.erb +55 -0
- data/templates/app/views/layouts/hq/login.html.haml.erb +35 -0
- data/templates/app/views/layouts/hq/partials/_dock.html.haml.erb +36 -0
- data/templates/app/views/layouts/hq/partials/_footer.html.haml.erb +0 -0
- data/templates/app/views/layouts/hq/partials/_navbar.html.haml.erb +22 -0
- data/templates/app/views/layouts/hq/partials/_trackers.html.haml.erb +0 -0
- data/templates/app/views/layouts/mailer.html.haml.erb +321 -0
- data/templates/app/views/layouts/mailer.text.haml +1 -0
- data/templates/app/views/layouts/partials/_footer.html.haml.erb +0 -0
- data/templates/app/views/layouts/partials/_trackers.html.haml.erb +0 -0
- data/templates/app/views/layouts/partials/_warnings.html.haml.erb +3 -0
- data/templates/app/views/user/dashboard/index.html.haml +8 -0
- data/templates/app/views/user/passwords/edit.html.haml +12 -0
- data/templates/app/views/user/passwords/new.html.haml +10 -0
- data/templates/app/views/{user_profiles → user/profiles}/_form.html.haml +4 -5
- data/templates/app/views/user/profiles/edit.html.haml +3 -0
- data/templates/app/views/user/profiles/show.html.haml +15 -0
- data/templates/app/views/user/registrations/edit.html.haml +19 -0
- data/templates/app/views/user/sessions/new.html.haml +11 -0
- data/templates/app/views/user_mailer/login_info.html.haml +13 -0
- data/templates/app/views/welcome/index.html.haml.erb +4 -4
- data/templates/config/initializers/devise_async.rb +6 -0
- data/templates/config/initializers/sidekiq.rb +13 -0
- data/templates/config/locales/email.tr.yml +28 -0
- data/templates/config/locales/models.tr.yml +72 -41
- data/templates/config/locales/responders.tr.yml +4 -1
- data/templates/config/locales/show_for.tr.yml +1 -3
- data/templates/config/locales/simple_form.tr.yml +8 -22
- data/templates/config/locales/tr.yml +33 -2
- data/templates/config/locales/view.tr.yml +64 -18
- data/templates/config/routes.erb +51 -0
- data/templates/config/schedule.yml +16 -0
- data/templates/config/settings/production.yml +0 -17
- data/templates/config/settings/staging.yml +0 -17
- data/templates/config/sidekiq.yml +13 -0
- data/templates/cybele_Gemfile +42 -5
- data/templates/cybele_gitignore +3 -1
- data/templates/cybele_version.txt +1 -0
- data/templates/env.sample.erb +11 -0
- data/templates/lib/data/cities.yml +163 -0
- data/templates/lib/tasks/dev.rake +29 -5
- data/templates/lib/tasks/sidekiq.rake +26 -0
- data/templates/lib/templates/rails/responders_controller/controller.rb +27 -22
- data/templates/public/images/favicon.png +0 -0
- data/templates/public/images/mail-logo.png +0 -0
- data/templates/public/images/missing_cover.png +0 -0
- data/templates/public/images/missing_cover@2x.png +0 -0
- data/templates/public/images/missing_logo.png +0 -0
- data/templates/public/images/missing_logo@2x.png +0 -0
- data/templates/public/images/sprite.png +0 -0
- data/templates/ruby-version +1 -1
- data/templates/vendor/assets/javascripts/jquery.datetimepicker.js +1871 -0
- data/templates/vendor/assets/javascripts/jquery.maskedinput.min.js +7 -0
- data/templates/vendor/assets/javascripts/nprogress.js +491 -0
- data/templates/vendor/assets/javascripts/trix.js +25 -0
- data/templates/vendor/assets/stylesheets/jquery.datetimepicker.css +418 -0
- data/templates/vendor/assets/stylesheets/nprogress.css +74 -0
- data/templates/vendor/assets/stylesheets/trix.css +209 -0
- metadata +125 -24
- data/templates/app/controllers/application_controller.rb +0 -19
- data/templates/app/controllers/hq/admin_profiles_controller.rb +0 -56
- data/templates/app/controllers/user_profiles_controller.rb +0 -56
- data/templates/app/views/hq/admin_profiles/_form.html.haml +0 -15
- data/templates/app/views/hq/admin_profiles/edit.html.haml +0 -3
- data/templates/app/views/hq/admin_profiles/new.html.haml +0 -3
- data/templates/app/views/hq/admin_profiles/show.html.haml +0 -13
- data/templates/app/views/hq/dashboard/index.html.haml.erb +0 -3
- data/templates/app/views/user_profiles/edit.html.haml +0 -3
- data/templates/app/views/user_profiles/new.html.haml +0 -3
- data/templates/app/views/user_profiles/show.html.haml +0 -13
- data/templates/config/locales/en.yml +0 -2
- data/templates/config/locales/models.en.yml +0 -54
- data/templates/config/locales/responders.en.yml +0 -10
- data/templates/config/locales/show_for.en.yml +0 -7
- data/templates/config/locales/simple_form.en.yml +0 -30
- data/templates/config/locales/view.en.yml +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d20082fbfddfd73323a2fe7744834c8c5fb7463
|
4
|
+
data.tar.gz: 79f5f17d6a28b742fc333b15d35ae4f0304ae0cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dd8e0f4af300b4fe2ed0429d29fe3fc8a4cf7bbdd5bfbde6c659182c1d1c63c3375112a5b57a0c087a357cdaae75fd4555076287f0c6335924f7aa99d326752
|
7
|
+
data.tar.gz: 24ac8854aa5317c48c21c7b7ff89acfe2b8c6f4e6fb38c3c838a63df46182ab428b0eb1e2f14c9bae511eafcf37787e2583a40d1542200b5427c6d745b8a71f1
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ western colonies from around the 6th century BCE.
|
|
13
13
|
|
14
14
|
Before generating your application, you will need:
|
15
15
|
|
16
|
-
* Ruby ~> 2.
|
16
|
+
* Ruby ~> 2.3
|
17
17
|
* Rails ~> 4.2
|
18
18
|
|
19
19
|
## Usage
|
@@ -25,10 +25,24 @@ gem install cybele
|
|
25
25
|
cybele project_name
|
26
26
|
```
|
27
27
|
|
28
|
-
When the initialization is completed, there will be
|
28
|
+
When the initialization is completed, there will be some required settings.
|
29
29
|
|
30
|
+
* Set .env.local variables
|
31
|
+
* Set access_token in config/initializers/rollbar.rb
|
32
|
+
* Set default values for is_active, time_zone variable using in User and Admin model migrations db/migrate/*.rb
|
33
|
+
* Change username and password in config/settings.yml
|
34
|
+
* In public folder run this command ln -s ../VERSION.txt VERSION.txt
|
35
|
+
|
36
|
+
We are using sidekiq with redis-server for background jobs.
|
37
|
+
Before the run application look our env.sample file. It should be in project root directory with this name .env.local
|
30
38
|
```bash
|
39
|
+
bundle
|
40
|
+
redis-server
|
41
|
+
rake sidekiq:start
|
42
|
+
rake db:create
|
31
43
|
rake db:migrate
|
44
|
+
rake dev:seed
|
45
|
+
rails s
|
32
46
|
```
|
33
47
|
|
34
48
|
## What cybele do and included?
|
data/dump.rdb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
REDIS0006�ܳC�Z��V
|
data/lib/cybele/app_builder.rb
CHANGED
@@ -7,11 +7,11 @@ module Cybele
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def remove_readme_rdoc
|
10
|
-
remove_file 'README.rdoc'
|
10
|
+
remove_file 'README.rdoc', force: true
|
11
11
|
end
|
12
12
|
|
13
13
|
def replace_gemfile
|
14
|
-
remove_file 'Gemfile'
|
14
|
+
remove_file 'Gemfile', force: true
|
15
15
|
copy_file 'cybele_Gemfile', 'Gemfile'
|
16
16
|
end
|
17
17
|
|
@@ -32,20 +32,16 @@ module Cybele
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def replace_erb_with_haml
|
35
|
-
remove_file 'app/views/layouts/application.html.erb'
|
35
|
+
remove_file 'app/views/layouts/application.html.erb', force: true
|
36
36
|
template 'app/views/layouts/application.html.haml.erb', 'app/views/layouts/application.html.haml', force: true
|
37
37
|
end
|
38
38
|
|
39
|
-
def copy_rake_files
|
40
|
-
copy_file 'lib/tasks/annotate.rake', 'lib/tasks/annotate.rake', force: true
|
41
|
-
end
|
42
|
-
|
43
39
|
def install_responder_gem
|
44
40
|
copy_file 'lib/application_responder.rb', 'lib/application_responder.rb'
|
45
|
-
remove_file 'app/controllers/application_controller.rb'
|
41
|
+
remove_file 'app/controllers/application_controller.rb', force: true
|
46
42
|
copy_file 'app/controllers/application_controller.rb', 'app/controllers/application_controller.rb'
|
43
|
+
copy_file 'app/controllers/concerns/basic_authentication.rb', 'app/controllers/concerns/basic_authentication.rb'
|
47
44
|
copy_file 'lib/templates/rails/responders_controller/controller.rb', 'lib/templates/rails/responders_controller/controller.rb'
|
48
|
-
copy_file 'config/locales/responders.en.yml', 'config/locales/responders.en.yml'
|
49
45
|
copy_file 'config/locales/responders.tr.yml', 'config/locales/responders.tr.yml'
|
50
46
|
end
|
51
47
|
|
@@ -58,7 +54,7 @@ module Cybele
|
|
58
54
|
end
|
59
55
|
|
60
56
|
def setup_gitignore_files
|
61
|
-
remove_file '.gitignore'
|
57
|
+
remove_file '.gitignore', force: true
|
62
58
|
copy_file 'cybele_gitignore', '.gitignore'
|
63
59
|
end
|
64
60
|
|
@@ -78,45 +74,54 @@ module Cybele
|
|
78
74
|
end
|
79
75
|
|
80
76
|
def setup_asset_precompile
|
81
|
-
|
82
77
|
config = <<-RUBY
|
83
|
-
|
84
78
|
config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
85
79
|
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
|
86
80
|
config.sass.preferred_syntax = :sass
|
81
|
+
config.i18n.default_locale = :tr
|
82
|
+
config.time_zone = 'Istanbul'
|
83
|
+
config.i18n.fallbacks = true
|
84
|
+
config.active_job.queue_adapter = :sidekiq
|
87
85
|
RUBY
|
88
|
-
|
89
|
-
inject_into_file 'config/application.rb', config, :after => '# config.i18n.default_locale = :de'
|
86
|
+
inject_into_file 'config/application.rb', config, after: '# config.i18n.default_locale = :de'
|
90
87
|
end
|
91
88
|
|
92
89
|
def convert_application_js_to_coffee
|
93
|
-
remove_file 'app/assets/javascripts/application.js'
|
90
|
+
remove_file 'app/assets/javascripts/application.js', force: true
|
94
91
|
copy_file 'app/assets/javascripts/application.js.coffee', 'app/assets/javascripts/application.js.coffee'
|
95
92
|
end
|
96
93
|
|
97
94
|
def convert_application_css_to_sass
|
98
|
-
remove_file 'app/assets/stylesheets/application.css'
|
95
|
+
remove_file 'app/assets/stylesheets/application.css', force: true
|
99
96
|
copy_file 'app/assets/stylesheets/application.css.sass', 'app/assets/stylesheets/application.css.sass'
|
100
97
|
end
|
101
98
|
|
99
|
+
def copy_vendor_assets
|
100
|
+
directory 'vendor/assets', 'vendor/assets'
|
101
|
+
end
|
102
|
+
|
102
103
|
def configure_smtp
|
103
|
-
remove_file 'config/settings/production.yml'
|
104
|
+
remove_file 'config/settings/production.yml', force: true
|
104
105
|
copy_file 'config/settings/production.yml', 'config/settings/production.yml'
|
105
106
|
copy_file 'config/settings/staging.yml', 'config/settings/staging.yml'
|
106
107
|
|
108
|
+
config = <<-RUBY
|
109
|
+
Mail.register_interceptor RecipientInterceptor.new(Settings.email.sandbox, subject_prefix: '[STAGING]')
|
110
|
+
RUBY
|
111
|
+
configure_environment 'staging', config
|
112
|
+
|
107
113
|
config = <<-RUBY
|
108
114
|
config.action_mailer.delivery_method = :smtp
|
109
115
|
config.action_mailer.raise_delivery_errors = false
|
110
116
|
config.action_mailer.smtp_settings = {
|
111
|
-
address: Settings.smtp.
|
112
|
-
port: Settings.smtp.
|
113
|
-
enable_starttls_auto: Settings.smtp.
|
114
|
-
user_name: Settings.smtp.
|
115
|
-
password: Settings.smtp.
|
116
|
-
authentication: Settings.smtp.
|
117
|
+
address: Settings.smtp.address,
|
118
|
+
port: Settings.smtp.port,
|
119
|
+
enable_starttls_auto: Settings.smtp.enable_starttls_auto,
|
120
|
+
user_name: Settings.smtp.user_name,
|
121
|
+
password: Settings.smtp.password,
|
122
|
+
authentication: Settings.smtp.authentication
|
117
123
|
}
|
118
124
|
RUBY
|
119
|
-
|
120
125
|
configure_environment 'production', config
|
121
126
|
configure_environment 'staging', config
|
122
127
|
end
|
@@ -127,29 +132,57 @@ config.after_initialize do
|
|
127
132
|
Bullet.enable = true
|
128
133
|
Bullet.alert = true
|
129
134
|
Bullet.bullet_logger = true
|
135
|
+
Bullet.console = true
|
136
|
+
Bullet.rails_logger = true
|
137
|
+
Bullet.add_footer = false
|
130
138
|
end
|
131
139
|
RUBY
|
132
|
-
|
133
140
|
configure_environment 'development', config
|
134
141
|
end
|
135
142
|
|
136
143
|
def setup_staging_environment
|
137
144
|
run 'cp config/environments/production.rb config/environments/staging.rb'
|
138
|
-
|
139
|
-
prepend_file 'config/environments/staging.rb',
|
140
|
-
"Mail.register_interceptor RecipientInterceptor.new(Settings.email.noreply, subject_prefix: '[STAGING]')\n"
|
141
|
-
|
142
145
|
config = <<-YML
|
143
146
|
email:
|
147
|
+
sandbox: sandbox@#{app_name}.com
|
144
148
|
noreply: no-reply@#{app_name}.com
|
149
|
+
admin: admin@#{app_name}.com
|
150
|
+
|
151
|
+
basic_auth:
|
152
|
+
username: #{app_name}
|
153
|
+
password: #{app_name}
|
154
|
+
|
155
|
+
sidekiq:
|
156
|
+
username: #{app_name}
|
157
|
+
password: #{app_name}
|
158
|
+
|
159
|
+
root_path: <%= ENV['ROOT_PATH'] %>
|
160
|
+
|
161
|
+
smtp:
|
162
|
+
address: <%= ENV['SMTP_ADDRESS'] %>
|
163
|
+
port: 587
|
164
|
+
enable_starttls_auto: true
|
165
|
+
user_name: <%= ENV['SMTP_USER_NAME'] %>
|
166
|
+
password: <%= ENV['SMTP_PASSWORD'] %>
|
167
|
+
authentication: 'plain'
|
168
|
+
|
169
|
+
AWS:
|
170
|
+
S3:
|
171
|
+
bucket: <%= ENV['S3_BUCKET_NAME'] %>
|
172
|
+
access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
|
173
|
+
secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
|
174
|
+
aws_url: http://<%= ENV['AWS_RAW_URL'] %>
|
175
|
+
aws_raw_url: <%= ENV['AWS_RAW_URL'] %>
|
176
|
+
# Bucket region should be ireland for this setting
|
177
|
+
end_point: s3-eu-west-1.amazonaws.com
|
145
178
|
YML
|
146
179
|
prepend_file 'config/settings.yml', config
|
147
180
|
end
|
148
181
|
|
149
182
|
def configure_action_mailer
|
150
|
-
action_mailer_host 'development'
|
151
|
-
action_mailer_host 'staging'
|
152
|
-
action_mailer_host 'production'
|
183
|
+
action_mailer_host 'development'
|
184
|
+
action_mailer_host 'staging'
|
185
|
+
action_mailer_host 'production'
|
153
186
|
end
|
154
187
|
|
155
188
|
def setup_letter_opener
|
@@ -162,14 +195,11 @@ email:
|
|
162
195
|
end
|
163
196
|
|
164
197
|
def generate_capybara
|
165
|
-
inject_into_file 'spec/spec_helper.rb', :
|
166
|
-
|
198
|
+
inject_into_file 'spec/spec_helper.rb', after: "require 'rspec/autorun'" do <<-CODE
|
167
199
|
require 'capybara/rspec'
|
168
200
|
CODE
|
169
201
|
end
|
170
|
-
inject_into_file 'spec/spec_helper.rb', :
|
171
|
-
|
172
|
-
|
202
|
+
inject_into_file 'spec/spec_helper.rb', after: ' config.order = "random"' do <<-CODE
|
173
203
|
# Capybara DSL
|
174
204
|
config.include Capybara::DSL
|
175
205
|
CODE
|
@@ -177,9 +207,7 @@ require 'capybara/rspec'
|
|
177
207
|
end
|
178
208
|
|
179
209
|
def generate_factory_girl
|
180
|
-
inject_into_file 'spec/spec_helper.rb', :
|
181
|
-
|
182
|
-
|
210
|
+
inject_into_file 'spec/spec_helper.rb', after: ' config.include Capybara::DSL' do <<-CODE
|
183
211
|
# Factory girl
|
184
212
|
config.include FactoryGirl::Syntax::Methods
|
185
213
|
CODE
|
@@ -194,34 +222,28 @@ require 'capybara/rspec'
|
|
194
222
|
|
195
223
|
def generate_exception_notification
|
196
224
|
generate 'exception_notification:install'
|
225
|
+
generate 'rollbar your_token'
|
197
226
|
end
|
198
227
|
|
199
228
|
def add_exception_notification_to_environments
|
200
229
|
config = <<-CODE
|
201
230
|
config.middleware.use ExceptionNotification::Rack,
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
231
|
+
email: {
|
232
|
+
email_prefix: "[#{app_name}]",
|
233
|
+
sender_address: %{"Notifier" <notifier@#{app_name}.com>},
|
234
|
+
exception_recipients: %w{your_email@address.com}
|
206
235
|
}
|
207
236
|
CODE
|
208
|
-
|
209
237
|
configure_environment('production', config)
|
210
238
|
configure_environment('staging', config)
|
211
|
-
|
212
|
-
inject_into_file 'config/initializers/exception_notification.rb', :before => 'config.add_notifier :email, {' do <<-RUBY
|
239
|
+
inject_into_file 'config/initializers/exception_notification.rb', before: 'config.add_notifier :email, {' do <<-RUBY
|
213
240
|
unless Rails.env == 'development'
|
214
241
|
RUBY
|
215
242
|
end
|
216
|
-
|
217
|
-
inject_into_file 'config/initializers/exception_notification.rb', :before => '# Campfire notifier sends notifications to your Campfire room.' do <<-RUBY
|
243
|
+
inject_into_file 'config/initializers/exception_notification.rb', before: '# Campfire notifier sends notifications to your Campfire room.' do <<-RUBY
|
218
244
|
end
|
219
245
|
RUBY
|
220
246
|
end
|
221
|
-
|
222
|
-
end
|
223
|
-
|
224
|
-
def leftovers
|
225
247
|
end
|
226
248
|
|
227
249
|
def generate_rails_config
|
@@ -232,12 +254,16 @@ config.middleware.use ExceptionNotification::Rack,
|
|
232
254
|
generate 'devise:install'
|
233
255
|
gsub_file 'config/initializers/filter_parameter_logging.rb', /:password/, ':password, :password_confirmation'
|
234
256
|
gsub_file 'config/initializers/devise.rb', /please-change-me-at-config-initializers-devise@example.com/, "no-reply@#{app_name}.com"
|
257
|
+
inject_into_file 'config/initializers/devise.rb', after: "# config.mailer = 'Devise::Mailer'\n" do <<-RUBY
|
258
|
+
Devise::Mailer.layout 'mailer'
|
259
|
+
RUBY
|
260
|
+
end
|
235
261
|
end
|
236
262
|
|
237
|
-
def
|
238
|
-
generate
|
239
|
-
generate_devise_strong_parameters(
|
240
|
-
remove_file 'config/locales/devise.en.yml'
|
263
|
+
def generate_devise_user
|
264
|
+
generate 'devise User name:string surname:string is_active:boolean time_zone:string'
|
265
|
+
generate_devise_strong_parameters('user')
|
266
|
+
remove_file 'config/locales/devise.en.yml', force: true
|
241
267
|
end
|
242
268
|
|
243
269
|
def generate_devise_views
|
@@ -247,61 +273,29 @@ config.middleware.use ExceptionNotification::Rack,
|
|
247
273
|
def generate_welcome_page
|
248
274
|
copy_file 'app/controllers/welcome_controller.rb', 'app/controllers/welcome_controller.rb'
|
249
275
|
template 'app/views/welcome/index.html.haml.erb', 'app/views/welcome/index.html.haml', force: true
|
250
|
-
route "root to: 'welcome#index'"
|
251
276
|
end
|
252
277
|
|
253
|
-
def
|
254
|
-
generate
|
255
|
-
create_namespace_routing('hq')
|
256
|
-
directory 'app/controllers/hq', 'app/controllers/hq'
|
257
|
-
#template 'app/views/layouts/hq/base.html.haml.erb', 'app/views/layouts/hq/base.html.haml', force: true
|
258
|
-
template 'app/views/hq/dashboard/index.html.haml.erb', 'app/views/hq/dashboard/index.html.haml', force: true
|
259
|
-
directory 'app/views/hq/sessions', 'app/views/hq/sessions'
|
260
|
-
gsub_file 'config/routes.rb', /devise_for :admins/, "devise_for :admins, controllers: {sessions: 'hq/sessions'}, path: 'hq',
|
261
|
-
path_names: {sign_in: 'login', sign_out: 'logout', password: 'secret',
|
262
|
-
confirmation: 'verification'}"
|
263
|
-
gsub_file 'app/models/admin.rb', /:registerable,/, ''
|
264
|
-
|
265
|
-
say 'Configuring profile editors...'
|
266
|
-
setup_profile_editors
|
267
|
-
end
|
268
|
-
|
269
|
-
def setup_profile_editors
|
270
|
-
# Inserting routes
|
271
|
-
inject_into_file 'config/routes.rb', :after => "namespace :hq do\n" do <<-RUBY
|
272
|
-
root to: 'dashboard#index'
|
273
|
-
resource :admin_profile, except: [:destroy], path: 'profile'
|
274
|
-
RUBY
|
275
|
-
end
|
276
|
-
|
277
|
-
inject_into_file 'config/routes.rb', :after => "to: 'welcome#index'\n" do <<-RUBY
|
278
|
+
def setup_namespaces
|
279
|
+
generate 'devise Admin name:string surname:string is_active:boolean time_zone:string'
|
278
280
|
|
279
|
-
|
280
|
-
|
281
|
-
RUBY
|
282
|
-
end
|
283
|
-
end
|
281
|
+
directory 'app/controllers/hq', 'app/controllers/hq'
|
282
|
+
directory 'app/views/hq', 'app/views/hq'
|
284
283
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
end
|
284
|
+
# User controllers
|
285
|
+
directory 'app/controllers/user', 'app/controllers/user'
|
286
|
+
directory 'app/views/user', 'app/views/user'
|
289
287
|
|
290
|
-
def create_profile
|
291
|
-
add_profile_models
|
292
|
-
add_profile_controllers
|
293
|
-
add_profile_views
|
294
288
|
end
|
295
289
|
|
296
290
|
def create_hierapolis_theme
|
297
|
-
remove_file 'lib/templates/rails/responders_controller/controller.rb'
|
298
|
-
remove_file 'lib/templates/haml/scaffold/_form.html.haml'
|
291
|
+
remove_file 'lib/templates/rails/responders_controller/controller.rb', force: true
|
292
|
+
remove_file 'lib/templates/haml/scaffold/_form.html.haml', force: true
|
299
293
|
generate 'hierapolis:install'
|
300
294
|
end
|
301
295
|
|
302
296
|
def replace_simple_form_wrapper
|
303
|
-
remove_file 'config/initializers/simple_form.rb'
|
304
|
-
remove_file 'config/initializers/simple_form_bootstrap.rb'
|
297
|
+
remove_file 'config/initializers/simple_form.rb', force: true
|
298
|
+
remove_file 'config/initializers/simple_form_bootstrap.rb', force: true
|
305
299
|
|
306
300
|
copy_file 'config/initializers/simple_form.rb', 'config/initializers/simple_form.rb'
|
307
301
|
copy_file 'config/initializers/simple_form_bootstrap.rb', 'config/initializers/simple_form_bootstrap.rb'
|
@@ -318,7 +312,7 @@ config.middleware.use ExceptionNotification::Rack,
|
|
318
312
|
# Change my_app_name string in the deploy.rb file with app_name that is created
|
319
313
|
gsub_file 'config/deploy.rb', /my_app_name/, "#{app_name}"
|
320
314
|
|
321
|
-
inject_into_file 'Capfile', :
|
315
|
+
inject_into_file 'Capfile', after: "require 'capistrano/deploy'\n" do <<-RUBY
|
322
316
|
require 'capistrano/rails'
|
323
317
|
require 'capistrano/bundler'
|
324
318
|
require 'sshkit/sudo'
|
@@ -346,7 +340,7 @@ set :project_domain, "staging.example.com"'
|
|
346
340
|
end
|
347
341
|
|
348
342
|
def update_secret_token
|
349
|
-
remove_file 'config/initializers/secret_token.rb'
|
343
|
+
remove_file 'config/initializers/secret_token.rb', force: true
|
350
344
|
template 'config/initializers/secret_token.erb', 'config/initializers/secret_token.rb'
|
351
345
|
end
|
352
346
|
|
@@ -355,85 +349,158 @@ set :project_domain, "staging.example.com"'
|
|
355
349
|
end
|
356
350
|
|
357
351
|
def create_dev_rake
|
358
|
-
copy_file 'lib/tasks/dev.rake', 'lib/tasks/dev.rake'
|
359
352
|
end
|
360
353
|
|
361
354
|
def custom_exception_page
|
362
355
|
copy_file 'app/views/errors/internal_server_error.html.haml', 'app/views/errors/internal_server_error.html.haml'
|
363
|
-
inject_into_file 'app/controllers/application_controller.rb', :before => 'protected' do <<-CODE
|
364
|
-
|
365
|
-
# rescue_from Exception, :with => :server_error
|
366
|
-
def server_error(exception)
|
367
|
-
# ExceptionNotifier::Notifier.exception_notification(request.env, exception).deliver
|
368
|
-
respond_to do |format|
|
369
|
-
format.html { render template: 'errors/internal_server_error', layout: 'layouts/application', status: 500 }
|
370
|
-
format.all { render nothing: true, status: 500}
|
371
|
-
end
|
372
|
-
end
|
373
|
-
CODE
|
374
|
-
end
|
375
356
|
end
|
376
357
|
|
377
358
|
def custom_404
|
378
359
|
copy_file 'app/views/errors/not_found.html.haml', 'app/views/errors/not_found.html.haml'
|
379
|
-
inject_into_file 'app/controllers/application_controller.rb', :before => 'protected' do <<-CODE
|
380
|
-
|
381
|
-
rescue_from ActiveRecord::RecordNotFound, :with => :page_not_found
|
382
|
-
rescue_from ActionController::RoutingError, :with => :page_not_found
|
383
|
-
def page_not_found
|
384
|
-
respond_to do |format|
|
385
|
-
format.html { render template: 'errors/not_found', layout: 'layouts/application', status: 404 }
|
386
|
-
format.all { render nothing: true, status: 404 }
|
387
|
-
end
|
388
|
-
end
|
389
|
-
CODE
|
390
|
-
end
|
391
360
|
end
|
392
361
|
|
393
|
-
# Add default admin user and admin profile seeder
|
394
362
|
def add_seeds
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
admin = Admin.create(email: "admin@#{app_name}.com", password: '12341234', password_confirmation: '12341234')
|
399
|
-
admin.admin_profile = AdminProfile.create(first_name: 'Admin', last_name: "#{app_name}")
|
400
|
-
|
363
|
+
inject_into_file 'db/seeds.rb', after: "# Mayor.create(name: 'Emanuel', city: cities.first)\n" do <<-RUBY
|
364
|
+
Admin.create(email: "admin@#{app_name}.com", name: 'Admin', surname: 'Admin', password: '12341234', password_confirmation: '12341234')
|
401
365
|
RUBY
|
402
366
|
end
|
403
367
|
end
|
404
368
|
|
405
|
-
# Copy
|
406
|
-
def
|
369
|
+
# Copy files
|
370
|
+
def copy_files
|
371
|
+
|
372
|
+
# Locale files
|
407
373
|
say 'Coping files..'
|
408
|
-
|
374
|
+
remove_file 'config/locales/en.yml', force: true
|
375
|
+
remove_file 'config/locales/simple_form.en.yml', force: true
|
409
376
|
copy_file 'config/locales/models.tr.yml', 'config/locales/models.tr.yml'
|
410
|
-
copy_file 'config/locales/show_for.en.yml', 'config/locales/show_for.en.yml'
|
411
377
|
copy_file 'config/locales/show_for.tr.yml', 'config/locales/show_for.tr.yml'
|
412
378
|
copy_file 'config/locales/simple_form.tr.yml', 'config/locales/simple_form.tr.yml'
|
413
|
-
copy_file 'config/locales/view.en.yml', 'config/locales/view.en.yml'
|
414
379
|
copy_file 'config/locales/view.tr.yml', 'config/locales/view.tr.yml'
|
380
|
+
copy_file 'config/locales/email.tr.yml', 'config/locales/email.tr.yml'
|
381
|
+
|
382
|
+
# Model files
|
383
|
+
remove_file 'app/models/admin.rb', force: true
|
384
|
+
remove_file 'app/models/user.rb', force: true
|
385
|
+
remove_file 'app/models/city.rb', force: true
|
386
|
+
remove_file 'app/models/country.rb', force: true
|
387
|
+
directory 'app/models', 'app/models'
|
388
|
+
|
389
|
+
# Helper files
|
390
|
+
remove_file 'app/helpers/application_helper.rb', force: true
|
391
|
+
template 'app/helpers/application_helper.rb.erb', 'app/helpers/application_helper.rb'
|
392
|
+
|
393
|
+
# Route file
|
394
|
+
say 'Restore routes.rb'
|
395
|
+
remove_file 'config/routes.rb', force: true
|
396
|
+
template 'config/routes.erb', 'config/routes.rb'
|
397
|
+
|
398
|
+
# Hq layout files
|
399
|
+
say 'Set hq layouts'
|
400
|
+
remove_file 'app/views/layouts/hq/application.html.haml', force: true
|
401
|
+
template 'app/views/layouts/hq/application.html.haml.erb', 'app/views/layouts/hq/application.html.haml', force: true
|
402
|
+
remove_file 'app/views/layouts/login.html.haml', force: true
|
403
|
+
template 'app/views/layouts/hq/login.html.haml.erb', 'app/views/layouts/hq/login.html.haml', force: true
|
404
|
+
remove_file 'app/views/layouts/hq/partials/_navbar.haml', force: true
|
405
|
+
template 'app/views/layouts/hq/partials/_navbar.html.haml.erb', 'app/views/layouts/hq/partials/_navbar.html.haml', force: true
|
406
|
+
remove_file 'app/views/layouts/hq/partials/_dock.haml', force: true
|
407
|
+
template 'app/views/layouts/hq/partials/_dock.html.haml.erb', 'app/views/layouts/hq/partials/_dock.html.haml', force: true
|
408
|
+
remove_file 'app/views/layouts/hq/partials/_footer.haml', force: true
|
409
|
+
template 'app/views/layouts/hq/partials/_footer.html.haml.erb', 'app/views/layouts/hq/partials/_footer.html.haml', force: true
|
410
|
+
remove_file 'app/views/layouts/hq/partials/_trackers.haml', force: true
|
411
|
+
template 'app/views/layouts/hq/partials/_trackers.html.haml.erb', 'app/views/layouts/hq/partials/_trackers.html.haml', force: true
|
412
|
+
|
413
|
+
# Mailer layout files
|
414
|
+
template 'app/views/layouts/mailer.html.haml.erb', 'app/views/layouts/mailer.html.haml', force: true
|
415
|
+
copy_file 'app/views/layouts/mailer.text.haml', 'app/views/layouts/mailer.text.haml'
|
416
|
+
|
417
|
+
# Assets files
|
418
|
+
remove_file 'app/assets/javascripts/application.js', force: true
|
419
|
+
remove_file 'app/assets/stylesheets/application.css', force: true
|
420
|
+
|
421
|
+
# Hq assets files
|
422
|
+
remove_file 'app/assets/javascripts/hq/application.js.coffee', force: true
|
423
|
+
remove_file 'app/assets/stylesheets/hq/application.css.sass', force: true
|
424
|
+
copy_file 'app/assets/javascripts/hq/application.js.coffee','app/assets/javascripts/hq/application.js.coffee'
|
425
|
+
copy_file 'app/assets/stylesheets/hq/application.css.sass', 'app/assets/stylesheets/hq/application.css.sass'
|
426
|
+
|
427
|
+
# Partial files in layouts folder
|
428
|
+
remove_file 'app/views/layouts/partials/_footer.haml', force: true
|
429
|
+
template 'app/views/layouts/partials/_footer.html.haml.erb', 'app/views/layouts/partials/_footer.html.haml', force: true
|
430
|
+
remove_file 'app/views/layouts/partials/_trackers.haml', force: true
|
431
|
+
template 'app/views/layouts/partials/_trackers.html.haml.erb', 'app/views/layouts/partials/_trackers.html.haml', force: true
|
432
|
+
template 'app/views/layouts/partials/_warnings.html.haml.erb', 'app/views/layouts/partials/_warnings.html.haml', force: true
|
433
|
+
|
434
|
+
# Root folder files
|
435
|
+
copy_file 'cybele_version.txt', 'VERSION.txt'
|
436
|
+
directory 'public/images', 'public/images'
|
437
|
+
template '.env.local.erb', '.env.local', force: true
|
438
|
+
template '.env.production.erb', '.env.production', force: true
|
439
|
+
template '.env.staging.erb', '.env.staging', force: true
|
440
|
+
template 'env.sample.erb', 'env.sample', force: true
|
441
|
+
|
442
|
+
# Library files
|
443
|
+
directory 'lib/tasks', 'lib/tasks'
|
444
|
+
directory 'lib/data', 'lib/data'
|
445
|
+
|
446
|
+
# Config files
|
447
|
+
copy_file 'config/initializers/sidekiq.rb', 'config/initializers/sidekiq.rb'
|
448
|
+
copy_file 'config/initializers/devise_async.rb', 'config/initializers/devise_async.rb'
|
449
|
+
copy_file 'config/schedule.yml', 'config/schedule.yml'
|
450
|
+
copy_file 'config/sidekiq.yml', 'config/sidekiq.yml'
|
451
|
+
remove_file 'config/settings.local.yml', force: true
|
452
|
+
|
453
|
+
# Mailer files
|
454
|
+
directory 'app/mailers', 'app/mailers'
|
455
|
+
directory 'app/views/admin_mailer', 'app/views/admin_mailer'
|
456
|
+
directory 'app/views/user_mailer', 'app/views/user_mailer'
|
457
|
+
|
458
|
+
# Controllers
|
459
|
+
remove_file 'app/controllers/application_controller.rb', force: true
|
460
|
+
template 'app/controllers/application_controller.rb.erb', 'app/controllers/application_controller.rb', force: true
|
461
|
+
end
|
462
|
+
|
463
|
+
def git_commands
|
464
|
+
git :init
|
465
|
+
end
|
466
|
+
|
467
|
+
def create_location_models
|
468
|
+
generate 'model Country name:string'
|
469
|
+
generate 'model City name:string country:references'
|
470
|
+
generate 'audited:install'
|
471
|
+
end
|
472
|
+
|
473
|
+
def create_jobs_helper_lib
|
474
|
+
create_file "lib/jobs_helper.rb", <<-CODE
|
475
|
+
# Get system admin
|
476
|
+
def system_admin
|
477
|
+
admin = Admin.where(email: "system@#{app_name}.com").first
|
478
|
+
if admin.nil?
|
479
|
+
password = Devise.friendly_token.first(12)
|
480
|
+
admin = Admin.create(name: 'System', surname: 'System', email: "system@#{app_name}.com", password: password, password_confirmation: password)
|
481
|
+
end
|
482
|
+
admin
|
483
|
+
end
|
484
|
+
CODE
|
415
485
|
end
|
416
486
|
|
417
487
|
private
|
418
488
|
|
419
|
-
def action_mailer_host(rails_env
|
420
|
-
|
489
|
+
def action_mailer_host(rails_env)
|
421
490
|
config = <<-RUBY
|
422
491
|
# Mail Setting
|
423
|
-
config.action_mailer.default_url_options = { :
|
492
|
+
config.action_mailer.default_url_options = { host: ENV['ROOT_PATH'] }
|
424
493
|
RUBY
|
425
|
-
|
426
494
|
configure_environment(rails_env, config)
|
427
495
|
end
|
428
496
|
|
429
497
|
def configure_environment(rails_env, config)
|
430
|
-
inject_into_file("config/environments/#{rails_env}.rb", "\n
|
498
|
+
inject_into_file("config/environments/#{rails_env}.rb", "\n #{config}", before: "\nend")
|
431
499
|
end
|
432
500
|
|
433
501
|
def generate_devise_strong_parameters(model_name)
|
434
502
|
create_sanitizer_lib(model_name)
|
435
503
|
create_sanitizer_initializer(model_name)
|
436
|
-
devise_parameter_sanitizer(model_name)
|
437
504
|
end
|
438
505
|
|
439
506
|
def create_sanitizer_lib(model_name)
|
@@ -441,7 +508,7 @@ admin.admin_profile = AdminProfile.create(first_name: 'Admin', last_name: "#{app
|
|
441
508
|
class #{model_name.classify}::ParameterSanitizer < Devise::ParameterSanitizer
|
442
509
|
private
|
443
510
|
def sign_up
|
444
|
-
default_params.permit(:name, :email, :password, :password_confirmation, :time_zone) # TODO add other params here
|
511
|
+
default_params.permit(:name, :surname, :email, :password, :password_confirmation, :time_zone) # TODO add other params here
|
445
512
|
end
|
446
513
|
end
|
447
514
|
CODE
|
@@ -456,80 +523,6 @@ require "#{path}"
|
|
456
523
|
CODE
|
457
524
|
end
|
458
525
|
|
459
|
-
def devise_parameter_sanitizer(model_name)
|
460
|
-
inject_into_file 'app/controllers/application_controller.rb', :after => 'protect_from_forgery with: :exception' do <<-CODE
|
461
|
-
protected
|
462
|
-
def devise_parameter_sanitizer
|
463
|
-
if resource_class == #{model_name.classify}
|
464
|
-
#{model_name.classify}::ParameterSanitizer.new(#{model_name.classify}, :#{model_name.parameterize}, params)
|
465
|
-
else
|
466
|
-
super # Use the default one
|
467
|
-
end
|
468
|
-
end
|
469
|
-
CODE
|
470
|
-
end
|
471
|
-
end
|
472
|
-
|
473
|
-
def create_namespace_routing(namespace)
|
474
|
-
inject_into_file 'config/routes.rb', after: "root to: 'welcome#index'" do <<-CODE
|
475
|
-
|
476
|
-
namespace :#{namespace} do
|
477
|
-
resources :dashboard, only: [:index]
|
478
|
-
end
|
479
|
-
CODE
|
480
|
-
end
|
481
|
-
end
|
482
|
-
|
483
|
-
def add_time_zone_to_user
|
484
|
-
say 'Add time_zone to User model'
|
485
|
-
generate 'migration AddTimeZoneToUser time_zone:string -s'
|
486
|
-
end
|
487
|
-
|
488
|
-
def add_profile_models
|
489
|
-
say 'Creating Profile Models'
|
490
|
-
generate 'model user_profile first_name:string last_name:string gsm:string user:references -s'
|
491
|
-
generate 'model admin_profile first_name:string last_name:string gsm:string admin:references -s'
|
492
|
-
end
|
493
|
-
|
494
|
-
def add_set_user_time_zone_method_to_application_controller
|
495
|
-
say 'Add set_user_time_zone method to application controller'
|
496
|
-
inject_into_file 'app/controllers/application_controller.rb', :after => 'protected' do <<-CODE
|
497
|
-
|
498
|
-
def set_user_time_zone
|
499
|
-
Time.zone = current_user.time_zone if user_signed_in? && current_user.time_zone.present?
|
500
|
-
end
|
501
|
-
CODE
|
502
|
-
end
|
503
|
-
inject_into_file 'app/controllers/application_controller.rb', :after => 'class ApplicationController < ActionController::Base' do <<-CODE
|
504
|
-
|
505
|
-
before_filter :set_user_time_zone
|
506
|
-
respond_to :html, :json
|
507
|
-
|
508
|
-
CODE
|
509
|
-
end
|
510
|
-
end
|
511
|
-
|
512
|
-
def add_profile_controllers
|
513
|
-
copy_file 'app/controllers/hq/admin_profiles_controller.rb', 'app/controllers/hq/admin_profiles_controller.rb'
|
514
|
-
copy_file 'app/controllers/user_profiles_controller.rb', 'app/controllers/user_profiles_controller.rb'
|
515
|
-
end
|
516
|
-
|
517
|
-
def add_profile_views
|
518
|
-
directory 'app/views/hq/admin_profiles', 'app/views/hq/admin_profiles'
|
519
|
-
directory 'app/views/user_profiles', 'app/views/user_profiles'
|
520
|
-
|
521
|
-
inject_into_file 'app/models/user.rb', :after => ":recoverable, :rememberable, :trackable, :validatable\n" do <<-RUBY
|
522
|
-
has_one :user_profile
|
523
|
-
accepts_nested_attributes_for :user_profile
|
524
|
-
RUBY
|
525
|
-
end
|
526
|
-
|
527
|
-
inject_into_file 'app/models/admin.rb', :after => ":recoverable, :rememberable, :trackable, :validatable\n" do <<-RUBY
|
528
|
-
has_one :admin_profile
|
529
|
-
accepts_nested_attributes_for :admin_profile
|
530
|
-
RUBY
|
531
|
-
end
|
532
|
-
end
|
533
526
|
|
534
527
|
end
|
535
528
|
end
|