o2webappizer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +4 -9
- data/bin/o2webappizer +1 -1
- data/lib/o2webappizer.rb +1 -0
- data/lib/o2webappizer/app_builder.rb +167 -0
- data/lib/o2webappizer/generators/app_generator.rb +29 -0
- data/lib/o2webappizer/version.rb +1 -1
- data/templates/{dot_gitignore → .gitignore.tt} +4 -5
- data/templates/.ruby-version.tt +1 -0
- data/templates/Gemfile.tt +101 -0
- data/templates/README.md.tt +33 -0
- data/templates/app/assets/javascripts/app.js.coffee +7 -0
- data/templates/app/assets/javascripts/application.js.coffee +27 -0
- data/templates/app/assets/stylesheets/application.sass +20 -0
- data/templates/app/controllers/application_controller.rb +9 -0
- data/templates/app/controllers/cms/authenticate.rb.tt +38 -0
- data/templates/app/helpers/application_helper.rb +2 -0
- data/templates/app/helpers/spree/frontend_helper_decorator.rb +12 -0
- data/templates/app/mailers/application_mailer.rb +3 -0
- data/templates/app/views/layouts/application.html.erb.tt +27 -0
- data/templates/app/views/layouts/mailer.html.erb +1 -0
- data/templates/app/views/layouts/mailer.text.erb +1 -0
- data/templates/app/views/spree/layouts/spree_application.html.erb +37 -0
- data/templates/app/views/spree/shared/_head.html.erb +14 -0
- data/templates/app/views/spree/shared/_main_nav_bar.html.erb +18 -0
- data/templates/config/database.yml.tt +99 -0
- data/templates/config/initializers/assets.rb.tt +19 -0
- data/templates/config/initializers/devise.rb.tt +1 -0
- data/templates/config/initializers/lazyload.rb +3 -0
- data/templates/config/initializers/rails_admin.rb +101 -0
- data/templates/config/initializers/rails_admin_cms.rb +17 -0
- data/templates/config/initializers/rich.rb +142 -0
- data/templates/config/initializers/simple_form.rb +165 -0
- data/templates/config/initializers/simple_form_bootstrap.rb +149 -0
- data/templates/config/initializers/spree.rb +55 -0
- data/templates/config/locales/en.yml +7 -0
- data/templates/config/locales/routes.en.yml +3 -0
- data/templates/config/locales/simple_form.en.yml +31 -0
- data/templates/config/routes.rb.tt +68 -0
- data/templates/config/secrets.yml.tt +28 -0
- data/templates/public/404.html +67 -0
- data/templates/public/422.html +67 -0
- data/templates/public/500.html +66 -0
- data/templates/public/favicon.ico +0 -0
- data/templates/public/images/full/missing.png +0 -0
- data/templates/public/images/huge/missing.png +0 -0
- data/templates/public/images/large/missing.png +0 -0
- data/templates/public/images/loading.gif +0 -0
- data/templates/public/images/medium/missing.png +0 -0
- data/templates/public/images/mini/missing.png +0 -0
- data/templates/public/images/original/missing.png +0 -0
- data/templates/public/images/rich_thumb/missing.png +0 -0
- data/templates/public/images/small/missing.png +0 -0
- data/templates/public/images/thumb/missing.png +0 -0
- data/templates/public/robots.txt.tt +15 -0
- data/templates/vendor/assets/javascripts/jquery.lazyload.js +242 -0
- data/templates/vendor/assets/javascripts/modernizr.js +3 -0
- data/templates/vendor/assets/javascripts/spree/backend/all.js +11 -0
- data/templates/vendor/assets/javascripts/spree/frontend/all.js +13 -0
- data/templates/vendor/assets/stylesheets/nprogress-variables.sass +3 -0
- data/templates/vendor/assets/stylesheets/spree/backend/all.css +10 -0
- data/templates/vendor/assets/stylesheets/spree/frontend/all.css +12 -0
- metadata +58 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca0c4bac732b530dbc866e3f7cdd7e2e0f977019
|
4
|
+
data.tar.gz: 54d84655ceaea893416c6df3aa9d0b62d5f228d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bc2c7b72e7549239c9d2dd93330f062ed0d53c933676ce208baca0bcf3d5dcf5e6f41872e55e6ebb5892b34de683d6aa9a278cc211584131fd3a1c148d43470
|
7
|
+
data.tar.gz: ee0177bde7ed9013d4cccba81d1569e9738f6730e8dfb0224428b89cb662ec5f96817bb0d77b0cca3e146a4b3b17ff978d2a240912cd59252271ee443d8661bb
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -6,19 +6,14 @@ TODO: Delete this and the text above, and describe your gem
|
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
|
9
|
+
Install the gem:
|
10
10
|
|
11
|
-
|
12
|
-
gem 'o2webappizer'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
11
|
+
$ gem install o2webappizer
|
16
12
|
|
17
|
-
|
13
|
+
To output the current gem version:
|
18
14
|
|
19
|
-
|
15
|
+
$ o2webappizer -v
|
20
16
|
|
21
|
-
$ gem install o2webappizer
|
22
17
|
|
23
18
|
## Usage
|
24
19
|
|
data/bin/o2webappizer
CHANGED
@@ -13,6 +13,6 @@ end
|
|
13
13
|
|
14
14
|
templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
|
15
15
|
O2webappizer::AppGenerator.source_root templates_root
|
16
|
-
O2webappizer::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root
|
16
|
+
O2webappizer::AppGenerator.source_paths << templates_root << Rails::Generators::AppGenerator.source_root
|
17
17
|
|
18
18
|
O2webappizer::AppGenerator.start
|
data/lib/o2webappizer.rb
CHANGED
@@ -1,4 +1,171 @@
|
|
1
1
|
module O2webappizer
|
2
2
|
class AppBuilder < Rails::AppBuilder
|
3
|
+
def readme
|
4
|
+
template 'README.md'
|
5
|
+
end
|
6
|
+
|
7
|
+
def gemfile
|
8
|
+
template 'Gemfile'
|
9
|
+
end
|
10
|
+
|
11
|
+
def gitignore
|
12
|
+
template '.gitignore'
|
13
|
+
end
|
14
|
+
|
15
|
+
def app
|
16
|
+
empty_directory 'app'
|
17
|
+
|
18
|
+
inside 'app' do
|
19
|
+
directory 'assets'
|
20
|
+
keep_file 'assets/images'
|
21
|
+
directory 'controllers'
|
22
|
+
keep_file 'controllers/concerns'
|
23
|
+
directory 'helpers'
|
24
|
+
directory 'mailers'
|
25
|
+
keep_file 'models/concerns'
|
26
|
+
keep_file 'overrides' if options.solidus?
|
27
|
+
empty_directory 'views'
|
28
|
+
|
29
|
+
inside 'views' do
|
30
|
+
directory 'layouts'
|
31
|
+
directory 'spree' if options.solidus?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def config
|
37
|
+
empty_directory 'config'
|
38
|
+
|
39
|
+
inside 'config' do
|
40
|
+
template 'routes.rb'
|
41
|
+
template 'application.rb'
|
42
|
+
configure_application
|
43
|
+
template 'database.yml'
|
44
|
+
template 'environment.rb'
|
45
|
+
template 'secrets.yml'
|
46
|
+
directory 'environments'
|
47
|
+
|
48
|
+
inside 'environments' do
|
49
|
+
configure_development
|
50
|
+
configure_production
|
51
|
+
template 'production.rb', 'staging.rb'
|
52
|
+
template 'production.rb', 'vagrant.rb'
|
53
|
+
configure_staging
|
54
|
+
configure_vagrant
|
55
|
+
end
|
56
|
+
directory 'initializers'
|
57
|
+
unless options.solidus?
|
58
|
+
remove_file 'initializers/spree.rb'
|
59
|
+
remove_file 'initializers/devise.rb'
|
60
|
+
end
|
61
|
+
empty_directory 'locales'
|
62
|
+
|
63
|
+
inside 'locales' do
|
64
|
+
options.locales.each do |locale|
|
65
|
+
copy_file 'routes.en.yml', "routes.#{locale}.yml"
|
66
|
+
gsub_file "routes.#{locale}.yml", /^en/, locale
|
67
|
+
copy_file 'simple_form.en.yml', "simple_form.#{locale}.yml"
|
68
|
+
gsub_file "simple_form.#{locale}.yml", /^en/, locale
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def database_yml
|
75
|
+
end
|
76
|
+
|
77
|
+
def public_directory
|
78
|
+
directory 'public'
|
79
|
+
end
|
80
|
+
|
81
|
+
def vendor
|
82
|
+
empty_directory 'vendor/assets'
|
83
|
+
|
84
|
+
inside 'vendor/assets' do
|
85
|
+
copy_file 'javascripts/jquery.lazyload.js'
|
86
|
+
copy_file 'javascripts/modernizr.js'
|
87
|
+
copy_file 'stylesheets/nprogress-variables.sass'
|
88
|
+
if options.solidus?
|
89
|
+
directory 'javascripts/spree'
|
90
|
+
directory 'stylesheets/spree'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def leftovers
|
96
|
+
#rake 'railties:install:migrations'
|
97
|
+
#rake 'db:create'
|
98
|
+
#rake 'db:migrate' if options.migrate?
|
99
|
+
|
100
|
+
template '.ruby-version'
|
101
|
+
|
102
|
+
after_bundle do
|
103
|
+
init_git unless options.skip_git?
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
def configure_application
|
110
|
+
overrides = if options.solidus?
|
111
|
+
<<-OVERRIDES
|
112
|
+
|
113
|
+
# Load application's view overrides
|
114
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
|
115
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
116
|
+
end
|
117
|
+
OVERRIDES
|
118
|
+
end
|
119
|
+
|
120
|
+
application <<-APP.strip_heredoc.indent(4)
|
121
|
+
|
122
|
+
config.to_prepare do
|
123
|
+
# Load application's model / class decorators
|
124
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
|
125
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
126
|
+
end
|
127
|
+
#{overrides}
|
128
|
+
end
|
129
|
+
|
130
|
+
config.i18n.default_locale = :#{options.locales.first}
|
131
|
+
config.i18n.available_locales = #{options.locales.map(&:to_sym)}
|
132
|
+
APP
|
133
|
+
end
|
134
|
+
|
135
|
+
def configure_development
|
136
|
+
environment(<<-DEV.strip_heredoc.indent(2), env: 'development')
|
137
|
+
|
138
|
+
config.action_controller.asset_host = 'http://localhost:3000'
|
139
|
+
config.action_mailer.asset_host = 'http://localhost:3000'
|
140
|
+
DEV
|
141
|
+
end
|
142
|
+
|
143
|
+
def configure_production
|
144
|
+
configure_env 'production', 'error'
|
145
|
+
end
|
146
|
+
|
147
|
+
def configure_staging
|
148
|
+
configure_env 'staging', 'info'
|
149
|
+
end
|
150
|
+
|
151
|
+
def configure_vagrant
|
152
|
+
configure_env 'vagrant', 'info'
|
153
|
+
end
|
154
|
+
|
155
|
+
def init_git
|
156
|
+
git :init
|
157
|
+
end
|
158
|
+
|
159
|
+
def configure_env(name, level)
|
160
|
+
environment(<<-DEV.strip_heredoc.indent(2), env: name)
|
161
|
+
|
162
|
+
# config.action_controller.asset_host = 'http://todo.todo'
|
163
|
+
# config.action_mailer.asset_host = 'http://todo.todo'
|
164
|
+
DEV
|
165
|
+
gsub_file "#{name}.rb", /# config.action_dispatch.+NGINX/,
|
166
|
+
"config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX"
|
167
|
+
gsub_file "#{name}.rb", /config.log_level = :debug/,
|
168
|
+
"config.log_level = :#{level}"
|
169
|
+
end
|
3
170
|
end
|
4
171
|
end
|
@@ -3,5 +3,34 @@ require 'rails/generators/rails/app/app_generator'
|
|
3
3
|
|
4
4
|
module O2webappizer
|
5
5
|
class AppGenerator < Rails::Generators::AppGenerator
|
6
|
+
class_option :database, type: :string, aliases: "-d", default: "postgresql",
|
7
|
+
desc: "Configure for selected database (options: #{DATABASES.join("/")})"
|
8
|
+
|
9
|
+
class_option :skip_bundle, type: :boolean, aliases: "-B", default: false,
|
10
|
+
desc: "Don't run bundle install"
|
11
|
+
|
12
|
+
class_option :skip_test_unit, type: :boolean, aliases: "-T", default: true,
|
13
|
+
desc: "Skip Test::Unit files"
|
14
|
+
|
15
|
+
class_option :force, type: :boolean, aliases: "-f", default: true,
|
16
|
+
desc: "Overwrite files that already exist"
|
17
|
+
|
18
|
+
class_option :solidus, type: :boolean, default: false,
|
19
|
+
desc: "Install Solidus as well"
|
20
|
+
|
21
|
+
class_option :locales, type: :array, default: ['fr', 'en'],
|
22
|
+
desc: "Available locales (default locale comes first)"
|
23
|
+
|
24
|
+
class_option :migrate, type: :boolean, default: true,
|
25
|
+
desc: 'Run migrations'
|
26
|
+
|
27
|
+
class_option :ruby_version, type: :string, default: '2.2.3',
|
28
|
+
desc: 'Set Ruby version used'
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def get_builder_class
|
33
|
+
O2webappizer::AppBuilder
|
34
|
+
end
|
6
35
|
end
|
7
36
|
end
|
data/lib/o2webappizer/version.rb
CHANGED
@@ -18,7 +18,9 @@
|
|
18
18
|
/tmp
|
19
19
|
|
20
20
|
/public/assets/*
|
21
|
+
<% if options.solidus? -%>
|
21
22
|
/public/spree/*
|
23
|
+
<% end -%>
|
22
24
|
/public/system/*
|
23
25
|
/public/images/*
|
24
26
|
!/public/images/mini
|
@@ -29,14 +31,11 @@
|
|
29
31
|
!/public/images/full
|
30
32
|
!/public/images/huge
|
31
33
|
!/public/images/original
|
34
|
+
!/public/images/rich_thumb
|
32
35
|
!/public/images/loading.gif
|
33
36
|
/private/*
|
34
37
|
|
35
|
-
#
|
36
|
-
uploads/*
|
37
|
-
cache/pictures/*
|
38
|
-
|
39
|
-
#default stuff
|
38
|
+
# Default stuff
|
40
39
|
.DS_Store
|
41
40
|
.sass-cache
|
42
41
|
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= options.ruby_version %>
|
@@ -0,0 +1,101 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
|
4
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
5
|
+
gem 'rails', github: 'rails/rails', branch: '4-2-stable'
|
6
|
+
# Use postgresql as the database for Active Record
|
7
|
+
gem 'pg', '~> 0.15'
|
8
|
+
# Use SCSS for stylesheets
|
9
|
+
gem 'sassc-rails', github: 'Shopify/sassc-rails', branch: 'sprockets-rails-3'
|
10
|
+
# Use Uglifier as compressor for JavaScript assets
|
11
|
+
gem 'uglifier', '>= 1.3.0'
|
12
|
+
# Use CoffeeScript for .coffee assets and views
|
13
|
+
gem 'coffee-rails', '~> 4.1.0'
|
14
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
15
|
+
# gem 'therubyracer', platforms: :ruby
|
16
|
+
|
17
|
+
# Use jquery as the JavaScript library
|
18
|
+
gem 'jquery-rails'
|
19
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
20
|
+
gem 'turbolinks'
|
21
|
+
gem 'jquery-turbolinks'
|
22
|
+
gem 'nprogress-rails', github: 'caarlos0/nprogress-rails'
|
23
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
24
|
+
gem 'jbuilder', '~> 2.0'
|
25
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
26
|
+
gem 'sdoc', '~> 0.4.0', group: :doc
|
27
|
+
|
28
|
+
group :development, :test do
|
29
|
+
gem 'capistrano', '~> 3.1'
|
30
|
+
gem 'capistrano-bundler', '~> 1.1'
|
31
|
+
gem 'capistrano-rails', '~> 1.1'
|
32
|
+
gem 'capistrano-rbenv', '~> 2.0'
|
33
|
+
gem 'capistrano3-nginx', '~> 2.0'
|
34
|
+
gem 'capistrano-passenger'
|
35
|
+
# TODO: gem 'capistrano-maintenance', '~> 1.0'
|
36
|
+
|
37
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
38
|
+
gem 'spring', '~> 1.3.6'
|
39
|
+
|
40
|
+
# gem 'web-console', '~> 3.0'
|
41
|
+
gem 'xray-rails'
|
42
|
+
gem 'quiet_assets'
|
43
|
+
gem 'coffee-rails-source-paths', github: 'Machiaweliczny/coffee-rails-source-paths'
|
44
|
+
gem 'sass-rails-source-maps', github: 'inopinatus/sass-rails-source-maps'
|
45
|
+
<% unless options.solidus? -%>
|
46
|
+
gem 'letter_opener'
|
47
|
+
gem 'letter_opener_web', '~> 1.2.0'
|
48
|
+
<% end -%>
|
49
|
+
end
|
50
|
+
|
51
|
+
# Scheduling
|
52
|
+
gem 'whenever', require: false
|
53
|
+
# gem 'que'
|
54
|
+
|
55
|
+
# Database
|
56
|
+
gem 'yaml_db'
|
57
|
+
# gem 'goldiloader'
|
58
|
+
# gem 'paper_trail', github: 'airblade/paper_trail'
|
59
|
+
# gem 'paranoia', '~> 2.0'
|
60
|
+
# gem 'globalize', '~> 5.0.0'
|
61
|
+
|
62
|
+
# Routes
|
63
|
+
# gem 'friendly_id', '~> 5.1.0'
|
64
|
+
# gem 'friendly_id-globalize', '~> 1.0.0'
|
65
|
+
# gem 'redirector'
|
66
|
+
|
67
|
+
# Search
|
68
|
+
# gem 'ransack'
|
69
|
+
# gem 'textacular', '~> 3.0'
|
70
|
+
|
71
|
+
# Views
|
72
|
+
gem 'nestive', '~> 0.5'
|
73
|
+
# gem 'local_time'
|
74
|
+
|
75
|
+
# Forms
|
76
|
+
# gem 'cocoon'
|
77
|
+
# gem 'best_in_place', github: 'bernat/best_in_place'
|
78
|
+
|
79
|
+
# Tables
|
80
|
+
# gem 'wice_grid', github: 'leikind/wice_grid', branch: 'rails3'
|
81
|
+
# gem 'spreadsheet'
|
82
|
+
|
83
|
+
# CSS
|
84
|
+
gem 'autoprefixer-rails'
|
85
|
+
gem 'font-awesome-sass', github: 'schurig/font-awesome-sass', branch: 'patch-1'
|
86
|
+
|
87
|
+
# Images
|
88
|
+
gem 'lazyload-rails', github: 'jassa/lazyload-rails'
|
89
|
+
gem 'browser', github: 'fnando/browser'
|
90
|
+
|
91
|
+
# Rails Admin
|
92
|
+
gem 'rails_admin_cms'
|
93
|
+
gem 'rich', github: 'o2web/rich'
|
94
|
+
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
|
+
|
97
|
+
<% if options.solidus? -%>
|
98
|
+
# Solidus
|
99
|
+
gem 'solidus', github: 'o2web/solidus', branch: 'v1.1'
|
100
|
+
gem 'solidus_auth_devise'
|
101
|
+
<% end -%>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# <%= app_name.humanize %>
|
2
|
+
|
3
|
+
## Local setup, make sure that these librairies are installed with:
|
4
|
+
|
5
|
+
```console
|
6
|
+
brew install autoconf gdbm libpng ossp-uuid autoenv gettext libtool pcre readline automake git libyaml redis
|
7
|
+
```
|
8
|
+
|
9
|
+
```console
|
10
|
+
brew install brew-cask glib mcrypt icu4c sqlite imagemagick mhash ssh-copy-id jpeg unixodbc lftp node
|
11
|
+
```
|
12
|
+
|
13
|
+
```console
|
14
|
+
brew install pkg-config wget freetype libffi openssl postgresql zlib
|
15
|
+
```
|
16
|
+
|
17
|
+
### Install Ruby with Rbenv and Ruby-build (with the git clone way)
|
18
|
+
|
19
|
+
### Install Bundler and run an install
|
20
|
+
|
21
|
+
### Create a PostgresSQL user 'postgres' with 'postgres' password if not already done, then run:
|
22
|
+
|
23
|
+
```console
|
24
|
+
rake db:drop db:create db:migrate db:data:load
|
25
|
+
```
|
26
|
+
|
27
|
+
or
|
28
|
+
|
29
|
+
```console
|
30
|
+
rake db:reborn
|
31
|
+
```
|
32
|
+
|
33
|
+
and then, you're good to go by launching your runner/debugger in Rubymine or by running `rails s` and accessing localhost:3000
|