o2webappizer 0.1.7 → 0.1.8

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -0
  3. data/lib/o2webappizer/app_builder.rb +45 -13
  4. data/lib/o2webappizer/generators/app_generator.rb +1 -0
  5. data/lib/o2webappizer/version.rb +1 -1
  6. data/o2webappizer.gemspec +1 -1
  7. data/templates/.gitignore.tt +1 -0
  8. data/templates/Capfile +19 -0
  9. data/templates/Gemfile.tt +7 -4
  10. data/templates/Vagrantfile.tt +74 -0
  11. data/templates/app/assets/javascripts/application.js.coffee +1 -1
  12. data/templates/app/views/spree/shared/_head.html.erb +2 -2
  13. data/templates/config/Backup/config.rb +124 -0
  14. data/templates/config/Backup/models/db_backup.rb.tt +91 -0
  15. data/templates/config/deploy.rb.tt +92 -0
  16. data/templates/config/deploy/production.rb +66 -0
  17. data/templates/config/deploy/staging.rb +66 -0
  18. data/templates/config/deploy/vagrant.rb +66 -0
  19. data/templates/config/initializers_tt/mail_interceptor.rb +21 -0
  20. data/templates/config/nginx.app.conf.erb +82 -0
  21. data/templates/config/nginx.conf.erb +102 -0
  22. data/templates/config/routes.rb.tt +3 -0
  23. data/templates/config/secrets.yml.tt +10 -0
  24. data/templates/config/sunzi/files/authorized_keys +1 -0
  25. data/templates/config/sunzi/files/sudoers +1 -0
  26. data/templates/config/sunzi/install.sh +14 -0
  27. data/templates/config/sunzi/recipes/libraries.sh +24 -0
  28. data/templates/config/sunzi/recipes/mysql.sh +19 -0
  29. data/templates/config/sunzi/recipes/nodejs.sh +6 -0
  30. data/templates/config/sunzi/recipes/passenger.sh +19 -0
  31. data/templates/config/sunzi/recipes/postgres.sh +14 -0
  32. data/templates/config/sunzi/recipes/ruby.sh +28 -0
  33. data/templates/config/sunzi/recipes/setup.sh +11 -0
  34. data/templates/config/sunzi/recipes/sunzi.sh +99 -0
  35. data/templates/config/sunzi/recipes/sysstat.sh +8 -0
  36. data/templates/config/sunzi/recipes/update.sh +2 -0
  37. data/templates/config/sunzi/recipes/user.sh +23 -0
  38. data/templates/config/sunzi/roles/admin.sh +20 -0
  39. data/templates/config/sunzi/roles/deployer.sh +7 -0
  40. data/templates/config/sunzi/roles/updater.sh +5 -0
  41. data/templates/config/sunzi/sunzi.yml.tt +26 -0
  42. data/templates/db/migrate/20160114191411_add_mail_interceptors_to_settings.rb +12 -0
  43. data/templates/lib/middleware/turbo_dev.rb +40 -0
  44. data/templates/lib/tasks/app.rake +3 -0
  45. data/templates/lib/tasks/db.rake +9 -0
  46. data/templates/schedule.rb +47 -0
  47. data/templates/vendor/assets/javascripts/modernizr.custom.js +3 -0
  48. metadata +37 -10
  49. data/templates/vendor/assets/javascripts/modernizr.js +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfb5011492996ddbdbd5986bb751557689e31fb0
4
- data.tar.gz: 331c1e1dc466157bda39a3ee160a93b75a824795
3
+ metadata.gz: 6e343d602469ec85e307a91bcda814732aa7a51c
4
+ data.tar.gz: 75077099ddbef921b788bdc63968991751d0d71e
5
5
  SHA512:
6
- metadata.gz: 02e5880b03a588d372bd8a5a294d16cf8a13af4d39b440001f9c97053248440838530cea542a0799ad5dc673166186f37a76da24213f4926c683ebf6ceaec0d6
7
- data.tar.gz: 3de48570a62e5d54d1a420be5968c6c08dc23a06aaaf8e5fc579218832e7472bbee874f2298d7726fc9c0d467b6e8c9819630c193c8757805a0d537c8d2145bc
6
+ metadata.gz: 3da3608109c9e1e898ab7f1c58657f19bcf1967488a8ec73a69bd62f1925a609fc0a09eabe24b2e680b62007605c8a00c42618a32eda67375370172d11207abd
7
+ data.tar.gz: 77cf7fbf1b14cf789ff9e3c04097e310d06363c4f44870b39227e3b717740e09b3327ce48461da238e9c937be9d57bce7d94c575d16a5582efa0224ba1d94f0c
data/README.md CHANGED
@@ -25,9 +25,20 @@ 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
+ ## Vagrant
29
+
30
+ Add `192.168.33.37 app-name.dev` to your `/etc/hosts` file.
31
+ After `vagrant up`, connect with `vagrant ssh` and add your public ssh key `id_rsa.pub` to `~/.ssh/authorized_keys`.
32
+
28
33
  ## TODO
29
34
 
35
+ * Gzip yaml_db
36
+ * Moneybird i18n-workflow
37
+ * Rack-attack + Log rotate
38
+ * Devise Confirmed At option
30
39
  * Rspec
40
+ * Redis + Que
41
+ * Solidus plugins (CMSConnector, EasyPost, Mini-cart, Wishlist, Volume Pricing, Custom Promos, Related Products, Variant Options, Reviews, Auctions)
31
42
 
32
43
  ## Contributing
33
44
 
@@ -36,12 +36,19 @@ module O2webappizer
36
36
  empty_directory 'config'
37
37
 
38
38
  inside 'config' do
39
- template 'routes.rb'
40
- template 'application.rb'
39
+ directory 'Backup'
40
+ directory 'deploy'
41
+ directory 'sunzi'
42
+ template 'deploy.rb'
43
+ copy_file 'nginx.app.conf.erb'
44
+ copy_file 'nginx.conf.erb'
45
+
46
+ template 'routes.rb'
47
+ template 'application.rb'
41
48
  configure_application
42
- template 'database.yml'
43
- template 'environment.rb'
44
- template 'secrets.yml'
49
+ template 'database.yml'
50
+ template 'environment.rb'
51
+ template 'secrets.yml'
45
52
  directory 'environments'
46
53
 
47
54
  inside 'environments' do
@@ -78,6 +85,11 @@ module O2webappizer
78
85
  def database_yml
79
86
  end
80
87
 
88
+ def lib
89
+ directory 'lib'
90
+ empty_directory_with_keep_file 'lib/assets'
91
+ end
92
+
81
93
  def public_directory
82
94
  directory 'public'
83
95
  end
@@ -87,7 +99,7 @@ module O2webappizer
87
99
 
88
100
  inside 'vendor/assets' do
89
101
  copy_file 'javascripts/jquery.lazyload.js'
90
- copy_file 'javascripts/modernizr.js'
102
+ copy_file 'javascripts/modernizr.custom.js'
91
103
  directory 'javascripts/rails_admin'
92
104
  copy_file 'stylesheets/nprogress-variables.sass'
93
105
  directory 'stylesheets/rails_admin'
@@ -101,6 +113,9 @@ module O2webappizer
101
113
 
102
114
  def leftovers
103
115
  template '.ruby-version'
116
+ copy_file 'Capfile'
117
+ copy_file 'schedule.rb'
118
+ template 'Vagrantfile'
104
119
 
105
120
  after_bundle do
106
121
  rake 'railties:install:migrations'
@@ -183,10 +198,17 @@ module O2webappizer
183
198
  end
184
199
 
185
200
  def configure_development
201
+ insert_into_file 'development.rb', %{require_relative '../../lib/middleware/turbo_dev'\n\n},
202
+ before: %{Rails.application.configure do}
203
+
186
204
  environment(<<-DEV.strip_heredoc.indent(2), env: 'development')
187
205
 
188
- config.action_controller.asset_host = 'http://localhost:3000'
189
- config.action_mailer.asset_host = 'http://localhost:3000'
206
+ config.middleware.insert 0, Middleware::TurboDev
207
+
208
+ config.action_controller.asset_host = '//localhost:3000'
209
+ config.action_mailer.asset_host = '//localhost:3000'
210
+ config.action_mailer.delivery_method = :letter_opener_web
211
+ config.action_mailer.default_url_options = { :host => "localhost:3000" }
190
212
  DEV
191
213
  end
192
214
 
@@ -203,11 +225,21 @@ module O2webappizer
203
225
  end
204
226
 
205
227
  def configure_env(name, level)
206
- environment(<<-DEV.strip_heredoc.indent(2), env: name)
207
-
208
- # config.action_controller.asset_host = 'http://todo.todo'
209
- # config.action_mailer.asset_host = 'http://todo.todo'
210
- DEV
228
+ environment(<<-CONFIG.strip_heredoc.indent(2), env: name)
229
+
230
+ config.action_controller.asset_host = '//todo.todo'
231
+ config.action_mailer.asset_host = '//todo.todo'
232
+ config.action_mailer.delivery_method = :smtp
233
+ config.action_mailer.smtp_settings = {
234
+ address: 'smtp.mailgun.org',
235
+ port: 587,
236
+ domain: 'todo.mailgun.org',
237
+ user_name: 'todo',
238
+ password: 'todo',
239
+ authentication: 'plain',
240
+ }
241
+ config.action_mailer.default_url_options = { :host => 'todo.todo' }
242
+ CONFIG
211
243
  gsub_file "#{name}.rb", /# config.action_dispatch.+NGINX/,
212
244
  "config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX"
213
245
  gsub_file "#{name}.rb", /config.log_level = :debug/,
@@ -1,3 +1,4 @@
1
+ # https://github.com/thoughtbot/suspenders
1
2
  require 'rails/generators'
2
3
  require 'rails/generators/rails/app/app_generator'
3
4
 
@@ -1,5 +1,5 @@
1
1
  module O2webappizer
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip
4
4
  RAILS_VERSION = "4.2"
5
5
  end
data/o2webappizer.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency 'rails', "~> #{O2webappizer::RAILS_VERSION}", ">= #{O2webappizer::RAILS_VERSION}.0"
25
25
 
26
- spec.add_runtime_dependency 'bundler', '~> 1.10', '~> 1.3'
26
+ spec.add_runtime_dependency 'bundler', '~> 1.3'
27
27
 
28
28
  spec.add_development_dependency "rake", "~> 10.0"
29
29
  end
@@ -42,6 +42,7 @@
42
42
  tools/bower/vendor/*
43
43
 
44
44
  .vagrant/*
45
+ /compiled
45
46
 
46
47
  # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
47
48
  *.iml
data/templates/Capfile ADDED
@@ -0,0 +1,19 @@
1
+ # Load DSL and set up stages
2
+ require 'capistrano/setup'
3
+
4
+ # Include default deployment tasks
5
+ require 'capistrano/deploy'
6
+
7
+ # Include tasks from other gems included in your Gemfile
8
+ require 'capistrano/rbenv'
9
+ require 'capistrano/bundler'
10
+ require 'capistrano/rails/assets'
11
+ require 'capistrano/rails/migrations'
12
+ require 'capistrano/o2web_recipes'
13
+ require 'capistrano/nginx'
14
+ require 'capistrano/passenger'
15
+ require 'capistrano/faster_assets'
16
+ require 'whenever/capistrano'
17
+
18
+ # Load custom tasks from `lib/capistrano/tasks` if you have any defined
19
+ Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
data/templates/Gemfile.tt CHANGED
@@ -3,10 +3,12 @@ source 'https://rubygems.org'
3
3
 
4
4
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
5
  gem 'rails', github: 'rails/rails', branch: '4-2-stable'
6
+ gem 'rake', '~> 10.4'
6
7
  # Use postgresql as the database for Active Record
7
8
  gem 'pg', '~> 0.15'
8
9
  # Use SCSS for stylesheets
9
10
  gem 'sassc-rails', github: 'Shopify/sassc-rails', branch: 'sprockets-rails-3'
11
+ gem 'sprockets-derailleur', github: 'bonobos/sprockets-derailleur'
10
12
  # Use Uglifier as compressor for JavaScript assets
11
13
  gem 'uglifier', '>= 1.3.0'
12
14
  # Use CoffeeScript for .coffee assets and views
@@ -32,6 +34,8 @@ group :development, :test do
32
34
  gem 'capistrano-rbenv', '~> 2.0'
33
35
  gem 'capistrano3-nginx', '~> 2.0'
34
36
  gem 'capistrano-passenger'
37
+ gem 'capistrano-o2web-recipes', github: 'o2web/capistrano-o2web-recipes', branch: 'master'
38
+ gem 'capistrano-faster-assets', '~> 1.0'
35
39
  # TODO: gem 'capistrano-maintenance', '~> 1.0'
36
40
 
37
41
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
@@ -42,14 +46,13 @@ group :development, :test do
42
46
  gem 'quiet_assets'
43
47
  gem 'coffee-rails-source-paths', github: 'Machiaweliczny/coffee-rails-source-paths'
44
48
  gem 'sass-rails-source-maps', github: 'inopinatus/sass-rails-source-maps'
45
- <% unless options.solidus? -%>
46
49
  gem 'letter_opener'
47
50
  gem 'letter_opener_web', '~> 1.2.0'
48
- <% end -%>
49
51
  end
50
52
 
51
- # Deploy
52
- gem 'sprockets-derailleur', github: 'bonobos/sprockets-derailleur'
53
+ group :staging, :vagrant do
54
+ gem 'mail_interceptor'
55
+ end
53
56
 
54
57
  # Scheduling
55
58
  gem 'whenever', require: false
@@ -0,0 +1,74 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # All Vagrant configuration is done below. The "2" in Vagrant.configure
5
+ # configures the configuration version (we support older styles for
6
+ # backwards compatibility). Please don't change it unless you know what
7
+ # you're doing.
8
+ Vagrant.configure(2) do |config|
9
+ # The most common configuration options are documented and commented below.
10
+ # For a complete reference, please see the online documentation at
11
+ # https://docs.vagrantup.com.
12
+
13
+ # Every Vagrant development environment requires a box. You can search for
14
+ # boxes at https://atlas.hashicorp.com/search.
15
+ config.vm.box = "ubuntu/trusty64"
16
+
17
+ # Disable automatic box update checking. If you disable this, then
18
+ # boxes will only be checked for updates when the user runs
19
+ # `vagrant box outdated`. This is not recommended.
20
+ # config.vm.box_check_update = false
21
+
22
+ # Create a forwarded port mapping which allows access to a specific port
23
+ # within the machine from a port on the host machine. In the example below,
24
+ # accessing "localhost:8080" will access port 80 on the guest machine.
25
+ # config.vm.network "forwarded_port", guest: 80, host: 8080
26
+
27
+ # Create a private network, which allows host-only access to the machine
28
+ # using a specific IP.
29
+ config.vm.network "private_network", ip: "192.168.33.37"
30
+
31
+ # Create a public network, which generally matched to bridged network.
32
+ # Bridged networks make the machine appear as another physical device on
33
+ # your network.
34
+ # config.vm.network "public_network"
35
+
36
+ # Share an additional folder to the guest VM. The first argument is
37
+ # the path on the host to the actual folder. The second argument is
38
+ # the path on the guest to mount the folder. And the optional third
39
+ # argument is a set of non-required options.
40
+ # config.vm.synced_folder "../data", "/vagrant_data"
41
+
42
+
43
+ # Provider-specific configuration so you can fine-tune various
44
+ # backing providers for Vagrant. These expose provider-specific options.
45
+ # Example for VirtualBox:
46
+ #
47
+ config.vm.provider "virtualbox" do |vb|
48
+ # # Display the VirtualBox GUI when booting the machine
49
+ # vb.gui = true
50
+ #
51
+ # # Customize the amount of memory on the VM:
52
+ vb.memory = "2048"
53
+ end
54
+
55
+ # View the documentation for the provider you are using for more
56
+ # information on available options.
57
+
58
+ # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
59
+ # such as FTP and Heroku are also available. See the documentation at
60
+ # https://docs.vagrantup.com/v2/push/atlas.html for more information.
61
+ # config.push.define "atlas" do |push|
62
+ # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
63
+ # end
64
+
65
+ # Enable provisioning with a shell script. Additional provisioners such as
66
+ # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
67
+ # documentation for more information about their specific syntax and use.
68
+ # config.vm.provision "shell", inline: <<-SHELL
69
+ # sudo apt-get update
70
+ # sudo apt-get install -y apache2
71
+ # SHELL
72
+ config.vm.hostname = "<%= app_name.dasherize %>.dev"
73
+ # config.vm.synced_folders
74
+ end
@@ -16,7 +16,7 @@
16
16
  #= require jquery.lazyload
17
17
  #= require nprogress
18
18
  #= require nprogress-turbolinks
19
- #= require modernizr
19
+ #= require modernizr.custom
20
20
 
21
21
  #= require rails_admin_cms/all
22
22
 
@@ -5,9 +5,9 @@
5
5
  <%== cms_meta_data_tags(meta_data_tags) %>
6
6
  <%= canonical_tag(current_store.url) %>
7
7
  <%= favicon_link_tag 'favicon.ico' %>
8
- <%= stylesheet_link_tag 'spree/frontend/all', :media => 'screen' %>
8
+ <%= stylesheet_link_tag 'spree/frontend/all', media: 'all', 'data-turbolinks-track' => true %>
9
9
  <%= csrf_meta_tags %>
10
- <%= javascript_include_tag 'spree/frontend/all' %>
10
+ <%= javascript_include_tag 'spree/frontend/all', 'data-turbolinks-track' => true %>
11
11
  <!--[if lt IE 9]>
12
12
  <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6/html5shiv.min.js"></script>
13
13
  <![endif]-->
@@ -0,0 +1,124 @@
1
+ # encoding: utf-8
2
+
3
+ ##
4
+ # Backup v4.x Configuration
5
+ #
6
+ # Documentation: http://meskyanichi.github.io/backup
7
+ # Issue Tracker: https://github.com/meskyanichi/backup/issues
8
+
9
+ ##
10
+ # Config Options
11
+ #
12
+ # The options here may be overridden on the command line, but the result
13
+ # will depend on the use of --root-path on the command line.
14
+ #
15
+ # If --root-path is used on the command line, then all paths set here
16
+ # will be overridden. If a path (like --tmp-path) is not given along with
17
+ # --root-path, that path will use it's default location _relative to --root-path_.
18
+ #
19
+ # If --root-path is not used on the command line, a path option (like --tmp-path)
20
+ # given on the command line will override the tmp_path set here, but all other
21
+ # paths set here will be used.
22
+ #
23
+ # Note that relative paths given on the command line without --root-path
24
+ # are relative to the current directory. The root_path set here only applies
25
+ # to relative paths set here.
26
+ #
27
+ # ---
28
+ #
29
+ # Sets the root path for all relative paths, including default paths.
30
+ # May be an absolute path, or relative to the current working directory.
31
+ #
32
+ # root_path 'my/root'
33
+ #
34
+ # Sets the path where backups are processed until they're stored.
35
+ # This must have enough free space to hold apx. 2 backups.
36
+ # May be an absolute path, or relative to the current directory or +root_path+.
37
+ #
38
+ # tmp_path 'my/tmp'
39
+ #
40
+ # Sets the path where backup stores persistent information.
41
+ # When Backup's Cycler is used, small YAML files are stored here.
42
+ # May be an absolute path, or relative to the current directory or +root_path+.
43
+ #
44
+ # data_path 'my/data'
45
+
46
+ ##
47
+ # Utilities
48
+ #
49
+ # If you need to use a utility other than the one Backup detects,
50
+ # or a utility can not be found in your $PATH.
51
+ #
52
+ # Utilities.configure do
53
+ # tar '/usr/bin/gnutar'
54
+ # redis_cli '/opt/redis/redis-cli'
55
+ # end
56
+
57
+ ##
58
+ # Logging
59
+ #
60
+ # Logging options may be set on the command line, but certain settings
61
+ # may only be configured here.
62
+ #
63
+ Logger.configure do
64
+ logfile.enabled = false
65
+ # console.quiet = true # Same as command line: --quiet
66
+ # logfile.max_bytes = 2_000_000 # Default: 500_000
67
+ # syslog.enabled = true # Same as command line: --syslog
68
+ # syslog.ident = 'my_app_backup' # Default: 'backup'
69
+ end
70
+ #
71
+ # Command line options will override those set here.
72
+ # For example, the following would override the example settings above
73
+ # to disable syslog and enable console output.
74
+ # backup perform --trigger my_backup --no-syslog --no-quiet
75
+
76
+ ##
77
+ # Component Defaults
78
+ #
79
+ # Set default options to be applied to components in all models.
80
+ # Options set within a model will override those set here.
81
+ #
82
+ # Storage::S3.defaults do |s3|
83
+ # s3.access_key_id = "my_access_key_id"
84
+ # s3.secret_access_key = "my_secret_access_key"
85
+ # end
86
+ #
87
+ # Notifier::Mail.defaults do |mail|
88
+ # mail.from = 'sender@email.com'
89
+ # mail.to = 'receiver@email.com'
90
+ # mail.address = 'smtp.gmail.com'
91
+ # mail.port = 587
92
+ # mail.domain = 'your.host.name'
93
+ # mail.user_name = 'sender@email.com'
94
+ # mail.password = 'my_password'
95
+ # mail.authentication = 'plain'
96
+ # mail.encryption = :starttls
97
+ # end
98
+
99
+ ##
100
+ # Preconfigured Models
101
+ #
102
+ # Create custom models with preconfigured components.
103
+ # Components added within the model definition will
104
+ # +add to+ the preconfigured components.
105
+ #
106
+ # preconfigure 'MyModel' do
107
+ # archive :user_pictures do |archive|
108
+ # archive.add '~/pictures'
109
+ # end
110
+ #
111
+ # notify_by Mail do |mail|
112
+ # mail.to = 'admin@email.com'
113
+ # end
114
+ # end
115
+ #
116
+ # MyModel.new(:john_smith, 'John Smith Backup') do
117
+ # archive :user_music do |archive|
118
+ # archive.add '~/music'
119
+ # end
120
+ #
121
+ # notify_by Mail do |mail|
122
+ # mail.to = 'john.smith@email.com'
123
+ # end
124
+ # end