payu-latam-rails 1.0.1

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 (83) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +53 -0
  3. data/.gitignore +9 -0
  4. data/.rubocop.yml +99 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE +21 -0
  7. data/README.md +42 -0
  8. data/app/controllers/pay_u_rails/webhooks_controller.rb +30 -0
  9. data/bin/console +7 -0
  10. data/bin/setup +7 -0
  11. data/config/routes.rb +4 -0
  12. data/lib/pay_u_rails/engine.rb +3 -0
  13. data/lib/pay_u_rails/errors.rb +2 -0
  14. data/lib/pay_u_rails/version.rb +3 -0
  15. data/lib/pay_u_rails.rb +25 -0
  16. data/payu-latam-rails.gemspec +34 -0
  17. data/spec/controllers/webhooks_controller_spec.rb +66 -0
  18. data/spec/dummy/.ruby-version +1 -0
  19. data/spec/dummy/Rakefile +6 -0
  20. data/spec/dummy/app/assets/config/manifest.js +4 -0
  21. data/spec/dummy/app/assets/images/.keep +0 -0
  22. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  23. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  24. data/spec/dummy/app/assets/javascripts/channels/.keep +0 -0
  25. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  26. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  27. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  28. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  29. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  30. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  31. data/spec/dummy/app/jobs/application_job.rb +2 -0
  32. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  33. data/spec/dummy/app/models/application_record.rb +3 -0
  34. data/spec/dummy/app/models/concerns/.keep +0 -0
  35. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  36. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  37. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  38. data/spec/dummy/bin/bundle +3 -0
  39. data/spec/dummy/bin/rails +4 -0
  40. data/spec/dummy/bin/rake +4 -0
  41. data/spec/dummy/bin/setup +36 -0
  42. data/spec/dummy/bin/update +31 -0
  43. data/spec/dummy/bin/yarn +11 -0
  44. data/spec/dummy/config/application.rb +24 -0
  45. data/spec/dummy/config/boot.rb +5 -0
  46. data/spec/dummy/config/cable.yml +10 -0
  47. data/spec/dummy/config/database.yml +25 -0
  48. data/spec/dummy/config/environment.rb +5 -0
  49. data/spec/dummy/config/environments/development.rb +61 -0
  50. data/spec/dummy/config/environments/production.rb +94 -0
  51. data/spec/dummy/config/environments/test.rb +44 -0
  52. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  53. data/spec/dummy/config/initializers/assets.rb +14 -0
  54. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  55. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  56. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  57. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  58. data/spec/dummy/config/initializers/inflections.rb +16 -0
  59. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  60. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  61. data/spec/dummy/config/locales/en.yml +33 -0
  62. data/spec/dummy/config/puma.rb +34 -0
  63. data/spec/dummy/config/routes.rb +3 -0
  64. data/spec/dummy/config/spring.rb +6 -0
  65. data/spec/dummy/config/storage.yml +34 -0
  66. data/spec/dummy/config.ru +5 -0
  67. data/spec/dummy/lib/assets/.keep +0 -0
  68. data/spec/dummy/log/.keep +0 -0
  69. data/spec/dummy/package.json +5 -0
  70. data/spec/dummy/public/404.html +67 -0
  71. data/spec/dummy/public/422.html +67 -0
  72. data/spec/dummy/public/500.html +66 -0
  73. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  74. data/spec/dummy/public/apple-touch-icon.png +0 -0
  75. data/spec/dummy/public/favicon.ico +0 -0
  76. data/spec/dummy/storage/.keep +0 -0
  77. data/spec/dummy/tmp/.keep +0 -0
  78. data/spec/dummy/tmp/storage/.keep +0 -0
  79. data/spec/fixtures/confirmation.rb +68 -0
  80. data/spec/fixtures/response.rb +46 -0
  81. data/spec/rails_helper.rb +3 -0
  82. data/spec/spec_helper.rb +31 -0
  83. metadata +360 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ab695588f47f805ae9fcfdbe6fe07a89c50825abef846f2b09d63dc9db197a57
4
+ data.tar.gz: bcbe0d7845ec27787fb738693b8c8fcddb5700f6e189e1ded84c6880af242c70
5
+ SHA512:
6
+ metadata.gz: 2ebdc92b65ec7c01afd049691bc8a725fa0b2f68ea4b3f064f3a7023c6f1798f4c2e3ce50e863250b8cacc56caa2b3c33c5e334f927b4475b898046c5e26176a
7
+ data.tar.gz: 8883e768b586fc78965dc3382a4d56d82a788fdc0210b56ec401169d19f19a54c3d924aea46720724bb2c1e93b21cc3bb4d44e4eb5548b4e2bb4348192d2a479
@@ -0,0 +1,53 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+ jobs:
7
+ build:
8
+ docker:
9
+ # specify the version you desire here
10
+ - image: circleci/ruby:2.4.1-node-browsers
11
+
12
+ # Specify service dependencies here if necessary
13
+ # CircleCI maintains a library of pre-built images
14
+ # documented at https://circleci.com/docs/2.0/circleci-images/
15
+ # - image: circleci/postgres:9.4
16
+
17
+ working_directory: ~/repo
18
+
19
+ steps:
20
+ - checkout
21
+
22
+ # Download and cache dependencies
23
+ - restore_cache:
24
+ keys:
25
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
26
+ # fallback to using the latest cache if no exact match is found
27
+ - v1-dependencies-
28
+
29
+ - run:
30
+ name: install dependencies
31
+ command: |
32
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
33
+
34
+ - save_cache:
35
+ paths:
36
+ - ./vendor/bundle
37
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
38
+
39
+ # run tests!
40
+ - run:
41
+ name: run tests
42
+ command: |
43
+ mkdir /tmp/test-results
44
+ TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
45
+
46
+ bundle exec rspec --format progress --format RspecJunitFormatter --out /tmp/test-results/rspec.xml $TEST_FILES
47
+
48
+ # collect reports
49
+ - store_test_results:
50
+ path: /tmp/test-results
51
+ - store_artifacts:
52
+ path: /tmp/test-results
53
+ destination: test-results
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /payu-latam-rails-*.gem
2
+ /Gemfile.lock
3
+ .rvmrc
4
+ Gemfile.lock
5
+ tags
6
+ /.bundle/
7
+ coverage/
8
+ .rspec_status
9
+ spec/dummy/log/*.log
data/.rubocop.yml ADDED
@@ -0,0 +1,99 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.1
3
+
4
+ Naming/PredicateName:
5
+ Enabled: false
6
+
7
+ Layout/IndentHash:
8
+ EnforcedStyle: consistent
9
+
10
+ Layout/AlignHash:
11
+ EnforcedLastArgumentHashStyle: ignore_implicit
12
+
13
+ Style/Documentation:
14
+ Enabled: false
15
+
16
+ Style/FrozenStringLiteralComment:
17
+ Enabled: false
18
+
19
+ Layout/IndentArray:
20
+ EnforcedStyle: consistent
21
+
22
+ Style/SymbolArray:
23
+ EnforcedStyle: brackets
24
+
25
+ Style/WordArray:
26
+ EnforcedStyle: brackets
27
+
28
+ Style/ClassAndModuleChildren:
29
+ EnforcedStyle: compact
30
+
31
+ Layout/SpaceInsideHashLiteralBraces:
32
+ Enabled: true
33
+ EnforcedStyle: no_space
34
+
35
+ Style/IfUnlessModifier:
36
+ Enabled: false
37
+
38
+ Style/StringLiterals:
39
+ EnforcedStyle: double_quotes
40
+
41
+ Style/Lambda:
42
+ Enabled: false
43
+
44
+ Layout/MultilineOperationIndentation:
45
+ EnforcedStyle: indented
46
+
47
+ Layout/MultilineMethodCallIndentation:
48
+ EnforcedStyle: indented
49
+
50
+ Layout/AlignParameters:
51
+ EnforcedStyle: with_fixed_indentation
52
+
53
+ Layout/EmptyLineBetweenDefs:
54
+ NumberOfEmptyLines: 2
55
+
56
+ Layout/EmptyLines:
57
+ Enabled: false
58
+
59
+ Style/TrailingCommaInArrayLiteral:
60
+ EnforcedStyleForMultiline: comma
61
+
62
+ Style/TrailingCommaInHashLiteral:
63
+ EnforcedStyleForMultiline: comma
64
+
65
+ Style/TrailingCommaInArguments:
66
+ EnforcedStyleForMultiline: comma
67
+
68
+ Style/ClassAndModuleChildren:
69
+ EnforcedStyle: compact
70
+
71
+ Metrics/ParameterLists:
72
+ Max: 5
73
+
74
+ Metrics/BlockLength:
75
+ Max: 50
76
+
77
+ Metrics/MethodLength:
78
+ Max: 50
79
+
80
+ Metrics/ClassLength:
81
+ Max: 200
82
+
83
+ Metrics/ModuleLength:
84
+ Max: 200
85
+
86
+ Metrics/CyclomaticComplexity:
87
+ Max: 30
88
+
89
+ Metrics/PerceivedComplexity:
90
+ Max: 30
91
+
92
+ Metrics/AbcSize:
93
+ Max: 30
94
+
95
+ Metrics/LineLength:
96
+ Max: 100
97
+
98
+ Style/AccessModifierDeclarations:
99
+ EnforcedStyle: inline
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Lengio Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # PayU Latam Rails Library
2
+
3
+ ## Installation
4
+
5
+ gem "payu-latam-rails", github: "lengio/payu-latam-rails", require: "pay_u_rails"
6
+
7
+ # Local
8
+ gem build payu-latam-rails.gemspec
9
+
10
+ ## Subscribing with blocks
11
+
12
+ ```ruby
13
+ PayURails.subscribe(PayURails::Confirmation::EVENT) do |confirmation|
14
+ # Do something with PayU::Confirmation object
15
+ end
16
+
17
+ PayURails.subscribe(PayURails::Response::EVENT) do |response|
18
+ # Do something with PayU::Response object
19
+ end
20
+
21
+ ```
22
+
23
+ ## Subscribing with objects
24
+
25
+ ```ruby
26
+ class Subscriber
27
+ def call(confirmation)
28
+ # Do something with PayU::Confirmation object
29
+ end
30
+ end
31
+
32
+ PayURails.subscribe(PayURails::Confirmation::EVENT, Subscriber.new)
33
+
34
+ ```
35
+
36
+ ## Testing
37
+
38
+ rspec
39
+
40
+ ## Console
41
+
42
+ bin/console
@@ -0,0 +1,30 @@
1
+ class PayURails::WebhooksController < ActionController::Base
2
+ rescue_from PayURails::SignatureVerificationError, with: :unverified
3
+
4
+ def confirmation
5
+ process_webhook(resource_class: PayU::Confirmation)
6
+ end
7
+
8
+
9
+ def response_page
10
+ process_webhook(resource_class: PayU::Response)
11
+ end
12
+
13
+
14
+ private def process_webhook(resource_class:)
15
+ resource = validate(resource: resource_class.new(params))
16
+
17
+ PayURails.instrument(resource_class::EVENT, resource: resource)
18
+
19
+ head :ok
20
+ rescue PayURails::SignatureVerificationError
21
+ head :unauthorized
22
+ end
23
+
24
+
25
+ private def validate(resource:)
26
+ raise PayURails::SignatureVerificationError unless resource.valid?
27
+
28
+ resource
29
+ end
30
+ end
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pay_u_rails"
5
+
6
+ require "pry"
7
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+ IFS=$'\n\t'
5
+ set -vx
6
+
7
+ bundle install
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ PayURails::Engine.routes.draw do
2
+ post :confirmation, to: "webhooks#confirmation"
3
+ get :response, to: "webhooks#response_page"
4
+ end
@@ -0,0 +1,3 @@
1
+ class PayURails::Engine < ::Rails::Engine
2
+ isolate_namespace PayURails
3
+ end
@@ -0,0 +1,2 @@
1
+ class PayURails::SignatureVerificationError < StandardError
2
+ end
@@ -0,0 +1,3 @@
1
+ module PayURails
2
+ VERSION = "1.0.1".freeze
3
+ end
@@ -0,0 +1,25 @@
1
+ require "pay_u"
2
+
3
+ require "pay_u_rails/errors"
4
+ require "pay_u_rails/engine" if defined?(Rails)
5
+
6
+ module PayURails
7
+ class Confirmation
8
+ EVENT = PayU::Confirmation::EVENT
9
+ end
10
+
11
+ class Response
12
+ EVENT = PayU::Response::EVENT
13
+ end
14
+
15
+ def self.instrument(event, payload)
16
+ ActiveSupport::Notifications.instrument(event, payload)
17
+ end
18
+
19
+
20
+ def self.subscribe(event, callable = Proc.new)
21
+ ActiveSupport::Notifications.subscribe(event) do |*args|
22
+ callable.call(args.extract_options![:resource])
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,34 @@
1
+ $LOAD_PATH.unshift(::File.join(::File.dirname(__FILE__), "lib"))
2
+
3
+ require "pay_u_rails/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "payu-latam-rails"
7
+ spec.version = PayURails::VERSION
8
+ spec.required_ruby_version = ">= 2.1.0"
9
+ spec.summary = "Rails webhooks PayU Latam"
10
+ spec.description = "Accept payments with PayU Latam: http://developerspec.payulatam.com/es/."
11
+ spec.author = "Slang"
12
+ spec.email = "engineering@slang.com"
13
+ spec.homepage = "https://slangapp.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.add_dependency "activesupport", ">= 3.1"
17
+ spec.add_dependency "payu-latam", "1.0.1"
18
+
19
+ spec.add_development_dependency "byebug", "~> 10.0"
20
+ spec.add_development_dependency "coveralls", "~> 0"
21
+ spec.add_development_dependency "pry", "~> 0.12"
22
+ spec.add_development_dependency "pry-byebug", "~> 3.6"
23
+ spec.add_development_dependency "rails", [">= 3.1"]
24
+ spec.add_development_dependency "rake", "< 11.0"
25
+ spec.add_development_dependency "rspec-rails", "~> 3.7"
26
+ spec.add_development_dependency "rspec_junit_formatter", "~> 0"
27
+ spec.add_development_dependency "rubocop", "0.57"
28
+ spec.add_development_dependency "webmock", "~> 1.9"
29
+
30
+ spec.files = `git ls-files`.split("\n")
31
+ spec.test_files = `git ls-files -- spec/*`.split("\n")
32
+ spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| ::File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+ end
@@ -0,0 +1,66 @@
1
+ require "rails_helper"
2
+ require "spec_helper"
3
+ require "fixtures/confirmation"
4
+ require "fixtures/response"
5
+
6
+ RSpec.describe PayURails::WebhooksController, type: :controller do
7
+ routes { PayURails::Engine.routes }
8
+
9
+ before(:all) do
10
+ @confirmations = []
11
+ @responses = []
12
+
13
+ PayURails.subscribe(PayURails::Confirmation::EVENT) do |confirmation|
14
+ @confirmations << confirmation
15
+ end
16
+
17
+ PayURails.subscribe(PayURails::Response::EVENT) do |response|
18
+ @responses << response
19
+ end
20
+ end
21
+
22
+ context "incorrect signature" do
23
+ it "returns unauthorized status" do
24
+ post :confirmation, params: Fixtures.confirmation.merge(sign: "")
25
+
26
+ expect(response).to have_http_status(:unauthorized)
27
+ end
28
+ end
29
+
30
+ context "correct signature" do
31
+ it "returns ok and instruments event on confirmation" do
32
+ params = Fixtures.confirmation
33
+ confirmation = PayU::Confirmation.new(params)
34
+
35
+ post :confirmation, params: params
36
+
37
+ expect(response).to have_http_status(:ok)
38
+ expect(@confirmations.last.order).to have_attributes(
39
+ amount: confirmation.order.amount,
40
+ reference_code: confirmation.order.reference_code,
41
+ )
42
+ end
43
+
44
+ it "returns ok and instruments event on response" do
45
+ params = Fixtures.response
46
+ response_obj = PayU::Response.new(params)
47
+
48
+ get :response_page, params: Fixtures.response
49
+
50
+ expect(response).to have_http_status(:ok)
51
+ expect(@responses.last.order).to have_attributes(
52
+ amount: response_obj.order.amount,
53
+ reference_code: response_obj.order.reference_code,
54
+ )
55
+ end
56
+
57
+ it "calls #call method when subscribing with object" do
58
+ subscriber = spy("subscriber")
59
+ PayURails.subscribe(PayURails::Confirmation::EVENT, subscriber)
60
+
61
+ post :confirmation, params: Fixtures.confirmation
62
+
63
+ expect(subscriber).to have_received(:call)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1 @@
1
+ ruby-2.4.0
@@ -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_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,4 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
4
+ //= link pay_u_manifest.js
File without changes
@@ -0,0 +1,15 @@
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. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require rails-ujs
14
+ //= require activestorage
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the `rails generate channel` command.
3
+ //
4
+ //= require action_cable
5
+ //= require_self
6
+ //= require_tree ./channels
7
+
8
+ (function() {
9
+ this.App || (this.App = {});
10
+
11
+ App.cable = ActionCable.createConsumer();
12
+
13
+ }).call(this);
File without changes
@@ -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 other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
File without changes
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all' %>
9
+ <%= javascript_include_tag 'application' %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
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,36 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a starting point to setup your application.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ # puts "\n== Copying sample files =="
24
+ # unless File.exist?('config/database.yml')
25
+ # cp 'config/database.yml.sample', 'config/database.yml'
26
+ # end
27
+
28
+ puts "\n== Preparing database =="
29
+ system! 'bin/rails db:setup'
30
+
31
+ puts "\n== Removing old logs and tempfiles =="
32
+ system! 'bin/rails log:clear tmp:clear'
33
+
34
+ puts "\n== Restarting application server =="
35
+ system! 'bin/rails restart'
36
+ end
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a way to update your development environment automatically.
14
+ # Add necessary update steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ puts "\n== Updating database =="
24
+ system! 'bin/rails db:migrate'
25
+
26
+ puts "\n== Removing old logs and tempfiles =="
27
+ system! 'bin/rails log:clear tmp:clear'
28
+
29
+ puts "\n== Restarting application server =="
30
+ system! 'bin/rails restart'
31
+ end