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
@@ -0,0 +1,27 @@
|
|
1
|
+
# This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
# listed below.
|
3
|
+
#
|
4
|
+
# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
# or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
#
|
7
|
+
# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
# compiled file.
|
9
|
+
#
|
10
|
+
# Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
# about supported directives.
|
12
|
+
#
|
13
|
+
#= require jquery
|
14
|
+
#= require jquery_ujs
|
15
|
+
#= require jquery.turbolinks
|
16
|
+
#= require jquery.lazyload
|
17
|
+
#= require nprogress
|
18
|
+
#= require nprogress-turbolinks
|
19
|
+
#= require modernizr
|
20
|
+
|
21
|
+
#= require rails_admin_cms/all
|
22
|
+
|
23
|
+
#= require_tree .
|
24
|
+
|
25
|
+
#= require turbolinks
|
26
|
+
|
27
|
+
App.start()
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
@import "font-awesome-sprockets"
|
16
|
+
@import "font-awesome"
|
17
|
+
@import "nprogress-variables"
|
18
|
+
@import "nprogress"
|
19
|
+
|
20
|
+
@import "rails_admin_cms/all"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class ApplicationController < ActionController::Base
|
2
|
+
# Prevent CSRF attacks by raising an exception.
|
3
|
+
# For APIs, you may want to use :null_session instead.
|
4
|
+
protect_from_forgery with: :exception
|
5
|
+
|
6
|
+
include CMS::Localize
|
7
|
+
include CMS::Editing
|
8
|
+
include CMS::Authenticate
|
9
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module CMS
|
2
|
+
module Authenticate
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
http_basic_authenticate_with name: '<%= app_name %>', password: '<%= SecureRandom.hex %>' if Rails.env.staging?
|
7
|
+
|
8
|
+
helper_method :current_user, :current_user?, :current_admin, :current_admin?
|
9
|
+
end
|
10
|
+
|
11
|
+
def current_user
|
12
|
+
<% if options.solidus? -%>
|
13
|
+
@current_user ||= spree_current_user
|
14
|
+
<% else -%>
|
15
|
+
# TODO: override or rewrite
|
16
|
+
@current_user ||= Struct.new(:admin?).new(true)
|
17
|
+
<% end -%>
|
18
|
+
end
|
19
|
+
|
20
|
+
def current_user?
|
21
|
+
return @is_current_user if defined? @is_current_user
|
22
|
+
@is_current_user = !!current_user
|
23
|
+
end
|
24
|
+
|
25
|
+
def current_admin
|
26
|
+
current_user if current_admin?
|
27
|
+
end
|
28
|
+
|
29
|
+
def current_admin?
|
30
|
+
return @is_current_admin if defined? @is_current_admin
|
31
|
+
@is_current_admin = !!current_user.try(:admin?)
|
32
|
+
end
|
33
|
+
|
34
|
+
def authenticate_admin_user!
|
35
|
+
raise SecurityError unless current_admin?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Spree
|
2
|
+
module FrontendHelper
|
3
|
+
def flash_messages(opts = {})
|
4
|
+
# it turns out that Spree helper is loaded later in the process,
|
5
|
+
# so BootstrapFlashMessages::Helpers.flash_messages is overridden
|
6
|
+
if flash.key? 'order_completed'
|
7
|
+
flash.delete('order_completed')
|
8
|
+
end
|
9
|
+
super
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<!--[if lt IE 7 ]> <html class="ie ie6" lang="<%= I18n.locale %>"> <![endif]-->
|
3
|
+
<!--[if IE 7 ]> <html class="ie ie7" lang="<%= I18n.locale %>"> <![endif]-->
|
4
|
+
<!--[if IE 8 ]> <html class="ie ie8" lang="<%= I18n.locale %>"> <![endif]-->
|
5
|
+
<!--[if IE 9 ]> <html class="ie ie9" lang="<%= I18n.locale %>"> <![endif]-->
|
6
|
+
<!--[if gt IE 9]><!--><html lang="<%%= I18n.locale %%>"><!--<![endif]-->
|
7
|
+
<head>
|
8
|
+
<title><%%= cms_title '<%= camelized %>' %%></title>
|
9
|
+
<%%= cms_meta_data_tags %%>
|
10
|
+
<%%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %%>
|
11
|
+
<%%= javascript_include_tag 'application', 'data-turbolinks-track' => true %%>
|
12
|
+
<%%= csrf_meta_tags %%>
|
13
|
+
</head>
|
14
|
+
<body class="<%%= cms_body_class %%>">
|
15
|
+
|
16
|
+
<%%= cms_flash_messages %%>
|
17
|
+
<div>
|
18
|
+
<%%= cms_locale_selector %%>
|
19
|
+
</div>
|
20
|
+
<div>
|
21
|
+
<%%= cms_link_to_edit_mode %%>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<%%= yield %%>
|
25
|
+
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--[if lt IE 7 ]> <html class="ie ie6" lang="<%= I18n.locale %>"> <![endif]-->
|
3
|
+
<!--[if IE 7 ]> <html class="ie ie7" lang="<%= I18n.locale %>"> <![endif]-->
|
4
|
+
<!--[if IE 8 ]> <html class="ie ie8" lang="<%= I18n.locale %>"> <![endif]-->
|
5
|
+
<!--[if IE 9 ]> <html class="ie ie9" lang="<%= I18n.locale %>"> <![endif]-->
|
6
|
+
<!--[if gt IE 9]><!--><html lang="<%= I18n.locale %>"><!--<![endif]-->
|
7
|
+
<head data-hook="inside_head">
|
8
|
+
<%= render :partial => 'spree/shared/head' %>
|
9
|
+
</head>
|
10
|
+
<body class="<%= cms_body_class(body_class) %>" id="<%= @body_id || 'default' %>" data-hook="body">
|
11
|
+
|
12
|
+
<div class="container">
|
13
|
+
|
14
|
+
<%= render :partial => 'spree/shared/header' %>
|
15
|
+
|
16
|
+
<div id="wrapper" class="row" data-hook>
|
17
|
+
|
18
|
+
<%= breadcrumbs(@taxon) %>
|
19
|
+
|
20
|
+
<%= render :partial => 'spree/shared/sidebar' if content_for? :sidebar %>
|
21
|
+
|
22
|
+
<div id="content" class="columns <%= !content_for?(:sidebar) ? "sixteen" : "twelve omega" %>" data-hook>
|
23
|
+
<%= cms_flash_messages %>
|
24
|
+
<%= yield %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<%= yield :templates %>
|
28
|
+
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<%= render :partial => 'spree/shared/footer' %>
|
32
|
+
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<%= render :partial => 'spree/shared/google_analytics' %>
|
36
|
+
</body>
|
37
|
+
</html>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<meta charset="utf-8">
|
2
|
+
<title><%= cms_title(title) %></title>
|
3
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
4
|
+
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1" name="viewport">
|
5
|
+
<%== cms_meta_data_tags(meta_data_tags) %>
|
6
|
+
<%= canonical_tag(current_store.url) %>
|
7
|
+
<%= favicon_link_tag 'favicon.ico' %>
|
8
|
+
<%= stylesheet_link_tag 'spree/frontend/all', :media => 'screen' %>
|
9
|
+
<%= csrf_meta_tags %>
|
10
|
+
<%= javascript_include_tag 'spree/frontend/all' %>
|
11
|
+
<!--[if lt IE 9]>
|
12
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6/html5shiv.min.js"></script>
|
13
|
+
<![endif]-->
|
14
|
+
<%= yield :head %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<nav class="columns sixteen">
|
2
|
+
<% if current_admin? %>
|
3
|
+
<li><%= cms_link_to_edit_mode %></li>
|
4
|
+
<li><%= link_to "Admin", spree.admin_orders_path, data: { 'no-turbolink' => true } %></li>
|
5
|
+
<% end %>
|
6
|
+
<%= cms_locale_selector %>
|
7
|
+
<ul id="main-nav-bar" class="inline" data-hook>
|
8
|
+
<li></li>
|
9
|
+
<li id="home-link" data-hook><%= link_to Spree.t(:home), spree.root_path %></li>
|
10
|
+
<li id="link-to-cart" data-hook>
|
11
|
+
<noscript>
|
12
|
+
<%= link_to Spree.t(:cart), '/cart' %>
|
13
|
+
</noscript>
|
14
|
+
|
15
|
+
</li>
|
16
|
+
<script>Spree.fetch_cart()</script>
|
17
|
+
</ul>
|
18
|
+
</nav>
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# PostgreSQL. Versions 8.2 and up are supported.
|
2
|
+
#
|
3
|
+
# Install the pg driver:
|
4
|
+
# gem install pg
|
5
|
+
# On OS X with Homebrew:
|
6
|
+
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
7
|
+
# On OS X with MacPorts:
|
8
|
+
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
9
|
+
# On Windows:
|
10
|
+
# gem install pg
|
11
|
+
# Choose the win32 build.
|
12
|
+
# Install PostgreSQL and put its /bin directory on your path.
|
13
|
+
#
|
14
|
+
# Configure Using Gemfile
|
15
|
+
# gem 'pg'
|
16
|
+
#
|
17
|
+
default: &default
|
18
|
+
adapter: postgresql
|
19
|
+
encoding: unicode
|
20
|
+
# For details on connection pooling, see rails configuration guide
|
21
|
+
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
22
|
+
pool: 5
|
23
|
+
host: 127.0.0.1
|
24
|
+
username: postgres
|
25
|
+
password: postgres
|
26
|
+
|
27
|
+
development:
|
28
|
+
<<: *default
|
29
|
+
database: <%= app_name %>_development
|
30
|
+
|
31
|
+
# The specified database role being used to connect to postgres.
|
32
|
+
# To create additional roles in postgres see `$ createuser --help`.
|
33
|
+
# When left blank, postgres will use the default role. This is
|
34
|
+
# the same name as the operating system user that initialized the database.
|
35
|
+
#username: <%= app_name %>
|
36
|
+
|
37
|
+
# The password associated with the postgres role (username).
|
38
|
+
#password:
|
39
|
+
|
40
|
+
# Connect on a TCP socket. Omitted by default since the client uses a
|
41
|
+
# domain socket that doesn't need configuration. Windows does not have
|
42
|
+
# domain sockets, so uncomment these lines.
|
43
|
+
#host: localhost
|
44
|
+
|
45
|
+
# The TCP port the server listens on. Defaults to 5432.
|
46
|
+
# If your server runs on a different port number, change accordingly.
|
47
|
+
#port: 5432
|
48
|
+
|
49
|
+
# Schema search path. The server defaults to $user,public
|
50
|
+
#schema_search_path: myapp,sharedapp,public
|
51
|
+
|
52
|
+
# Minimum log levels, in increasing order:
|
53
|
+
# debug5, debug4, debug3, debug2, debug1,
|
54
|
+
# log, notice, warning, error, fatal, and panic
|
55
|
+
# Defaults to warning.
|
56
|
+
#min_messages: notice
|
57
|
+
|
58
|
+
# Warning: The database defined as "test" will be erased and
|
59
|
+
# re-generated from your development database when you run "rake".
|
60
|
+
# Do not set this db to the same as development or production.
|
61
|
+
test:
|
62
|
+
<<: *default
|
63
|
+
database: <%= app_name %>_test
|
64
|
+
|
65
|
+
vagrant:
|
66
|
+
<<: *default
|
67
|
+
database: <%= app_name %>_vagrant
|
68
|
+
username: <%= app_name %>
|
69
|
+
|
70
|
+
staging:
|
71
|
+
<<: *default
|
72
|
+
database: <%= app_name %>_staging
|
73
|
+
username: <%= app_name %>
|
74
|
+
password: <%= SecureRandom.hex %>
|
75
|
+
|
76
|
+
# As with config/secrets.yml, you never want to store sensitive information,
|
77
|
+
# like your database password, in your source code. If your source code is
|
78
|
+
# ever seen by anyone, they now have access to your database.
|
79
|
+
#
|
80
|
+
# Instead, provide the password as a unix environment variable when you boot
|
81
|
+
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
|
82
|
+
# for a full rundown on how to provide these environment variables in a
|
83
|
+
# production deployment.
|
84
|
+
#
|
85
|
+
# On Heroku and other platform providers, you may have a full connection URL
|
86
|
+
# available as an environment variable. For example:
|
87
|
+
#
|
88
|
+
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
89
|
+
#
|
90
|
+
# You can use this database configuration with:
|
91
|
+
#
|
92
|
+
# production:
|
93
|
+
# url: <%%= ENV['DATABASE_URL'] %>
|
94
|
+
#
|
95
|
+
production:
|
96
|
+
<<: *default
|
97
|
+
database: <%= app_name %>_production
|
98
|
+
username: <%= app_name %>
|
99
|
+
password: <%= SecureRandom.hex %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
4
|
+
Rails.application.config.assets.version = '1.0'
|
5
|
+
|
6
|
+
# Add additional assets to the asset load path
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
+
|
9
|
+
# Precompile additional assets.
|
10
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
+
Rails.application.config.assets.precompile += %w[
|
12
|
+
rich/editor.css
|
13
|
+
bx_loader.gif
|
14
|
+
controls.png
|
15
|
+
<% if options.solidus? -%>
|
16
|
+
noimage/mini.png
|
17
|
+
icons/delete.png
|
18
|
+
<% end -%>
|
19
|
+
]
|
@@ -0,0 +1 @@
|
|
1
|
+
Devise.secret_key = '<%= SecureRandom.hex(50) %>'
|
@@ -0,0 +1,101 @@
|
|
1
|
+
RailsAdmin.config do |config|
|
2
|
+
### Popular gems integration
|
3
|
+
config.browser_validations = false
|
4
|
+
|
5
|
+
## == Devise ==
|
6
|
+
# config.authenticate_with do
|
7
|
+
# warden.authenticate! scope: :user
|
8
|
+
# end
|
9
|
+
# config.current_user_method(&:current_user)
|
10
|
+
|
11
|
+
## == Cancan ==
|
12
|
+
# config.authorize_with :cancan
|
13
|
+
|
14
|
+
## == Pundit ==
|
15
|
+
# config.authorize_with :pundit
|
16
|
+
|
17
|
+
## == PaperTrail ==
|
18
|
+
# config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
|
19
|
+
|
20
|
+
### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
|
21
|
+
|
22
|
+
config.actions do
|
23
|
+
dashboard # mandatory
|
24
|
+
index # mandatory
|
25
|
+
new do
|
26
|
+
except Viewable.models + Form.structure_models + %w[
|
27
|
+
UniqueKey
|
28
|
+
Setting
|
29
|
+
Rich::RichFile
|
30
|
+
Form::Row
|
31
|
+
]
|
32
|
+
end
|
33
|
+
export do
|
34
|
+
except Viewable.models + Form.structure_models + %w[
|
35
|
+
UniqueKey
|
36
|
+
]
|
37
|
+
end
|
38
|
+
bulk_delete do
|
39
|
+
except Viewable.models + Form.structure_models + %w[
|
40
|
+
UniqueKey
|
41
|
+
Setting
|
42
|
+
]
|
43
|
+
end
|
44
|
+
show do
|
45
|
+
except Viewable.models + Form.structure_models + %w[
|
46
|
+
UniqueKey
|
47
|
+
]
|
48
|
+
end
|
49
|
+
edit do
|
50
|
+
except %w[
|
51
|
+
UniqueKey
|
52
|
+
]
|
53
|
+
end
|
54
|
+
delete do
|
55
|
+
except Form.structure_models + %w[
|
56
|
+
UniqueKey
|
57
|
+
Setting
|
58
|
+
]
|
59
|
+
end
|
60
|
+
show_in_app
|
61
|
+
|
62
|
+
## With an audit adapter, you can add:
|
63
|
+
# history_index
|
64
|
+
# history_show
|
65
|
+
end
|
66
|
+
|
67
|
+
config.model 'Rich::RichFile' do
|
68
|
+
navigation_label I18n.t('rich.file.navigation')
|
69
|
+
label I18n.t('rich.file.one')
|
70
|
+
label_plural I18n.t('rich.file.other')
|
71
|
+
|
72
|
+
object_label_method do
|
73
|
+
:name
|
74
|
+
end
|
75
|
+
|
76
|
+
configure :rich_file, :jcrop
|
77
|
+
|
78
|
+
list do
|
79
|
+
field :rich_file
|
80
|
+
field :rich_file_file_name
|
81
|
+
field :simplified_type
|
82
|
+
field :owner_type
|
83
|
+
end
|
84
|
+
|
85
|
+
show do
|
86
|
+
field :rich_file
|
87
|
+
field :owner_type
|
88
|
+
end
|
89
|
+
|
90
|
+
edit do
|
91
|
+
field :rich_file do
|
92
|
+
fit_image true
|
93
|
+
end
|
94
|
+
field :owner_type, :enum do
|
95
|
+
enum do
|
96
|
+
['cms']
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|