aws_tickwork 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +30 -0
  5. data/app/assets/javascripts/aws_tickwork/application.js +13 -0
  6. data/app/assets/stylesheets/aws_tickwork/application.css +15 -0
  7. data/app/controllers/aws_tickwork/application_controller.rb +5 -0
  8. data/app/controllers/aws_tickwork/sns_endpoint_controller.rb +40 -0
  9. data/app/helpers/aws_tickwork/application_helper.rb +4 -0
  10. data/app/models/aws_tickwork/db_data_store.rb +23 -0
  11. data/app/views/layouts/aws_tickwork/application.html.erb +14 -0
  12. data/config/routes.rb +4 -0
  13. data/db/migrate/20160510025747_create_aws_tickwork_db_data_stores.rb +11 -0
  14. data/lib/aws_tickwork.rb +4 -0
  15. data/lib/aws_tickwork/engine.rb +13 -0
  16. data/lib/aws_tickwork/version.rb +3 -0
  17. data/lib/tasks/aws_tickwork_tasks.rake +4 -0
  18. data/spec/controllers/aws_tickwork/sns_endpoint_controller_spec.rb +88 -0
  19. data/spec/dummy/README.rdoc +28 -0
  20. data/spec/dummy/Rakefile +6 -0
  21. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  22. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  23. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  24. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  25. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  26. data/spec/dummy/bin/bundle +3 -0
  27. data/spec/dummy/bin/rails +4 -0
  28. data/spec/dummy/bin/rake +4 -0
  29. data/spec/dummy/bin/setup +29 -0
  30. data/spec/dummy/config.ru +4 -0
  31. data/spec/dummy/config/application.rb +26 -0
  32. data/spec/dummy/config/boot.rb +5 -0
  33. data/spec/dummy/config/database.yml +25 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +41 -0
  36. data/spec/dummy/config/environments/production.rb +79 -0
  37. data/spec/dummy/config/environments/test.rb +42 -0
  38. data/spec/dummy/config/initializers/assets.rb +11 -0
  39. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  41. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  42. data/spec/dummy/config/initializers/inflections.rb +16 -0
  43. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  44. data/spec/dummy/config/initializers/session_store.rb +3 -0
  45. data/spec/dummy/config/initializers/tickwork.rb +16 -0
  46. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  47. data/spec/dummy/config/locales/en.yml +23 -0
  48. data/spec/dummy/config/routes.rb +4 -0
  49. data/spec/dummy/config/secrets.yml +22 -0
  50. data/spec/dummy/db/schema.rb +25 -0
  51. data/spec/dummy/db/test.sqlite3 +0 -0
  52. data/spec/dummy/log/development.log +133 -0
  53. data/spec/dummy/log/test.log +1572 -0
  54. data/spec/dummy/public/404.html +67 -0
  55. data/spec/dummy/public/422.html +67 -0
  56. data/spec/dummy/public/500.html +66 -0
  57. data/spec/dummy/public/favicon.ico +0 -0
  58. data/spec/dummy/tmp/cache/14A/870/key +1 -0
  59. data/spec/dummy/tmp/cache/6CC/EF0/tickwork_testing +1 -0
  60. data/spec/factories/aws_tickwork_db_data_stores.rb +17 -0
  61. data/spec/models/aws_tickwork/db_data_store_spec.rb +55 -0
  62. data/spec/rails_helper.rb +60 -0
  63. data/spec/requests/sns_notifications_spec.rb +29 -0
  64. data/spec/spec_helper.rb +95 -0
  65. metadata +281 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 27fc9e95db8e3177a21fe541527aaa3eff1ea249
4
+ data.tar.gz: e44457098e3c1164c73d1bc29ea887d16d4c2fea
5
+ SHA512:
6
+ metadata.gz: 5809eee9e8f8348f5657c108dde4d5273c206cc903e70de43e287cc324ba06e134db11a3017e0c15efffcc7203d491b345b7a1aa94a461f06ab6e7f8531bd766
7
+ data.tar.gz: b6551a70a5c22f7f5e1864b071d81f3e60d5bc10c29b11e2cdb308e0c7308ad7afa1f06fa5d6bd3751c71a995845ec708105302289417d1eb5426e60cb3e4af2
@@ -0,0 +1,20 @@
1
+ Copyright 2016
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = AwsTickwork
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,30 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'AwsTickwork'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
24
+ require 'rspec/core'
25
+ require 'rspec/core/rake_task'
26
+
27
+ desc "Run all specs in spec directory (excluding plugin specs)"
28
+ RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
29
+
30
+ task default: :spec
@@ -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
+ module AwsTickwork
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ require_dependency "aws_tickwork/application_controller"
2
+ require 'rest-client'
3
+ require 'tickwork'
4
+
5
+ module AwsTickwork
6
+ class SnsEndpointController < ApplicationController
7
+ before_action :log_raw_post
8
+ def notify
9
+ body = JSON.parse(request.raw_post)
10
+ # TODO verify aws signature
11
+ if body["Type"] == "SubscriptionConfirmation"
12
+ handle_subscription_confirmation(body)
13
+ elsif body["Type"] == "Notification"
14
+ handle_notification(body)
15
+ end
16
+
17
+ head :ok
18
+ end
19
+
20
+ protected
21
+ def handle_notification(body)
22
+ Tickwork.run
23
+ end
24
+
25
+ def handle_subscription_confirmation(body)
26
+ url = body["SubscribeURL"]
27
+ return unless url.present?
28
+ begin
29
+ RestClient.get url
30
+ rescue => e
31
+ #TODO what exception come here?
32
+ raise
33
+ end
34
+ end
35
+
36
+ def log_raw_post
37
+ Rails.logger.info request.raw_post
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,4 @@
1
+ module AwsTickwork
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,23 @@
1
+ # == Schema Information
2
+ #
3
+ # Table name: aws_tickwork_db_data_stores
4
+ #
5
+ # id :integer not null, primary key
6
+ # key :string not null
7
+ # value :integer
8
+ # created_at :datetime not null
9
+ # updated_at :datetime not null
10
+ #
11
+
12
+ module AwsTickwork
13
+ class DbDataStore < ActiveRecord::Base
14
+ class << self
15
+ def read(key)
16
+ DbDataStore.where(key: key).take&.value
17
+ end
18
+ def write(key, value)
19
+ DbDataStore.find_or_initialize_by(key: key).update_attributes!(value: value)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>AwsTickwork</title>
5
+ <%= stylesheet_link_tag "aws_tickwork/application", media: "all" %>
6
+ <%= javascript_include_tag "aws_tickwork/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ AwsTickwork::Engine.routes.draw do
2
+ post 'sns_endpoint/notify'
3
+
4
+ end
@@ -0,0 +1,11 @@
1
+ class CreateAwsTickworkDbDataStores < ActiveRecord::Migration
2
+ def change
3
+ create_table :aws_tickwork_db_data_stores do |t|
4
+ t.string :key, null: false
5
+ t.integer :value
6
+
7
+ t.timestamps null: false
8
+ end
9
+ add_index :aws_tickwork_db_data_stores, :key, unique: true
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ require "aws_tickwork/engine"
2
+
3
+ module AwsTickwork
4
+ end
@@ -0,0 +1,13 @@
1
+ module AwsTickwork
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace AwsTickwork
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec, fixture: false
7
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
8
+ g.assets false
9
+ g.helper false
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module AwsTickwork
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :aws_tickwork do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,88 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe AwsTickwork::SnsEndpointController do
4
+ routes { AwsTickwork::Engine.routes }
5
+ describe "#notify" do
6
+ describe "subscription_confirmation" do
7
+ let(:sample_post) do
8
+ sample = <<-END
9
+ {
10
+ "Type" : "SubscriptionConfirmation",
11
+ "MessageId" : "bec4717a-b9c0-4e26-b8a1-687e624f5c5b",
12
+ "Token" : "2336412f37fb687f5d51e6e241d44a2cb136210ba5740edb1677bedf5b391f309278d834dd116c60cc79f83cd406f74a72fdcd59e1a0440811f2b4772e9a91e01a0777dc0bf63e351b0af514d3bf5dc583f9fcbef3b1bee87a7081b16f0524807e9f6abf67a7378fba68bac711e8c830d7ad7e86c51059bae43780296dfdb228",
13
+ "TopicArn" : "arn:aws:sns:us-east-1:372178782529:Lancaster-Staging",
14
+ "Message" : "You have chosen to subscribe to the topic arn:aws:sns:us-east-1:372178782529:Lancaster-Staging.\nTo confirm the subscription, visit the SubscribeURL included in this message.",
15
+ "SubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-east-1:372178782529:Lancaster-Staging&Token=2336412f37fb687f5d51e6e241d44a2cb136210ba5740edb1677bedf5b391f309278d834dd116c60cc79f83cd406f74a72fdcd59e1a0440811f2b4772e9a91e01a0777dc0bf63e351b0af514d3bf5dc583f9fcbef3b1bee87a7081b16f0524807e9f6abf67a7378fba68bac711e8c830d7ad7e86c51059bae43780296dfdb228",
16
+ "Timestamp" : "2016-05-08T17:43:51.780Z",
17
+ "SignatureVersion" : "1",
18
+ "Signature" : "QOq0trJAXigt6v71lCqYdmv4DKYT/fAuWijUz7UHYTfSYrKl3CXki0VCZmYMhkKVS3Ki4dgtZFA4MtrB9XQindyQgcKuWQZo1/7Ena4I33lKpqkOEV8F/RiFCfFnpYxBF57Rv0mV1Z0fhbAAsxAMLoYFIq78U0eai74n0GD6kucK5sN4Bcr5VguZYoTsEXMZyA5eZItP0YN2QEUC/yh0SjuC/AkKv/wohV8jJr+K9tqva+zPWzgWpNLouGJ6PGfbSH+5nrxSqKvrT9JMiq3cqdyVVXl3Ds3KGki6/ZAb6c4UZGI3Pup+7DO68Ep8DPjMEhtnd5K+HZIVBWbmEEoB2g==",
19
+ "SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem"
20
+ }
21
+ END
22
+ sample.squish
23
+ end
24
+ before do
25
+ @stub_get = stub_request(:get, "https://sns.us-east-1.amazonaws.com/?Action=ConfirmSubscription&Token=2336412f37fb687f5d51e6e241d44a2cb136210ba5740edb1677bedf5b391f309278d834dd116c60cc79f83cd406f74a72fdcd59e1a0440811f2b4772e9a91e01a0777dc0bf63e351b0af514d3bf5dc583f9fcbef3b1bee87a7081b16f0524807e9f6abf67a7378fba68bac711e8c830d7ad7e86c51059bae43780296dfdb228&TopicArn=arn:aws:sns:us-east-1:372178782529:Lancaster-Staging").
26
+ with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
27
+ to_return(:status => 200, :body => "", :headers => {})
28
+ end
29
+ it "responds ok" do
30
+ post :notify, sample_post
31
+ response.should be_ok
32
+ end
33
+ it "confirms the subjscription" do
34
+ post :notify, sample_post
35
+ assert_requested(@stub_get)
36
+ end
37
+ end
38
+ describe "unrecognized" do
39
+ let(:sample_post) do
40
+ sample = <<-END
41
+ {
42
+ "Type" : "This is not a real type",
43
+ "MessageId" : "bec4717a-b9c0-4e26-b8a1-687e624f5c5b",
44
+ "Token" : "2336412f37fb687f5d51e6e241d44a2cb136210ba5740edb1677bedf5b391f309278d834dd116c60cc79f83cd406f74a72fdcd59e1a0440811f2b4772e9a91e01a0777dc0bf63e351b0af514d3bf5dc583f9fcbef3b1bee87a7081b16f0524807e9f6abf67a7378fba68bac711e8c830d7ad7e86c51059bae43780296dfdb228",
45
+ "TopicArn" : "arn:aws:sns:us-east-1:372178782529:Lancaster-Staging",
46
+ "Message" : "You have chosen to subscribe to the topic arn:aws:sns:us-east-1:372178782529:Lancaster-Staging.\nTo confirm the subscription, visit the SubscribeURL included in this message.",
47
+ "SubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-east-1:372178782529:Lancaster-Staging&Token=2336412f37fb687f5d51e6e241d44a2cb136210ba5740edb1677bedf5b391f309278d834dd116c60cc79f83cd406f74a72fdcd59e1a0440811f2b4772e9a91e01a0777dc0bf63e351b0af514d3bf5dc583f9fcbef3b1bee87a7081b16f0524807e9f6abf67a7378fba68bac711e8c830d7ad7e86c51059bae43780296dfdb228",
48
+ "Timestamp" : "2016-05-08T17:43:51.780Z",
49
+ "SignatureVersion" : "1",
50
+ "Signature" : "QOq0trJAXigt6v71lCqYdmv4DKYT/fAuWijUz7UHYTfSYrKl3CXki0VCZmYMhkKVS3Ki4dgtZFA4MtrB9XQindyQgcKuWQZo1/7Ena4I33lKpqkOEV8F/RiFCfFnpYxBF57Rv0mV1Z0fhbAAsxAMLoYFIq78U0eai74n0GD6kucK5sN4Bcr5VguZYoTsEXMZyA5eZItP0YN2QEUC/yh0SjuC/AkKv/wohV8jJr+K9tqva+zPWzgWpNLouGJ6PGfbSH+5nrxSqKvrT9JMiq3cqdyVVXl3Ds3KGki6/ZAb6c4UZGI3Pup+7DO68Ep8DPjMEhtnd5K+HZIVBWbmEEoB2g==",
51
+ "SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem"
52
+ }
53
+ END
54
+ sample.squish
55
+ end
56
+ it "returns ok" do
57
+ post :notify, sample_post
58
+ response.should be_ok
59
+ end
60
+ end
61
+ describe "Notification" do
62
+ let (:sample_notification) do
63
+ sample = <<-END
64
+ {
65
+ "Type" : "Notification",
66
+ "MessageId" : "36313258-6c80-508f-a5ae-7df1cb7989f4",
67
+ "TopicArn" : "arn:aws:sns:us-east-1:372178782529:Lancaster-Staging",
68
+ "Message" : "{\\"version\\":\\"0\\",\\"id\\":\\"5f548e63-40c1-4558-bade-4afca3c44f79\\",\\"detail-type\\":\\"Scheduled Event\\",\\"source\\":\\"aws.events\\",\\"account\\":\\"372178782529\\",\\"time\\":\\"2016-05-08T20:46:47Z\\",\\"region\\":\\"us-east-1\\",\\"resources\\":[\\"arn:aws:events:us-east-1:372178782529:rule/MinutelyTester\\"],\\"detail\\":{}}",
69
+ "Timestamp" : "2016-05-08T20:46:49.740Z",
70
+ "SignatureVersion" : "1",
71
+ "Signature" : "K7TXqlxTdmrlVObK4rLjPWDYqgf+2b6SITBPX3GNsSMizsr+A0UUG07kuCPTRnpLtVc0PHqgPq3qdqcV/TyraXFnxhxh6WA1gQyPgeoozpwFFQ8a+c0XsqZ8aPx35QV0eRUntY4HlAcB8bm5NSYK4c49ndyo0Yl013sjVyS/WDYWNWxQllhRMWvNrtl1ye95LNNMWL89RvNJLQpolYYpVb6me+9e+Y3u9eo9eg1KmTGg2C6f+IPJCHGPMgXNp0qzsl2lA4bZqQ+qwkGllvnq7JCTSZB5AJ+HmG/m8Q8TXEi5tcB8qGU70jaMdVl+Rrk7qzw0lfWPZ6y8Xf0fbhQ1oA==",
72
+ "SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem",
73
+ "UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:372178782529:Lancaster-Staging:44d97b9e-a40f-4a82-9077-ba24faec9227"
74
+ }
75
+ END
76
+ sample.squish
77
+ end
78
+ it "responds ok" do
79
+ post :notify, sample_notification
80
+ response.should be_ok
81
+ end
82
+ it "runs Tickwork" do
83
+ expect(Tickwork).to receive(:run)
84
+ post :notify, sample_notification
85
+ end
86
+ end
87
+ end
88
+ 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