ito 0.3.0 → 0.4.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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +10 -0
  3. data/Gemfile +15 -0
  4. data/Gemfile.lock +127 -0
  5. data/ito.gemspec +20 -0
  6. data/lib/ito.rb +17 -0
  7. data/lib/ito/railtie.rb +9 -0
  8. data/lib/ito/version.rb +3 -0
  9. data/test/dummy/.envrc +2 -0
  10. data/test/dummy/.ruby-version +1 -0
  11. data/test/dummy/Rakefile +6 -0
  12. data/test/dummy/app/assets/config/manifest.js +3 -0
  13. data/test/dummy/app/assets/images/.keep +0 -0
  14. data/test/dummy/app/assets/javascripts/application.js +15 -0
  15. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  16. data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
  17. data/test/dummy/app/assets/javascripts/home.js +2 -0
  18. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  19. data/test/dummy/app/assets/stylesheets/home.css +4 -0
  20. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  21. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  22. data/test/dummy/app/controllers/application_controller.rb +2 -0
  23. data/test/dummy/app/controllers/concerns/.keep +0 -0
  24. data/test/dummy/app/controllers/welcome_controller.rb +3 -0
  25. data/test/dummy/app/helpers/application_helper.rb +2 -0
  26. data/test/dummy/app/helpers/home_helper.rb +2 -0
  27. data/test/dummy/app/jobs/application_job.rb +2 -0
  28. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  29. data/test/dummy/app/models/application_record.rb +3 -0
  30. data/test/dummy/app/models/concerns/.keep +0 -0
  31. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  32. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  33. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  34. data/test/dummy/app/views/welcome/index.html.erb +1 -0
  35. data/test/dummy/bin/bundle +3 -0
  36. data/test/dummy/bin/rails +4 -0
  37. data/test/dummy/bin/rake +4 -0
  38. data/test/dummy/bin/setup +36 -0
  39. data/test/dummy/bin/update +31 -0
  40. data/test/dummy/bin/yarn +11 -0
  41. data/test/dummy/config.ru +5 -0
  42. data/test/dummy/config/application.rb +18 -0
  43. data/test/dummy/config/boot.rb +5 -0
  44. data/test/dummy/config/cable.yml +10 -0
  45. data/test/dummy/config/database.yml +25 -0
  46. data/test/dummy/config/environment.rb +5 -0
  47. data/test/dummy/config/environments/development.rb +61 -0
  48. data/test/dummy/config/environments/production.rb +94 -0
  49. data/test/dummy/config/environments/test.rb +46 -0
  50. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  51. data/test/dummy/config/initializers/assets.rb +14 -0
  52. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  53. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  54. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  55. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  56. data/test/dummy/config/initializers/inflections.rb +16 -0
  57. data/test/dummy/config/initializers/mime_types.rb +4 -0
  58. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  59. data/test/dummy/config/locales/en.yml +33 -0
  60. data/test/dummy/config/puma.rb +34 -0
  61. data/test/dummy/config/routes.rb +3 -0
  62. data/test/dummy/config/spring.rb +6 -0
  63. data/test/dummy/config/storage.yml +34 -0
  64. data/test/dummy/lib/assets/.keep +0 -0
  65. data/test/dummy/log/.keep +0 -0
  66. data/test/dummy/package.json +5 -0
  67. data/test/dummy/public/404.html +67 -0
  68. data/test/dummy/public/422.html +67 -0
  69. data/test/dummy/public/500.html +66 -0
  70. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  71. data/test/dummy/public/apple-touch-icon.png +0 -0
  72. data/test/dummy/public/favicon.ico +0 -0
  73. data/test/dummy/test/controllers/home_controller_test.rb +8 -0
  74. metadata +73 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e10b7bce32ffbed475407bc55e00587abcdb32b5b8ccbeff8b99eedf93565b61
4
- data.tar.gz: ae130ba1acc308518dc6e1f5c9201532bf40ab8ca905f7a118b381384de9eed6
3
+ metadata.gz: 706bd8bf0946f441fbdd3a7d9dc2f5c29dd21d4a63a07a3d2a7fdce63ad5b575
4
+ data.tar.gz: 828f94e2def34769def8914e7da90fb6af05c1a9df29d01eb26b13756e8f70de
5
5
  SHA512:
6
- metadata.gz: 4872b5a5349cc117da80c8f98b49daf5eff779ab3851e0a6bcf3df86073c93043642b510bdebee10c914d858d5cd66a37bac91a83f89ae6264a2ca848cda899b
7
- data.tar.gz: b47c38c8db0e7565a228d0ba65ac7c1bef3d434a41d3438f164c067db3bd7f36c0373cab94b656f8a50861f22d8ae74d76759996601d9532eb75e22cdd665b0f
6
+ metadata.gz: c848e43a86269b48f1da101d3f1a6da75627e2e8ca2fa44b43870bb66f47b20e92d9c52965bea9c776edfe22c5107e5bbec5fa783e7d0ce3c70c251563648f58
7
+ data.tar.gz: 4570b25763391f6853b034ad6e227875a7d761bc2ce681546e79b72dd1dde04542d3446aec62387fa09d277326639ee820835fef9c4250a8f65088fbe16bc0c8
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/db/*.sqlite3-journal
6
+ test/dummy/log/*.log
7
+ test/dummy/node_modules/
8
+ test/dummy/yarn-error.log
9
+ test/dummy/storage/
10
+ test/dummy/tmp/
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Declare your gem's dependencies in ito.gemspec.
5
+ # Bundler will treat runtime dependencies like base dependencies, and
6
+ # development dependencies will be added by default to the :development group.
7
+ gemspec
8
+
9
+ # Declare any dependencies that are still in development here instead of in
10
+ # your gemspec. These might include edge Rails or gems from your path or
11
+ # Git. Remember to move these dependencies to your gemspec before releasing
12
+ # your gem to rubygems.org.
13
+
14
+ # To use a debugger
15
+ # gem 'byebug', group: [:development, :test]
data/Gemfile.lock ADDED
@@ -0,0 +1,127 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ito (0.4.0)
5
+ rails (~> 5.2.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (5.2.0)
11
+ actionpack (= 5.2.0)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailer (5.2.0)
15
+ actionpack (= 5.2.0)
16
+ actionview (= 5.2.0)
17
+ activejob (= 5.2.0)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.2.0)
21
+ actionview (= 5.2.0)
22
+ activesupport (= 5.2.0)
23
+ rack (~> 2.0)
24
+ rack-test (>= 0.6.3)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
+ actionview (5.2.0)
28
+ activesupport (= 5.2.0)
29
+ builder (~> 3.1)
30
+ erubi (~> 1.4)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
+ activejob (5.2.0)
34
+ activesupport (= 5.2.0)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.2.0)
37
+ activesupport (= 5.2.0)
38
+ activerecord (5.2.0)
39
+ activemodel (= 5.2.0)
40
+ activesupport (= 5.2.0)
41
+ arel (>= 9.0)
42
+ activestorage (5.2.0)
43
+ actionpack (= 5.2.0)
44
+ activerecord (= 5.2.0)
45
+ marcel (~> 0.3.1)
46
+ activesupport (5.2.0)
47
+ concurrent-ruby (~> 1.0, >= 1.0.2)
48
+ i18n (>= 0.7, < 2)
49
+ minitest (~> 5.1)
50
+ tzinfo (~> 1.1)
51
+ arel (9.0.0)
52
+ builder (3.2.3)
53
+ concurrent-ruby (1.0.5)
54
+ crass (1.0.4)
55
+ erubi (1.7.1)
56
+ globalid (0.4.1)
57
+ activesupport (>= 4.2.0)
58
+ i18n (1.0.1)
59
+ concurrent-ruby (~> 1.0)
60
+ loofah (2.2.2)
61
+ crass (~> 1.0.2)
62
+ nokogiri (>= 1.5.9)
63
+ mail (2.7.0)
64
+ mini_mime (>= 0.1.1)
65
+ marcel (0.3.2)
66
+ mimemagic (~> 0.3.2)
67
+ method_source (0.9.0)
68
+ mimemagic (0.3.2)
69
+ mini_mime (1.0.0)
70
+ mini_portile2 (2.3.0)
71
+ minitest (5.11.3)
72
+ nio4r (2.3.1)
73
+ nokogiri (1.8.2)
74
+ mini_portile2 (~> 2.3.0)
75
+ rack (2.0.5)
76
+ rack-test (1.0.0)
77
+ rack (>= 1.0, < 3)
78
+ rails (5.2.0)
79
+ actioncable (= 5.2.0)
80
+ actionmailer (= 5.2.0)
81
+ actionpack (= 5.2.0)
82
+ actionview (= 5.2.0)
83
+ activejob (= 5.2.0)
84
+ activemodel (= 5.2.0)
85
+ activerecord (= 5.2.0)
86
+ activestorage (= 5.2.0)
87
+ activesupport (= 5.2.0)
88
+ bundler (>= 1.3.0)
89
+ railties (= 5.2.0)
90
+ sprockets-rails (>= 2.0.0)
91
+ rails-dom-testing (2.0.3)
92
+ activesupport (>= 4.2.0)
93
+ nokogiri (>= 1.6)
94
+ rails-html-sanitizer (1.0.4)
95
+ loofah (~> 2.2, >= 2.2.2)
96
+ railties (5.2.0)
97
+ actionpack (= 5.2.0)
98
+ activesupport (= 5.2.0)
99
+ method_source
100
+ rake (>= 0.8.7)
101
+ thor (>= 0.18.1, < 2.0)
102
+ rake (12.3.1)
103
+ sprockets (3.7.1)
104
+ concurrent-ruby (~> 1.0)
105
+ rack (> 1, < 3)
106
+ sprockets-rails (3.2.1)
107
+ actionpack (>= 4.0)
108
+ activesupport (>= 4.0)
109
+ sprockets (>= 3.0.0)
110
+ sqlite3 (1.3.13)
111
+ thor (0.20.0)
112
+ thread_safe (0.3.6)
113
+ tzinfo (1.2.5)
114
+ thread_safe (~> 0.1)
115
+ websocket-driver (0.7.0)
116
+ websocket-extensions (>= 0.1.0)
117
+ websocket-extensions (0.1.3)
118
+
119
+ PLATFORMS
120
+ ruby
121
+
122
+ DEPENDENCIES
123
+ ito!
124
+ sqlite3
125
+
126
+ BUNDLED WITH
127
+ 1.16.1
data/ito.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'ito/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'ito'
8
+ s.version = Ito::VERSION
9
+ s.authors = ['taki']
10
+ s.email = ['taki@users.noreply.github.com']
11
+ s.homepage = 'https://github.com/taki/ito'
12
+ s.summary = 'Authenticate using basic access authentication'
13
+ s.license = 'MIT'
14
+ s.files = `git ls-files -z`.split("\x0")
15
+ s.require_paths = ['lib']
16
+
17
+ s.add_dependency 'rails', '~> 5.2.0'
18
+
19
+ s.add_development_dependency 'sqlite3'
20
+ end
data/lib/ito.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'active_support/concern'
2
+
3
+ module Ito
4
+ extend ::ActiveSupport::Concern
5
+
6
+ included do
7
+ before_action :basic_auth
8
+ end
9
+
10
+ def basic_auth
11
+ authenticate_or_request_with_http_basic do |user_name, password|
12
+ user_name == ENV['USER_NAME'] && password == ENV['PASSWORD']
13
+ end
14
+ end
15
+ end
16
+
17
+ require 'ito/railtie' if defined?(Rails)
@@ -0,0 +1,9 @@
1
+ module Ito
2
+ class Railtie < Rails::Railtie
3
+ initializer 'ito' do
4
+ ActiveSupport.on_load(:action_controller) do
5
+ ActionController::Base.include Ito
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Ito
2
+ VERSION = '0.4.0'.freeze
3
+ end
data/test/dummy/.envrc ADDED
@@ -0,0 +1,2 @@
1
+ export USER_NAME=user_name
2
+ export PASSWORD=password
@@ -0,0 +1 @@
1
+ 2.5.1
@@ -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,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
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,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -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
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -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,3 @@
1
+ class WelcomeController < ApplicationController
2
+ def index; end
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module HomeHelper
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 @@
1
+ <h1>This is basic authencation sample.</h1>
@@ -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