o2webappizer 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/o2webappizer/app_builder.rb +55 -20
- data/lib/o2webappizer/generators/app_generator.rb +19 -1
- data/lib/o2webappizer/version.rb +1 -1
- data/templates/Gemfile.tt +7 -5
- data/templates/README.md.tt +8 -0
- data/templates/app/controllers/application_controller.rb +5 -0
- data/templates/app/helpers/application_helper.rb.tt +5 -0
- data/templates/app/views/layouts/application.html.erb.tt +1 -1
- data/templates/config/initializers/rails_admin.rb +25 -7
- data/templates/config/initializers/spree.rb +0 -2
- data/templates/db/seeds.rb.tt +12 -0
- data/templates/vendor/assets/javascripts/spree/backend/all.js +1 -0
- data/templates/vendor/assets/stylesheets/spree/backend/all.css +1 -0
- metadata +4 -3
- data/templates/app/helpers/application_helper.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e63a9a6d1063e106eba2b4109466bf804ecb920
|
4
|
+
data.tar.gz: ab4f9328581020c36080f7b7906953e4c247daab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f07ccf99931a8a65373adfeaeb9937a39563197e174e12d985e0a7edef1ccc316b586c09824a056a5ee50e758e44fd3ace2dd7fccf1704a45c4921b4485d8d0
|
7
|
+
data.tar.gz: 33c1766b6d70106de86adce509eb500804605c44a9c44021947525323b5773020a378d980d7674757135612381c133ca573bb404612c826aa7ef71f4783c932f
|
data/README.md
CHANGED
@@ -25,6 +25,10 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
|
|
25
25
|
|
26
26
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
27
27
|
|
28
|
+
## TODO
|
29
|
+
|
30
|
+
* Rspec
|
31
|
+
|
28
32
|
## Contributing
|
29
33
|
|
30
34
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/o2webappizer.
|
@@ -4,10 +4,6 @@ module O2webappizer
|
|
4
4
|
template 'README.md'
|
5
5
|
end
|
6
6
|
|
7
|
-
def gemfile
|
8
|
-
template 'Gemfile'
|
9
|
-
end
|
10
|
-
|
11
7
|
def gitignore
|
12
8
|
template '.gitignore'
|
13
9
|
end
|
@@ -20,7 +16,8 @@ module O2webappizer
|
|
20
16
|
keep_file 'assets/images'
|
21
17
|
directory 'controllers'
|
22
18
|
keep_file 'controllers/concerns'
|
23
|
-
|
19
|
+
template 'helpers/application_helper.rb'
|
20
|
+
copy_file 'helpers/spree/frontend_helper_decorator.rb' if options.solidus?
|
24
21
|
directory 'mailers'
|
25
22
|
directory 'models'
|
26
23
|
keep_file 'models/concerns'
|
@@ -60,14 +57,15 @@ module O2webappizer
|
|
60
57
|
remove_file 'initializers/spree.rb'
|
61
58
|
remove_file 'initializers/devise.rb'
|
62
59
|
end
|
63
|
-
|
60
|
+
directory 'locales'
|
64
61
|
|
65
62
|
inside 'locales' do
|
66
|
-
options.locales.each do |locale|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
gsub_file "
|
63
|
+
options.locales.reject{ |l| l == 'en' }.each do |locale|
|
64
|
+
duplicate_locale locale
|
65
|
+
duplicate_locale locale, 'routes'
|
66
|
+
gsub_file "routes.#{locale}.yml", /page: page/, "page: #{locale}/page"
|
67
|
+
gsub_file "routes.#{locale}.yml", /contact: contact/, "contact: #{locale}/contact"
|
68
|
+
duplicate_locale locale, 'simple_form'
|
71
69
|
end
|
72
70
|
end
|
73
71
|
end
|
@@ -98,19 +96,46 @@ module O2webappizer
|
|
98
96
|
end
|
99
97
|
|
100
98
|
def leftovers
|
101
|
-
#rake 'railties:install:migrations'
|
102
|
-
#rake 'db:create'
|
103
|
-
#rake 'db:migrate' if options.migrate?
|
104
|
-
|
105
99
|
template '.ruby-version'
|
106
100
|
|
107
101
|
after_bundle do
|
108
|
-
|
102
|
+
rake 'railties:install:migrations'
|
103
|
+
if options.migrate?
|
104
|
+
rake 'db:drop' if options.drop?
|
105
|
+
rake 'db:create'
|
106
|
+
rake 'db:migrate'
|
107
|
+
if options.solidus? && options.seed?
|
108
|
+
rake_options=[]
|
109
|
+
rake_options << "AUTO_ACCEPT=1" if options.auto_accept?
|
110
|
+
rake_options << "ADMIN_EMAIL=#{options.admin_email}" if options.admin_email.present?
|
111
|
+
rake_options << "ADMIN_PASSWORD=#{options.admin_password}" if options.admin_password.present?
|
112
|
+
rake "db:seed #{rake_options.join(' ')}"
|
113
|
+
rake "db:data:dump"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
unless options.skip_git?
|
117
|
+
git :init
|
118
|
+
git add: '.'
|
119
|
+
git commit: "-m 'first commit'"
|
120
|
+
git checkout: "-b 'staging'"
|
121
|
+
git checkout: "-b 'vagrant'"
|
122
|
+
git checkout: "-b 'develop'"
|
123
|
+
end
|
124
|
+
if options.solidus? && options.sample?
|
125
|
+
rake 'spree_sample:load' unless Dir["#{destination_root}/public/spree/*"].any?
|
126
|
+
end
|
109
127
|
end
|
110
128
|
end
|
111
129
|
|
112
130
|
private
|
113
131
|
|
132
|
+
def duplicate_locale(locale, name = nil)
|
133
|
+
src_name = name ? "#{name}.en.yml" : "en.yml"
|
134
|
+
dst_name = name ? "#{name}.#{locale}.yml" : "#{locale}.yml"
|
135
|
+
copy_file src_name, dst_name
|
136
|
+
gsub_file dst_name, /^en/, locale
|
137
|
+
end
|
138
|
+
|
114
139
|
def configure_application
|
115
140
|
overrides = if options.solidus?
|
116
141
|
<<-OVERRIDES
|
@@ -129,11 +154,25 @@ module O2webappizer
|
|
129
154
|
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
|
130
155
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
131
156
|
end
|
157
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../lib/**/*_decorator*.rb")) do |c|
|
158
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
159
|
+
end
|
132
160
|
#{overrides}
|
133
161
|
end
|
134
162
|
|
163
|
+
config.time_zone = 'Eastern Time (US & Canada)'
|
164
|
+
|
135
165
|
config.i18n.default_locale = :#{options.locales.first}
|
136
166
|
config.i18n.available_locales = #{options.locales.map(&:to_sym)}
|
167
|
+
|
168
|
+
# config.active_job.queue_adapter = :que
|
169
|
+
config.active_record.schema_format = :sql
|
170
|
+
|
171
|
+
config.action_view.embed_authenticity_token_in_remote_forms = true
|
172
|
+
|
173
|
+
config.assets.paths << Rails.root.join("app", "assets", "fonts")
|
174
|
+
config.assets.paths << Rails.root.join("vendor", "assets", "fonts")
|
175
|
+
config.assets.precompile += %w( .svg .eot .woff .ttf)
|
137
176
|
APP
|
138
177
|
end
|
139
178
|
|
@@ -157,10 +196,6 @@ module O2webappizer
|
|
157
196
|
configure_env 'vagrant', 'info'
|
158
197
|
end
|
159
198
|
|
160
|
-
def init_git
|
161
|
-
git :init
|
162
|
-
end
|
163
|
-
|
164
199
|
def configure_env(name, level)
|
165
200
|
environment(<<-DEV.strip_heredoc.indent(2), env: name)
|
166
201
|
|
@@ -15,7 +15,7 @@ module O2webappizer
|
|
15
15
|
class_option :force, type: :boolean, aliases: "-f", default: true,
|
16
16
|
desc: "Overwrite files that already exist"
|
17
17
|
|
18
|
-
class_option :solidus, type: :boolean, default:
|
18
|
+
class_option :solidus, type: :boolean, default: true,
|
19
19
|
desc: "Install Solidus as well"
|
20
20
|
|
21
21
|
class_option :locales, type: :array, default: ['fr', 'en'],
|
@@ -24,6 +24,24 @@ module O2webappizer
|
|
24
24
|
class_option :migrate, type: :boolean, default: true,
|
25
25
|
desc: 'Run migrations'
|
26
26
|
|
27
|
+
class_option :seed, type: :boolean, default: true,
|
28
|
+
desc: 'load seed data (migrations must be run)'
|
29
|
+
|
30
|
+
class_option :sample, type: :boolean, default: true,
|
31
|
+
desc: 'load sample data (migrations must be run)'
|
32
|
+
|
33
|
+
class_option :drop, type: :boolean, default: false,
|
34
|
+
desc: 'Drop current table before migration'
|
35
|
+
|
36
|
+
class_option :auto_accept, type: :boolean, default: true,
|
37
|
+
desc: 'Auto-accept prompts'
|
38
|
+
|
39
|
+
class_option :admin_email, type: :string,
|
40
|
+
desc: 'Admin email'
|
41
|
+
|
42
|
+
class_option :admin_password, type: :string,
|
43
|
+
desc: 'Admin password'
|
44
|
+
|
27
45
|
class_option :ruby_version, type: :string, default: '2.2.3',
|
28
46
|
desc: 'Set Ruby version used'
|
29
47
|
|
data/lib/o2webappizer/version.rb
CHANGED
data/templates/Gemfile.tt
CHANGED
@@ -89,13 +89,15 @@ gem 'lazyload-rails', github: 'jassa/lazyload-rails'
|
|
89
89
|
gem 'browser', github: 'fnando/browser'
|
90
90
|
|
91
91
|
# Rails Admin
|
92
|
-
gem 'rails_admin_cms'
|
93
|
-
gem 'rich', github: 'o2web/rich'
|
92
|
+
gem 'rails_admin_cms', github: 'o2web/rails_admin_cms', branch: 'master'
|
93
|
+
gem 'rich', github: 'o2web/rich', branch: 'master'
|
94
|
+
gem 'rails_admin', github: 'o2web/rails_admin', branch: 'master'
|
94
95
|
gem 'rails_admin_jcrop', github: 'o2web/rails_admin_jcrop', branch: 'feature/one_crop_per_page'
|
95
|
-
# gem 'rails_admin_history_rollback', github: 'rikkipitt/rails_admin_history_rollback'
|
96
96
|
|
97
97
|
<% if options.solidus? -%>
|
98
98
|
# Solidus
|
99
|
-
gem 'solidus', github: 'o2web/solidus', branch: '
|
100
|
-
gem 'solidus_auth_devise'
|
99
|
+
gem 'solidus', github: 'o2web/solidus', branch: 'master'
|
100
|
+
gem 'solidus_auth_devise', github: 'solidusio/solidus_auth_devise', branch: 'master'
|
101
|
+
gem 'solidus_i18n', github: 'o2web/solidus_i18n', branch: 'master'
|
102
|
+
gem 'solidus_globalize', github: 'o2web/solidus_globalize', branch: 'master'
|
101
103
|
<% end -%>
|
data/templates/README.md.tt
CHANGED
@@ -31,3 +31,11 @@ rake db:reborn
|
|
31
31
|
```
|
32
32
|
|
33
33
|
and then, you're good to go by launching your runner/debugger in Rubymine or by running `rails s` and accessing localhost:3000
|
34
|
+
|
35
|
+
<% if options.solidus? -%>
|
36
|
+
## Default Admin User Credentials
|
37
|
+
|
38
|
+
admin@example.com
|
39
|
+
|
40
|
+
test123
|
41
|
+
<% end -%>
|
@@ -1,12 +1,21 @@
|
|
1
1
|
RailsAdmin.config do |config|
|
2
|
-
|
2
|
+
config.main_app_name = ["Dashboard", ""]
|
3
|
+
|
3
4
|
config.browser_validations = false
|
4
5
|
|
6
|
+
config.compact_show_view = false
|
7
|
+
|
8
|
+
### Popular gems integration
|
9
|
+
|
5
10
|
## == Devise ==
|
6
11
|
# config.authenticate_with do
|
7
12
|
# warden.authenticate! scope: :user
|
8
13
|
# end
|
9
|
-
|
14
|
+
config.current_user_method(&:current_admin)
|
15
|
+
|
16
|
+
config.authorize_with do
|
17
|
+
redirect_to '/' unless current_admin?
|
18
|
+
end
|
10
19
|
|
11
20
|
## == Cancan ==
|
12
21
|
# config.authorize_with :cancan
|
@@ -15,19 +24,28 @@ RailsAdmin.config do |config|
|
|
15
24
|
# config.authorize_with :pundit
|
16
25
|
|
17
26
|
## == PaperTrail ==
|
18
|
-
|
27
|
+
if 'Spree::User'.safe_constantize # TODO: move to Solidus connector
|
28
|
+
config.audit_with :paper_trail, 'Spree::User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
|
29
|
+
else
|
30
|
+
config.audit_with :paper_trail, 'BlackHole', 'PaperTrail::Version'
|
31
|
+
end
|
19
32
|
|
20
33
|
### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
|
21
34
|
|
35
|
+
config.included_models = Naming::Viewable.models + Naming::Form.models + %w[
|
36
|
+
UniqueKey
|
37
|
+
Setting
|
38
|
+
Rich::RichFile
|
39
|
+
]
|
40
|
+
|
22
41
|
config.actions do
|
23
42
|
dashboard # mandatory
|
24
43
|
index # mandatory
|
25
44
|
new do
|
26
|
-
except Naming::Viewable.models + Naming::Form.
|
45
|
+
except Naming::Viewable.models + Naming::Form.models + %w[
|
27
46
|
UniqueKey
|
28
47
|
Setting
|
29
48
|
Rich::RichFile
|
30
|
-
Form::Row
|
31
49
|
]
|
32
50
|
end
|
33
51
|
export do
|
@@ -60,8 +78,8 @@ RailsAdmin.config do |config|
|
|
60
78
|
show_in_app
|
61
79
|
|
62
80
|
## With an audit adapter, you can add:
|
63
|
-
|
64
|
-
|
81
|
+
history_index
|
82
|
+
history_show
|
65
83
|
end
|
66
84
|
|
67
85
|
config.model 'Rich::RichFile' do
|
@@ -51,5 +51,3 @@ Spree.config do |config|
|
|
51
51
|
end
|
52
52
|
|
53
53
|
Spree.user_class = "Spree::User" # "Spree::LegacyUser"
|
54
|
-
# SpreeI18n::Config.available_locales = I18n.available_locales # displayed on translation forms
|
55
|
-
# SpreeGlobalize::Config.supported_locales = I18n.available_locales # displayed on frontend select box
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
8
|
+
|
9
|
+
<% if options.solidus? -%>
|
10
|
+
Spree::Core::Engine.load_seed if defined?(Spree::Core) && !Spree::Country.any?
|
11
|
+
Spree::Auth::Engine.load_seed if defined?(Spree::Auth) && !Spree::User.any?
|
12
|
+
<% end -%>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: o2webappizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrice Lebel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -95,7 +95,7 @@ files:
|
|
95
95
|
- templates/app/assets/stylesheets/application.sass
|
96
96
|
- templates/app/controllers/application_controller.rb
|
97
97
|
- templates/app/controllers/cms/authenticate.rb.tt
|
98
|
-
- templates/app/helpers/application_helper.rb
|
98
|
+
- templates/app/helpers/application_helper.rb.tt
|
99
99
|
- templates/app/helpers/spree/frontend_helper_decorator.rb
|
100
100
|
- templates/app/mailers/application_mailer.rb
|
101
101
|
- templates/app/models/form/contact.rb
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- templates/config/locales/simple_form.en.yml
|
127
127
|
- templates/config/routes.rb.tt
|
128
128
|
- templates/config/secrets.yml.tt
|
129
|
+
- templates/db/seeds.rb.tt
|
129
130
|
- templates/public/404.html
|
130
131
|
- templates/public/422.html
|
131
132
|
- templates/public/500.html
|