google_sign_in 1.2.0 → 1.3.0

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.

Potentially problematic release.


This version of google_sign_in might be problematic. Click here for more details.

Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -2
  3. data/app/controllers/google_sign_in/authorizations_controller.rb +1 -1
  4. data/app/controllers/google_sign_in/base_controller.rb +1 -8
  5. data/app/controllers/google_sign_in/callbacks_controller.rb +8 -1
  6. data/lib/google_sign_in/engine.rb +14 -5
  7. data/lib/google_sign_in/redirect_protector.rb +5 -2
  8. data/lib/google_sign_in.rb +15 -1
  9. metadata +7 -201
  10. data/.gitignore +0 -13
  11. data/.travis.yml +0 -18
  12. data/CHANGELOG.md +0 -3
  13. data/Gemfile +0 -6
  14. data/Gemfile.lock +0 -158
  15. data/Rakefile +0 -40
  16. data/bin/rails +0 -16
  17. data/google_sign_in.gemspec +0 -22
  18. data/test/certificate.pem +0 -19
  19. data/test/controllers/authorizations_controller_test.rb +0 -26
  20. data/test/controllers/callbacks_controller_test.rb +0 -133
  21. data/test/dummy/.ruby-version +0 -1
  22. data/test/dummy/Rakefile +0 -6
  23. data/test/dummy/app/assets/config/manifest.js +0 -3
  24. data/test/dummy/app/assets/images/.keep +0 -0
  25. data/test/dummy/app/assets/javascripts/application.js +0 -15
  26. data/test/dummy/app/assets/javascripts/cable.js +0 -13
  27. data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
  28. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  29. data/test/dummy/app/channels/application_cable/channel.rb +0 -4
  30. data/test/dummy/app/channels/application_cable/connection.rb +0 -4
  31. data/test/dummy/app/controllers/application_controller.rb +0 -2
  32. data/test/dummy/app/controllers/concerns/.keep +0 -0
  33. data/test/dummy/app/helpers/application_helper.rb +0 -2
  34. data/test/dummy/app/jobs/application_job.rb +0 -2
  35. data/test/dummy/app/mailers/application_mailer.rb +0 -4
  36. data/test/dummy/app/models/application_record.rb +0 -3
  37. data/test/dummy/app/models/concerns/.keep +0 -0
  38. data/test/dummy/app/views/layouts/application.html.erb +0 -15
  39. data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
  40. data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
  41. data/test/dummy/bin/bundle +0 -3
  42. data/test/dummy/bin/rails +0 -4
  43. data/test/dummy/bin/rake +0 -4
  44. data/test/dummy/bin/setup +0 -36
  45. data/test/dummy/bin/update +0 -31
  46. data/test/dummy/bin/yarn +0 -11
  47. data/test/dummy/config/application.rb +0 -20
  48. data/test/dummy/config/boot.rb +0 -5
  49. data/test/dummy/config/cable.yml +0 -10
  50. data/test/dummy/config/database.yml +0 -25
  51. data/test/dummy/config/environment.rb +0 -5
  52. data/test/dummy/config/environments/development.rb +0 -32
  53. data/test/dummy/config/environments/production.rb +0 -57
  54. data/test/dummy/config/environments/test.rb +0 -33
  55. data/test/dummy/config/initializers/application_controller_renderer.rb +0 -8
  56. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  57. data/test/dummy/config/initializers/content_security_policy.rb +0 -25
  58. data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
  59. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  60. data/test/dummy/config/initializers/google_sign_in.rb +0 -4
  61. data/test/dummy/config/initializers/inflections.rb +0 -16
  62. data/test/dummy/config/initializers/mime_types.rb +0 -4
  63. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  64. data/test/dummy/config/locales/en.yml +0 -33
  65. data/test/dummy/config/puma.rb +0 -34
  66. data/test/dummy/config/routes.rb +0 -2
  67. data/test/dummy/config/spring.rb +0 -6
  68. data/test/dummy/config/storage.yml +0 -34
  69. data/test/dummy/config.ru +0 -5
  70. data/test/dummy/db/test.sqlite3 +0 -0
  71. data/test/dummy/lib/assets/.keep +0 -0
  72. data/test/dummy/log/.keep +0 -0
  73. data/test/dummy/package.json +0 -5
  74. data/test/dummy/public/404.html +0 -67
  75. data/test/dummy/public/422.html +0 -67
  76. data/test/dummy/public/500.html +0 -66
  77. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  78. data/test/dummy/public/apple-touch-icon.png +0 -0
  79. data/test/dummy/public/favicon.ico +0 -0
  80. data/test/dummy/storage/.keep +0 -0
  81. data/test/dummy/tmp/.keep +0 -0
  82. data/test/dummy/tmp/storage/.keep +0 -0
  83. data/test/helpers/button_helper_test.rb +0 -36
  84. data/test/key.pem +0 -27
  85. data/test/models/identity_test.rb +0 -88
  86. data/test/models/redirect_protector_test.rb +0 -40
  87. data/test/test_helper.rb +0 -28
data/Rakefile DELETED
@@ -1,40 +0,0 @@
1
- require "bundler/setup"
2
- require "bundler/gem_tasks"
3
- require "rake/testtask"
4
-
5
- Rake::TestTask.new do |test|
6
- test.libs << "test"
7
- test.test_files = FileList["test/**/*_test.rb"]
8
- test.warning = false
9
- end
10
-
11
- task default: :test
12
-
13
- desc "Generates an X509 certificate for decoding test ID tokens"
14
- task "test:certificate:generate" do
15
- require "openssl"
16
- require "active_support"
17
- require "active_support/core_ext/integer/time"
18
-
19
- key = OpenSSL::PKey::RSA.new(File.read(File.expand_path("test/key.pem", __dir__)))
20
-
21
- certificate = OpenSSL::X509::Certificate.new
22
- certificate.subject = certificate.issuer = OpenSSL::X509::Name.parse("/CN=google-sign-in-for-rails.example.com")
23
- certificate.not_before = Time.now
24
- certificate.not_after = 5.years.from_now
25
- certificate.public_key = key.public_key
26
- certificate.serial = 0
27
- certificate.version = 1
28
-
29
- extension_factory = OpenSSL::X509::ExtensionFactory.new
30
- extension_factory.subject_certificate = certificate
31
- extension_factory.issuer_certificate = certificate
32
- certificate.extensions = [
33
- extension_factory.create_extension("basicConstraints", "CA:FALSE", true),
34
- extension_factory.create_extension("keyUsage", "digitalSignature", true),
35
- extension_factory.create_extension("extendedKeyUsage", "clientAuth", true)
36
- ]
37
-
38
- certificate.sign(key, OpenSSL::Digest::SHA1.new)
39
- File.write(File.expand_path("test/certificate.pem", __dir__), certificate.to_pem)
40
- end
data/bin/rails DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails gems
3
- # installed from the root of your application.
4
-
5
- ENGINE_ROOT = File.expand_path('..', __dir__)
6
- ENGINE_PATH = File.expand_path('../lib/google_sign_in/engine', __dir__)
7
- APP_PATH = File.expand_path('../test/dummy/config/application', __dir__)
8
-
9
- # Set up gems listed in the Gemfile.
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
11
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
12
-
13
- require 'rails'
14
- require 'action_controller/railtie'
15
- require 'rails/test_unit/railtie'
16
- require 'rails/engine/commands'
@@ -1,22 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = 'google_sign_in'
3
- s.version = '1.2.0'
4
- s.authors = ['David Heinemeier Hansson', 'George Claghorn']
5
- s.email = ['david@basecamp.com', 'george@basecamp.com']
6
- s.summary = 'Sign in (or up) with Google for Rails applications'
7
- s.homepage = 'https://github.com/basecamp/google_sign_in'
8
- s.license = 'MIT'
9
-
10
- s.required_ruby_version = '>= 1.9.3'
11
-
12
- s.add_dependency 'rails', '>= 5.2.0'
13
- s.add_dependency 'google-id-token', '>= 1.4.0'
14
- s.add_dependency 'oauth2', '>= 1.4.0'
15
-
16
- s.add_development_dependency 'bundler', '~> 1.15'
17
- s.add_development_dependency 'jwt', '>= 1.5.6'
18
- s.add_development_dependency 'webmock', '>= 3.4.2'
19
-
20
- s.files = `git ls-files`.split("\n")
21
- s.test_files = `git ls-files -- test/*`.split("\n")
22
- end
data/test/certificate.pem DELETED
@@ -1,19 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDETCCAfmgAwIBAQIBADANBgkqhkiG9w0BAQUFADAvMS0wKwYDVQQDDCRnb29n
3
- bGUtc2lnbi1pbi1mb3ItcmFpbHMuZXhhbXBsZS5jb20wHhcNMTgwOTAyMjI0MTQw
4
- WhcNMjMwOTAyMjI0MTQwWjAvMS0wKwYDVQQDDCRnb29nbGUtc2lnbi1pbi1mb3It
5
- cmFpbHMuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
6
- AQCtnO1OcLbdxj4f6I/aUMJkCJfrDNvp0v2ljUJoaq6hqWPmoZgcl92njBvt91np
7
- JPfGaCy0ZYLfizUNBRKkfo6u3MXvubktYqk3SVCejy0TUE11PwRx1u/x0c2rCTa6
8
- Y7ppAoO9Ur3yoccDmkceP8MpofHWetrdaxyhktlqy6gpM7V+kjj+anySQk4XqDJl
9
- F4FXHt82HMNK3xbjXJyEoyMudGUISBDn/rG8b3LxEKawUiLVCI54g3+L/Oi4nZCE
10
- XNCd/mvWpVFoPpFQGMoKW3S9KxFowvfkDSxWYwgYnWnsO0ueXS+WYML88KO1Qf7V
11
- mEZ91u7w1/EiMVxiuczxycSfAgMBAAGjODA2MAwGA1UdEwEB/wQCMAAwDgYDVR0P
12
- AQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMCMA0GCSqGSIb3DQEBBQUA
13
- A4IBAQCVXynTCZhpbINC4j1prGaPfY6mRkCZzcRpQFim4C6hJtYSRn57qjpmYWG3
14
- eVc3ElfNUAWgC3trACjN3hDqKv0/hH9TGTY9iFhc747L/VSaKWzH/uWewj1qTwsX
15
- dUEFxZILAWvAMBNUT060t8bt+pSFc2h4fHsftOqFLfkFUcCr22QsWyueXzWZyDeZ
16
- XWFGtD+WOR5SC4mIY359e75/vZsJymzZIfM+pfcaHnXtXez9SeLM81rvnRdR1b+H
17
- /S0LT0dPRkXSvC2HRPwzHxVctNrDoaxON+OIMgd4lHAFs6doVoYmnprzO69+IBUK
18
- s0LBENxbn2rd7IEl6EaC91cXCl3y
19
- -----END CERTIFICATE-----
@@ -1,26 +0,0 @@
1
- require 'test_helper'
2
-
3
- class GoogleSignIn::AuthorizationsControllerTest < ActionDispatch::IntegrationTest
4
- test "redirecting to Google for authorization" do
5
- post google_sign_in.authorization_url, params: { proceed_to: 'http://www.example.com/login' }
6
- assert_response :redirect
7
- assert_match 'https://accounts.google.com/o/oauth2/auth', response.location
8
-
9
- params = extract_query_params_from(response.location)
10
- assert_equal FAKE_GOOGLE_CLIENT_ID, params[:client_id]
11
- assert_equal 'login', params[:prompt]
12
- assert_equal 'code', params[:response_type]
13
- assert_equal 'http://www.example.com/google_sign_in/callback', params[:redirect_uri]
14
- assert_equal 'openid profile email', params[:scope]
15
- assert_match /[A-Za-z0-9+\/]{32}/, params[:state]
16
-
17
- assert_equal 'http://www.example.com/login', flash[:proceed_to]
18
- assert_equal params[:state], flash[:state]
19
- end
20
-
21
- private
22
- def extract_query_params_from(url)
23
- query = URI(url).query
24
- Rack::Utils.parse_query(query).symbolize_keys
25
- end
26
- end
@@ -1,133 +0,0 @@
1
- require 'test_helper'
2
-
3
- class GoogleSignIn::CallbacksControllerTest < ActionDispatch::IntegrationTest
4
- test "receiving an authorization code" do
5
- post google_sign_in.authorization_url, params: { proceed_to: 'http://www.example.com/login' }
6
- assert_response :redirect
7
-
8
- stub_token_for '4/SgCpHSVW5-Cy', access_token: 'ya29.GlwIBo', id_token: 'eyJhbGciOiJSUzI'
9
-
10
- get google_sign_in.callback_url(code: '4/SgCpHSVW5-Cy', state: flash[:state])
11
- assert_redirected_to 'http://www.example.com/login'
12
- assert_equal 'eyJhbGciOiJSUzI', flash[:google_sign_in][:id_token]
13
- assert_nil flash[:google_sign_in][:error]
14
- end
15
-
16
- # Authorization request errors: https://tools.ietf.org/html/rfc6749#section-4.1.2.1
17
- %w[ invalid_request unauthorized_client access_denied unsupported_response_type invalid_scope server_error temporarily_unavailable ].each do |error|
18
- test "receiving an authorization code grant error: #{error}" do
19
- post google_sign_in.authorization_url, params: { proceed_to: 'http://www.example.com/login' }
20
- assert_response :redirect
21
-
22
- get google_sign_in.callback_url(error: error, state: flash[:state])
23
- assert_redirected_to 'http://www.example.com/login'
24
- assert_nil flash[:google_sign_in][:id_token]
25
- assert_equal error, flash[:google_sign_in][:error]
26
- end
27
- end
28
-
29
- test "receiving an invalid authorization error" do
30
- post google_sign_in.authorization_url, params: { proceed_to: 'http://www.example.com/login' }
31
- assert_response :redirect
32
-
33
- get google_sign_in.callback_url(error: 'unknown error code', state: flash[:state])
34
- assert_redirected_to 'http://www.example.com/login'
35
- assert_nil flash[:google_sign_in][:id_token]
36
- assert_equal "invalid_request", flash[:google_sign_in][:error]
37
- end
38
-
39
- test "receiving neither code nor error" do
40
- post google_sign_in.authorization_url, params: { proceed_to: 'http://www.example.com/login' }
41
- assert_response :redirect
42
-
43
- get google_sign_in.callback_url(state: flash[:state])
44
- assert_redirected_to 'http://www.example.com/login'
45
- assert_nil flash[:google_sign_in][:id_token]
46
- assert_equal 'invalid_request', flash[:google_sign_in][:error]
47
- end
48
-
49
- # Access token request errors: https://tools.ietf.org/html/rfc6749#section-5.2
50
- %w[ invalid_request invalid_client invalid_grant unauthorized_client unsupported_grant_type invalid_scope ].each do |error|
51
- test "receiving an access token request error: #{error}" do
52
- post google_sign_in.authorization_url, params: { proceed_to: 'http://www.example.com/login' }
53
- assert_response :redirect
54
-
55
- stub_token_error_for '4/SgCpHSVW5-Cy', error: error
56
-
57
- get google_sign_in.callback_url(code: '4/SgCpHSVW5-Cy', state: flash[:state])
58
- assert_redirected_to 'http://www.example.com/login'
59
- assert_nil flash[:google_sign_in][:id_token]
60
- assert_equal error, flash[:google_sign_in][:error]
61
- end
62
- end
63
-
64
- test "protecting against CSRF without flash state" do
65
- post google_sign_in.authorization_url, params: { proceed_to: 'http://www.example.com/login' }
66
- assert_response :redirect
67
-
68
- get google_sign_in.callback_url(code: '4/SgCpHSVW5-Cy', state: 'invalid')
69
- assert_redirected_to 'http://www.example.com/login'
70
- assert_nil flash[:google_sign_in][:id_token]
71
- assert_equal 'invalid_request', flash[:google_sign_in][:error]
72
- end
73
-
74
- test "protecting against CSRF with invalid state" do
75
- post google_sign_in.authorization_url, params: { proceed_to: 'http://www.example.com/login' }
76
- assert_response :redirect
77
- assert_not_nil flash[:state]
78
-
79
- get google_sign_in.callback_url(code: '4/SgCpHSVW5-Cy', state: 'invalid')
80
- assert_redirected_to 'http://www.example.com/login'
81
- assert_nil flash[:google_sign_in][:id_token]
82
- assert_equal 'invalid_request', flash[:google_sign_in][:error]
83
- end
84
-
85
- test "protecting against CSRF with missing state" do
86
- post google_sign_in.authorization_url, params: { proceed_to: 'http://www.example.com/login' }
87
- assert_response :redirect
88
- assert_not_nil flash[:state]
89
-
90
- get google_sign_in.callback_url(code: '4/SgCpHSVW5-Cy')
91
- assert_redirected_to 'http://www.example.com/login'
92
- assert_nil flash[:google_sign_in][:id_token]
93
- assert_equal 'invalid_request', flash[:google_sign_in][:error]
94
- end
95
-
96
- test "protecting against open redirects" do
97
- post google_sign_in.authorization_url, params: { proceed_to: 'http://malicious.example.com/login' }
98
- assert_response :redirect
99
-
100
- get google_sign_in.callback_url(code: '4/SgCpHSVW5-Cy', state: flash[:state])
101
- assert_response :bad_request
102
- end
103
-
104
- test "receiving no proceed_to URL" do
105
- get google_sign_in.callback_url(code: '4/SgCpHSVW5-Cy', state: 'invalid')
106
- assert_response :bad_request
107
- end
108
-
109
- private
110
- def stub_token_for(code, **response_body)
111
- stub_token_request(code, status: 200, response: response_body)
112
- end
113
-
114
- def stub_token_error_for(code, error:)
115
- stub_token_request(code, status: 418, response: { error: error })
116
- end
117
-
118
- def stub_token_request(code, status:, response:)
119
- stub_request(:post, 'https://oauth2.googleapis.com/token').with(
120
- body: {
121
- grant_type: 'authorization_code',
122
- code: code,
123
- client_id: FAKE_GOOGLE_CLIENT_ID,
124
- client_secret: FAKE_GOOGLE_CLIENT_SECRET,
125
- redirect_uri: 'http://www.example.com/google_sign_in/callback'
126
- }
127
- ).to_return(
128
- status: status,
129
- headers: { 'Content-Type' => 'application/json' },
130
- body: JSON.generate(response)
131
- )
132
- end
133
- end
@@ -1 +0,0 @@
1
- 2.5.0
data/test/dummy/Rakefile DELETED
@@ -1,6 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- //= link_tree ../images
2
- //= link_directory ../javascripts .js
3
- //= link_directory ../stylesheets .css
File without changes
@@ -1,15 +0,0 @@
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 .
@@ -1,13 +0,0 @@
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
@@ -1,15 +0,0 @@
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
- */
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Channel < ActionCable::Channel::Base
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Connection < ActionCable::Connection::Base
3
- end
4
- end
@@ -1,2 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- end
File without changes
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,2 +0,0 @@
1
- class ApplicationJob < ActiveJob::Base
2
- end
@@ -1,4 +0,0 @@
1
- class ApplicationMailer < ActionMailer::Base
2
- default from: 'from@example.com'
3
- layout 'mailer'
4
- end
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end
File without changes
@@ -1,15 +0,0 @@
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>
@@ -1,13 +0,0 @@
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>
@@ -1 +0,0 @@
1
- <%= yield %>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
- load Gem.bin_path('bundler', 'bundle')
data/test/dummy/bin/rails DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../config/application', __dir__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
data/test/dummy/bin/rake DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
data/test/dummy/bin/setup DELETED
@@ -1,36 +0,0 @@
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
@@ -1,31 +0,0 @@
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
data/test/dummy/bin/yarn DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path('..', __dir__)
3
- Dir.chdir(APP_ROOT) do
4
- begin
5
- exec "yarnpkg", *ARGV
6
- rescue Errno::ENOENT
7
- $stderr.puts "Yarn executable was not detected in the system."
8
- $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9
- exit 1
10
- end
11
- end
@@ -1,20 +0,0 @@
1
- require_relative 'boot'
2
-
3
- require 'rails'
4
- require 'action_controller/railtie'
5
- require 'rails/test_unit/railtie'
6
- require 'google_sign_in'
7
-
8
- Bundler.require(*Rails.groups)
9
-
10
- module Dummy
11
- class Application < Rails::Application
12
- # Initialize configuration defaults for originally generated Rails version.
13
- config.load_defaults 5.2
14
-
15
- # Settings in config/environments/* take precedence over those specified here.
16
- # Application configuration can go into files in config/initializers
17
- # -- all .rb files in that directory are automatically loaded after loading
18
- # the framework and any gems in your application.
19
- end
20
- end
@@ -1,5 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
3
-
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -1,10 +0,0 @@
1
- development:
2
- adapter: async
3
-
4
- test:
5
- adapter: async
6
-
7
- production:
8
- adapter: redis
9
- url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
- channel_prefix: dummy_production
@@ -1,25 +0,0 @@
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: <%= ENV.fetch("RAILS_MAX_THREADS") { 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
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require_relative 'application'
3
-
4
- # Initialize the Rails application.
5
- Rails.application.initialize!
@@ -1,32 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Do not eager load code on boot.
10
- config.eager_load = false
11
-
12
- # Show full error reports.
13
- config.consider_all_requests_local = true
14
-
15
- # Enable/disable caching. By default caching is disabled.
16
- # Run rails dev:cache to toggle caching.
17
- if Rails.root.join('tmp', 'caching-dev.txt').exist?
18
- config.action_controller.perform_caching = true
19
-
20
- config.cache_store = :memory_store
21
- config.public_file_server.headers = {
22
- 'Cache-Control' => "public, max-age=#{2.days.to_i}"
23
- }
24
- else
25
- config.action_controller.perform_caching = false
26
-
27
- config.cache_store = :null_store
28
- end
29
-
30
- # Print deprecation notices to the Rails logger.
31
- config.active_support.deprecation = :log
32
- end