disco_app 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +37 -0
  3. data/app/assets/javascripts/disco_app/disco_app.js +7 -0
  4. data/app/assets/stylesheets/disco_app/bootstrap-custom.scss +55 -0
  5. data/app/assets/stylesheets/disco_app/bootstrap-variables.scss +12 -0
  6. data/app/assets/stylesheets/disco_app/disco_app.scss +7 -0
  7. data/app/controllers/disco_app/app_proxy_controller.rb +41 -0
  8. data/app/controllers/disco_app/authenticated_controller.rb +44 -0
  9. data/app/controllers/disco_app/carrier_request_controller.rb +28 -0
  10. data/app/controllers/disco_app/charges_controller.rb +30 -0
  11. data/app/controllers/disco_app/install_controller.rb +26 -0
  12. data/app/controllers/disco_app/webhooks_controller.rb +40 -0
  13. data/app/helpers/disco_app/application_helper.rb +4 -0
  14. data/app/jobs/disco_app/app_installed_job.rb +41 -0
  15. data/app/jobs/disco_app/app_uninstalled_job.rb +18 -0
  16. data/app/jobs/disco_app/shop_job.rb +29 -0
  17. data/app/jobs/disco_app/shop_update_job.rb +16 -0
  18. data/app/models/disco_app/shop.rb +44 -0
  19. data/app/services/disco_app/charges_service.rb +73 -0
  20. data/app/views/disco_app/charges/activate.html.erb +1 -0
  21. data/app/views/disco_app/charges/create.html.erb +1 -0
  22. data/app/views/disco_app/charges/new.html.erb +45 -0
  23. data/app/views/disco_app/install/installing.html.erb +7 -0
  24. data/app/views/disco_app/install/uninstalling.html.erb +1 -0
  25. data/app/views/disco_app/proxy_errors/404.html.erb +1 -0
  26. data/config/routes.rb +19 -0
  27. data/db/migrate/20150525162112_add_status_to_shops.rb +5 -0
  28. data/db/migrate/20150525171422_add_meta_to_shops.rb +11 -0
  29. data/db/migrate/20150629210346_add_charge_status_to_shop.rb +5 -0
  30. data/db/migrate/20150814214025_add_more_meta_to_shops.rb +16 -0
  31. data/lib/disco_app/engine.rb +6 -0
  32. data/lib/disco_app/version.rb +3 -0
  33. data/lib/disco_app.rb +4 -0
  34. data/lib/generators/disco_app/USAGE +5 -0
  35. data/lib/generators/disco_app/disco_app_generator.rb +182 -0
  36. data/lib/generators/disco_app/reactify/reactify_generator.rb +31 -0
  37. data/lib/generators/disco_app/templates/assets/javascripts/application.js +17 -0
  38. data/lib/generators/disco_app/templates/assets/stylesheets/application.scss +5 -0
  39. data/lib/generators/disco_app/templates/config/puma.rb +15 -0
  40. data/lib/generators/disco_app/templates/controllers/home_controller.rb +7 -0
  41. data/lib/generators/disco_app/templates/initializers/disco_app.rb +1 -0
  42. data/lib/generators/disco_app/templates/initializers/shopify_app.rb +6 -0
  43. data/lib/generators/disco_app/templates/jobs/app_installed_job.rb +2 -0
  44. data/lib/generators/disco_app/templates/jobs/app_uninstalled_job.rb +2 -0
  45. data/lib/generators/disco_app/templates/jobs/shop_update_job.rb +2 -0
  46. data/lib/generators/disco_app/templates/models/shop.rb +3 -0
  47. data/lib/generators/disco_app/templates/root/Procfile +2 -0
  48. data/lib/generators/disco_app/templates/views/home/index.html.erb +2 -0
  49. data/lib/generators/disco_app/templates/views/layouts/application.html.erb +18 -0
  50. data/lib/generators/disco_app/templates/views/layouts/embedded_app.html.erb +33 -0
  51. data/lib/generators/disco_app/templates/views/sessions/new.html.erb +26 -0
  52. data/test/disco_app_test.rb +7 -0
  53. data/test/dummy/README.rdoc +28 -0
  54. data/test/dummy/Rakefile +6 -0
  55. data/test/dummy/app/assets/javascripts/application.js +13 -0
  56. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  57. data/test/dummy/app/controllers/application_controller.rb +5 -0
  58. data/test/dummy/app/helpers/application_helper.rb +2 -0
  59. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  60. data/test/dummy/bin/bundle +3 -0
  61. data/test/dummy/bin/rails +4 -0
  62. data/test/dummy/bin/rake +4 -0
  63. data/test/dummy/bin/setup +29 -0
  64. data/test/dummy/config/application.rb +26 -0
  65. data/test/dummy/config/boot.rb +5 -0
  66. data/test/dummy/config/database.yml +25 -0
  67. data/test/dummy/config/environment.rb +5 -0
  68. data/test/dummy/config/environments/development.rb +41 -0
  69. data/test/dummy/config/environments/production.rb +79 -0
  70. data/test/dummy/config/environments/test.rb +42 -0
  71. data/test/dummy/config/initializers/assets.rb +11 -0
  72. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  73. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  74. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  75. data/test/dummy/config/initializers/inflections.rb +16 -0
  76. data/test/dummy/config/initializers/mime_types.rb +4 -0
  77. data/test/dummy/config/initializers/session_store.rb +3 -0
  78. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  79. data/test/dummy/config/locales/en.yml +23 -0
  80. data/test/dummy/config/routes.rb +4 -0
  81. data/test/dummy/config/secrets.yml +22 -0
  82. data/test/dummy/config.ru +4 -0
  83. data/test/dummy/public/404.html +67 -0
  84. data/test/dummy/public/422.html +67 -0
  85. data/test/dummy/public/500.html +66 -0
  86. data/test/dummy/public/favicon.ico +0 -0
  87. data/test/integration/navigation_test.rb +10 -0
  88. data/test/lib/generators/disco_app/disco_app_generator_test.rb +16 -0
  89. data/test/test_helper.rb +20 -0
  90. metadata +338 -0
@@ -0,0 +1,11 @@
1
+ class AddMetaToShops < ActiveRecord::Migration
2
+ def change
3
+ add_column :shops, :email, :string
4
+ add_column :shops, :country_name, :string
5
+ add_column :shops, :currency, :string
6
+ add_column :shops, :money_format, :string
7
+ add_column :shops, :money_with_currency_format, :string
8
+ add_column :shops, :domain, :string
9
+ add_column :shops, :plan_name, :string
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class AddChargeStatusToShop < ActiveRecord::Migration
2
+ def change
3
+ add_column :shops, :charge_status, :integer, default: 0
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ class AddMoreMetaToShops < ActiveRecord::Migration
2
+ def change
3
+ add_column :shops, :plan_display_name, :string
4
+ add_column :shops, :latitude, :decimal
5
+ add_column :shops, :longitude, :decimal
6
+ add_column :shops, :customer_email, :string
7
+ add_column :shops, :plan_display_name, :string
8
+ add_column :shops, :password_enabled, :boolean
9
+ add_column :shops, :phone, :string
10
+ add_column :shops, :primary_locale, :string
11
+ add_column :shops, :ships_to_countries, :string
12
+ add_column :shops, :timezone, :string
13
+ add_column :shops, :iana_timezone, :string
14
+ add_column :shops, :has_storefront, :boolean
15
+ end
16
+ end
@@ -0,0 +1,6 @@
1
+ module DiscoApp
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace DiscoApp
4
+ engine_name 'disco_app'
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module DiscoApp
2
+ VERSION = "0.5.0"
3
+ end
data/lib/disco_app.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "disco_app/engine"
2
+
3
+ module DiscoApp
4
+ end
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Generate a new Shopify application.
3
+
4
+ Example:
5
+ rails generate disco_app
@@ -0,0 +1,182 @@
1
+ class DiscoAppGenerator < Rails::Generators::Base
2
+
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ # Copy a number of template files to the top-level directory of our application:
6
+ #
7
+ # - .env and .env.sample for settings environment variables in development with dotenv-rails;
8
+ # - Slightly customised version of the default Rails .gitignore;
9
+ # - Default simple Procfile for Heroku.
10
+ #
11
+ def copy_root_files
12
+ %w(.env .env.sample .gitignore Procfile).each do |file|
13
+ copy_file "root/#{file}", file
14
+ end
15
+ end
16
+
17
+ # Remove a number of root files.
18
+ def remove_root_files
19
+ %w(README.rdoc).each do |file|
20
+ remove_file file
21
+ end
22
+ end
23
+
24
+ # Configure the application's Gemfile.
25
+ def configure_gems
26
+ # Remove sqlite from the general Gemfile.
27
+ gsub_file 'Gemfile', /^# Use sqlite3 as the database for Active Record\ngem 'sqlite3'/m, ''
28
+
29
+ # Add gems common to all environments.
30
+ gem 'shopify_app', '~> 6.1.0'
31
+ gem 'sidekiq', '~> 3.4.2'
32
+ gem 'puma', '~> 2.11.3'
33
+ gem 'bootstrap-sass', '~> 3.3.5.1'
34
+
35
+ # Add gems for development and testing only.
36
+ gem_group :development, :test do
37
+ gem 'sqlite3', '~> 1.3.10'
38
+ gem 'dotenv-rails', '~> 2.0.2'
39
+ gem 'minitest-reporters', '~> 1.0.19'
40
+ gem 'guard', '~> 2.13.0'
41
+ gem 'guard-minitest', '~> 2.4.4'
42
+ end
43
+
44
+ # Add gems for production only.
45
+ gem_group :production do
46
+ gem 'pg', '~> 0.18.2'
47
+ gem 'rails_12factor', '~> 0.0.3'
48
+ end
49
+ end
50
+
51
+ # Make any required adjustments to the application configuration.
52
+ def configure_application
53
+ # The force_ssl flag is commented by default for production.
54
+ # Uncomment to ensure config.force_ssl = true in production.
55
+ uncomment_lines 'config/environments/production.rb', /force_ssl/
56
+
57
+ # Set defaults for various charge attributes.
58
+ application "config.x.shopify_charges_default_trial_days = 14\n"
59
+ application "config.x.shopify_charges_default_price = 10.00"
60
+ application "config.x.shopify_charges_default_type = :recurring"
61
+ application "# Set defaults for charges created by the application"
62
+
63
+ # Set the "real charges" config variable to false explicitly by default.
64
+ # Only in production do we read from the environment variable and potentially have it become true.
65
+ application "config.x.shopify_charges_real = false\n"
66
+ application "# Explicitly prevent real charges being created by default"
67
+ application "config.x.shopify_charges_real = ENV['SHOPIFY_CHARGES_REAL'] == 'true'\n", env: :production
68
+ application "# Allow real charges in production with an ENV variable", env: :production
69
+
70
+ # Set Sidekiq as the queue adapter in production.
71
+ application "config.active_job.queue_adapter = :sidekiq\n", env: :production
72
+ application "# Use Sidekiq as the active job backend", env: :production
73
+
74
+ # Ensure the application configuration uses the DEFAULT_HOST environment variable to set up support for reverse
75
+ # routing absolute URLS (needed when generating Webhook URLs for example).
76
+ application "routes.default_url_options[:host] = ENV['DEFAULT_HOST']\n"
77
+ application "# Set the default host for absolute URL routing purposes"
78
+
79
+ application "config.x.shopify_app_name = ENV['SHOPIFY_APP_NAME']\n"
80
+ application "# Set the name of the application"
81
+
82
+ # Copy over the default puma configuration.
83
+ copy_file 'config/puma.rb', 'config/puma.rb'
84
+ end
85
+
86
+ # Create Rakefiles
87
+ def create_rakefiles
88
+ rakefile 'start.rake' do
89
+ %Q{
90
+ task start: :environment do
91
+ system 'bundle exec rails server -b 127.0.0.1 -p 3000'
92
+ end
93
+ }
94
+ end
95
+ rakefile 'console.rake' do
96
+ %Q{
97
+ task console: :environment do
98
+ system 'bundle exec rails console'
99
+ end
100
+ }
101
+ end
102
+ end
103
+
104
+ # Run shopify_app:install and shopify_app:shop_model
105
+ def shopify_app_install
106
+ generate 'shopify_app:install'
107
+ generate 'shopify_app:shop_model'
108
+ end
109
+
110
+ # Set up initializers, overriding some of the defaults generated by shopify_app:install and shopify_app:shop_model
111
+ def setup_initializers
112
+ ['shopify_app', 'disco_app'].each do |initializer_name|
113
+ copy_file "initializers/#{initializer_name}.rb", "config/initializers/#{initializer_name}.rb"
114
+ end
115
+ end
116
+
117
+ # Set up models, overriding some of the defaults generated by shopify_app:install and shopify_app:shop_model
118
+ def setup_models
119
+ ['shop'].each do |model_name|
120
+ copy_file "models/#{model_name}.rb", "app/models/#{model_name}.rb"
121
+ end
122
+ end
123
+
124
+ # Set up default jobs.
125
+ def setup_jobs
126
+ ['app_installed', 'app_uninstalled', 'shop_update'].each do |job_name|
127
+ copy_file "jobs/#{job_name}_job.rb", "app/jobs/#{job_name}_job.rb"
128
+ end
129
+ end
130
+
131
+ # Set up routes.
132
+ def setup_routes
133
+ route "mount DiscoApp::Engine, at: '/'"
134
+ end
135
+
136
+ # Set up controllers.
137
+ def setup_controllers
138
+ ['home'].each do |controller_name|
139
+ copy_file "controllers/#{controller_name}_controller.rb", "app/controllers/#{controller_name}_controller.rb"
140
+ end
141
+ end
142
+
143
+ # Set up views.
144
+ def setup_views
145
+ ['layouts/application', 'layouts/embedded_app', 'home/index', 'sessions/new'].each do |view_name|
146
+ copy_file "views/#{view_name}.html.erb", "app/views/#{view_name}.html.erb"
147
+ end
148
+ end
149
+
150
+ # Set up assets.
151
+ def setup_assets
152
+ # Copy over our default assets.
153
+ ['javascripts/application.js', 'stylesheets/application.scss'].each do |asset_name|
154
+ copy_file "assets/#{asset_name}", "app/assets/#{asset_name}"
155
+ end
156
+
157
+ # Make sure application.css is removed.
158
+ remove_file 'app/assets/stylesheets/application.css'
159
+ end
160
+
161
+ # Copy engine migrations over.
162
+ def install_migrations
163
+ rake 'disco_app:install:migrations'
164
+ end
165
+
166
+ # Run migrations.
167
+ def migrate
168
+ rake 'db:migrate'
169
+ end
170
+
171
+ # Lock down the application to a specific Ruby version:
172
+ #
173
+ # - Via .ruby-version file for rbenv in development;
174
+ # - Via a Gemfile line in production.
175
+ #
176
+ # This should be the last operation, to allow all other operations to run in the initial Ruby version.
177
+ def set_ruby_version
178
+ copy_file 'root/.ruby-version', '.ruby-version'
179
+ prepend_to_file 'Gemfile', "ruby '2.2.2'\n"
180
+ end
181
+
182
+ end
@@ -0,0 +1,31 @@
1
+ module DiscoApp
2
+ module Generators
3
+ class ReactifyGenerator < Rails::Generators::Base
4
+
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ # Install the react-rails gem and run its setup.
8
+ def install_gem
9
+ # Add gem to Gemfile
10
+ gem 'react-rails', '~> 1.1.0'
11
+
12
+ # Install gem.
13
+ Bundler.with_clean_env do
14
+ run 'bundle install'
15
+ end
16
+
17
+ # Run the gem's generator.
18
+ generate 'react:install'
19
+ end
20
+
21
+ # Set application configuration
22
+ def configure_application
23
+ application "config.react.variant = :development", env: :development
24
+ application "# Use development variant of React in development.", env: :development
25
+ application "config.react.variant = :production", env: :production
26
+ application "# Use production variant of React in production.", env: :production
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,17 @@
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 turbolinks
16
+ //= require disco_app/disco_app
17
+ //= require_tree .
@@ -0,0 +1,5 @@
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
+ @import "disco_app/disco_app";
@@ -0,0 +1,15 @@
1
+ workers Integer(ENV['WEB_CONCURRENCY'] || 2)
2
+ threads_count = Integer(ENV['MAX_THREADS'] || 5)
3
+ threads threads_count, threads_count
4
+
5
+ preload_app!
6
+
7
+ rackup DefaultRackup
8
+ port ENV['PORT'] || 3000
9
+ environment ENV['RACK_ENV'] || 'development'
10
+
11
+ on_worker_boot do
12
+ # Worker specific setup for Rails 4.1+
13
+ # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
14
+ ActiveRecord::Base.establish_connection
15
+ end
@@ -0,0 +1,7 @@
1
+ class HomeController < ApplicationController
2
+ include DiscoApp::AuthenticatedController
3
+
4
+ def index
5
+ end
6
+
7
+ end
@@ -0,0 +1 @@
1
+ DiscoApp::Engine.routes.default_url_options[:host] = ENV['DEFAULT_HOST']
@@ -0,0 +1,6 @@
1
+ ShopifyApp.configure do |config|
2
+ config.api_key = ENV['SHOPIFY_APP_API_KEY']
3
+ config.secret = ENV['SHOPIFY_APP_SECRET']
4
+ config.scope = ENV['SHOPIFY_APP_SCOPE']
5
+ config.embedded_app = true
6
+ end
@@ -0,0 +1,2 @@
1
+ class AppInstalledJob < DiscoApp::AppInstalledJob
2
+ end
@@ -0,0 +1,2 @@
1
+ class AppUninstalledJob < DiscoApp::AppUninstalledJob
2
+ end
@@ -0,0 +1,2 @@
1
+ class ShopUpdateJob < DiscoApp::ShopUpdateJob
2
+ end
@@ -0,0 +1,3 @@
1
+ class Shop < ActiveRecord::Base
2
+ include DiscoApp::Shop
3
+ end
@@ -0,0 +1,2 @@
1
+ web: bundle exec puma -C ./config/puma.rb
2
+ worker: bundle exec sidekiq -c 5 -v
@@ -0,0 +1,2 @@
1
+ <% provide(:title, 'Welcome') %>
2
+ <h1>Welcome</h1>
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= yield(:title) %></title>
5
+
6
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
7
+
8
+ <%= csrf_meta_tags %>
9
+
10
+ <%= yield :extra_head %>
11
+ </head>
12
+ <body>
13
+
14
+ <%= yield %>
15
+
16
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
17
+ </body>
18
+ </html>
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= yield(:title) %></title>
5
+
6
+ <script src="//cdn.shopify.com/s/assets/external/app.js?<%= Time.now.strftime('%Y%m%d%H') %>"></script>
7
+ <script type="text/javascript">
8
+ ShopifyApp.init({
9
+ "apiKey": "<%= ShopifyApp.configuration.api_key %>",
10
+ "shopOrigin": "<%= "https://#{ @shop_session.url }" if @shop_session %>",
11
+ "debug": <%= Rails.env.development? ? 'true' : 'false' %>
12
+ });
13
+
14
+ ShopifyApp.ready(function() {
15
+ ShopifyApp.Bar.initialize({
16
+ title: "<%= yield(:title) %>"
17
+ });
18
+ });
19
+ </script>
20
+
21
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
22
+
23
+ <%= csrf_meta_tags %>
24
+
25
+ <%= yield :extra_head %>
26
+ </head>
27
+ <body>
28
+
29
+ <%= yield %>
30
+
31
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
32
+ </body>
33
+ </html>
@@ -0,0 +1,26 @@
1
+ <% provide(:title, 'Install') %>
2
+
3
+ <%= form_tag shopify_app.login_path do %>
4
+ <div class="modal-dialog">
5
+ <div class="modal-content">
6
+ <div class="modal-body">
7
+
8
+ <% flash.each do |message_type, message| %>
9
+ <div class="alert alert-<%= message_type %>"><%= message %></div>
10
+ <% end %>
11
+
12
+ <div class="form-group">
13
+ <div class="input-group">
14
+ <div class="input-group-addon">http://</div>
15
+ <input type="text" class="form-control" id="shop" name="shop" placeholder="your-store" autocomplete="off" autofocus="on" />
16
+ <div class="input-group-addon">.myshopify.com</div>
17
+ </div>
18
+ </div>
19
+
20
+ </div>
21
+ <div class="modal-footer">
22
+ <button type="submit" class="btn btn-primary">Install</button>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ <% end %>
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class DiscoAppTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, DiscoApp
6
+ end
7
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
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_tree .
@@ -0,0 +1,15 @@
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
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
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
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "disco_app"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
+ # config.time_zone = 'Central Time (US & Canada)'
17
+
18
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
+ # config.i18n.default_locale = :de
21
+
22
+ # Do not swallow errors in after_commit/after_rollback callbacks.
23
+ config.active_record.raise_in_transactional_callbacks = true
24
+ end
25
+ end
26
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3