simple_sign_in 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +22 -0
  5. data/app/assets/javascripts/simple_sign_in/application.js +13 -0
  6. data/app/assets/javascripts/simple_sign_in/login.js +2 -0
  7. data/app/assets/stylesheets/simple_sign_in/application.css +13 -0
  8. data/app/assets/stylesheets/simple_sign_in/login.css +13 -0
  9. data/app/controllers/simple_sign_in/application_controller.rb +5 -0
  10. data/app/controllers/simple_sign_in/login_controller.rb +26 -0
  11. data/app/helpers/simple_sign_in/application_helper.rb +4 -0
  12. data/app/helpers/simple_sign_in/login_helper.rb +4 -0
  13. data/app/views/layouts/simple_sign_in/application.html.erb +15 -0
  14. data/app/views/simple_sign_in/login/new.html.erb +29 -0
  15. data/config/routes.rb +5 -0
  16. data/lib/simple_sign_in/controller_methods.rb +29 -0
  17. data/lib/simple_sign_in/engine.rb +23 -0
  18. data/lib/simple_sign_in/version.rb +3 -0
  19. data/lib/simple_sign_in.rb +5 -0
  20. data/lib/tasks/simple_sign_in_tasks.rake +4 -0
  21. data/spec/controllers/simple_sign_in/login_controller_spec.rb +42 -0
  22. data/spec/dummy/README.rdoc +28 -0
  23. data/spec/dummy/Rakefile +6 -0
  24. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  25. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  26. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  27. data/spec/dummy/app/controllers/public_controller.rb +7 -0
  28. data/spec/dummy/app/controllers/secrets_controller.rb +5 -0
  29. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  30. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  31. data/spec/dummy/app/views/public/index.html.erb +1 -0
  32. data/spec/dummy/app/views/secrets/index.html.erb +2 -0
  33. data/spec/dummy/bin/bundle +3 -0
  34. data/spec/dummy/bin/rails +4 -0
  35. data/spec/dummy/bin/rake +4 -0
  36. data/spec/dummy/config/application.rb +29 -0
  37. data/spec/dummy/config/boot.rb +5 -0
  38. data/spec/dummy/config/database.yml +25 -0
  39. data/spec/dummy/config/environment.rb +5 -0
  40. data/spec/dummy/config/environments/development.rb +29 -0
  41. data/spec/dummy/config/environments/production.rb +80 -0
  42. data/spec/dummy/config/environments/test.rb +36 -0
  43. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  44. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  45. data/spec/dummy/config/initializers/inflections.rb +16 -0
  46. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  47. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  48. data/spec/dummy/config/initializers/session_store.rb +3 -0
  49. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  50. data/spec/dummy/config/locales/en.yml +23 -0
  51. data/spec/dummy/config/routes.rb +6 -0
  52. data/spec/dummy/config.ru +4 -0
  53. data/spec/dummy/db/development.sqlite3 +0 -0
  54. data/spec/dummy/db/test.sqlite3 +0 -0
  55. data/spec/dummy/log/development.log +11426 -0
  56. data/spec/dummy/log/test.log +5352 -0
  57. data/spec/dummy/public/404.html +58 -0
  58. data/spec/dummy/public/422.html +58 -0
  59. data/spec/dummy/public/500.html +57 -0
  60. data/spec/dummy/public/favicon.ico +0 -0
  61. data/spec/dummy/tmp/cache/assets/development/sprockets/09f847bad5c38ac9566e1ce53f354ca5 +0 -0
  62. data/spec/dummy/tmp/cache/assets/development/sprockets/0eec9b0107101ed19acf49f0c8284333 +0 -0
  63. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  64. data/spec/dummy/tmp/cache/assets/development/sprockets/1fa8afc413f553b3e784a30c9c8bb124 +0 -0
  65. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/3a965b06713dd238c43a7dda73d07f2b +0 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/3c941c17a6569cfb2c882aa9f41ee036 +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/3ffbe3d6494067ce895cfcedaa2a091b +0 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/4acbe0bee9852ebc9369f3460e1037a6 +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/60808c9c70a3e71f23258e2e07b413a5 +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/79ab54deddfe98f7a569388cbbe22271 +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/9d1aaaef3ed07c86494e16ae882fdb30 +0 -0
  74. data/spec/dummy/tmp/cache/assets/development/sprockets/a0dc5630084f477bd96cb889b4732422 +0 -0
  75. data/spec/dummy/tmp/cache/assets/development/sprockets/b69f45bbf61db55374b8fa4911e4720f +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/ba9086cd45f087b00f233b32fae0542a +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/bd6036d4fcbb0cda7e3d3ee44fe11bca +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/de506abedf03f4f69ae8a2e86ee06ba8 +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/de62d8814fc20e093094b6bf5d417823 +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/f318b38f3aa115b6cae66657e35cd3fe +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/fb4a32219974bda2986ac225499cd272 +0 -0
  85. data/spec/dummy/tmp/cache/assets/test/sprockets/0eec9b0107101ed19acf49f0c8284333 +0 -0
  86. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  87. data/spec/dummy/tmp/cache/assets/test/sprockets/1fa8afc413f553b3e784a30c9c8bb124 +0 -0
  88. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  89. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  90. data/spec/dummy/tmp/cache/assets/test/sprockets/3a965b06713dd238c43a7dda73d07f2b +0 -0
  91. data/spec/dummy/tmp/cache/assets/test/sprockets/3ffbe3d6494067ce895cfcedaa2a091b +0 -0
  92. data/spec/dummy/tmp/cache/assets/test/sprockets/4acbe0bee9852ebc9369f3460e1037a6 +0 -0
  93. data/spec/dummy/tmp/cache/assets/test/sprockets/60808c9c70a3e71f23258e2e07b413a5 +0 -0
  94. data/spec/dummy/tmp/cache/assets/test/sprockets/79ab54deddfe98f7a569388cbbe22271 +0 -0
  95. data/spec/dummy/tmp/cache/assets/test/sprockets/9d1aaaef3ed07c86494e16ae882fdb30 +0 -0
  96. data/spec/dummy/tmp/cache/assets/test/sprockets/a0dc5630084f477bd96cb889b4732422 +0 -0
  97. data/spec/dummy/tmp/cache/assets/test/sprockets/ba9086cd45f087b00f233b32fae0542a +0 -0
  98. data/spec/dummy/tmp/cache/assets/test/sprockets/bd6036d4fcbb0cda7e3d3ee44fe11bca +0 -0
  99. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  100. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  101. data/spec/dummy/tmp/cache/assets/test/sprockets/de506abedf03f4f69ae8a2e86ee06ba8 +0 -0
  102. data/spec/dummy/tmp/cache/assets/test/sprockets/de62d8814fc20e093094b6bf5d417823 +0 -0
  103. data/spec/dummy/tmp/cache/assets/test/sprockets/f318b38f3aa115b6cae66657e35cd3fe +0 -0
  104. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  105. data/spec/features/simple_sign_in_login_flows_spec.rb +42 -0
  106. data/spec/spec_helper.rb +50 -0
  107. metadata +319 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 93b490283317296a2ccda347c62f1da0bb28ac67
4
+ data.tar.gz: 219f14f347a538158583a2a5445caf9f6db53e27
5
+ SHA512:
6
+ metadata.gz: d2166ecba3f3c3441351a2c25d53bc37dc83b04c7389c7813e6b9f2124f2c4d181d17f07c819af8321096d558f366448a9db5e57eb07cc60d2320b3001dd1823
7
+ data.tar.gz: 1f732378b933abbb35091005548cb20c1f68f9ef9418f3af90616f08ba11117e1ee6015a5ae00f38b89b3a095c11507a625f7fa1280d397fd31d85d25f74d7a7
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 Izhar Gavish
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.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = SimpleSignIn
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,22 @@
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 = 'SimpleSignIn'
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
+
21
+
22
+ Bundler::GemHelper.install_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 vendor/assets/javascripts of plugins, if any, 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/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -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,13 @@
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 vendor/assets/stylesheets of plugins, if any, 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 top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,13 @@
1
+ body { background-color: #50254A !important; }
2
+
3
+ .login form {
4
+ width: 240px;
5
+ text-align: left;
6
+ margin: 30px auto;
7
+ padding: 50px;
8
+ border: 1px solid white;
9
+ background-color: white;
10
+ -webkit-border-radius: 15px;
11
+ -mozilla-border-radius: 15px;
12
+ border-radius: 15px;
13
+ }
@@ -0,0 +1,5 @@
1
+ module SimpleSignIn
2
+ class ApplicationController < ActionController::Base
3
+ include SimpleSignIn::ControllerMethods
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ require_dependency "simple_sign_in/application_controller"
2
+
3
+ module SimpleSignIn
4
+ class LoginController < ApplicationController
5
+ skip_before_filter :simple_sign_in_authentication, only: [:new, :create]
6
+
7
+ def new
8
+ end
9
+
10
+ def create
11
+ if params[:login] == ENV['SIMPLE_SIGN_IN_LOGIN'] && params[:password] == ENV['SIMPLE_SIGN_IN_PASSWORD']
12
+ session[:simple_sign_in_admin] = ENV['SIMPLE_SIGN_IN_LOGIN']
13
+ redirect_to "/"
14
+ else
15
+ flash[:notice] = 'Incorrect login or password'
16
+ redirect_to :root
17
+ end
18
+ end
19
+
20
+ def destroy
21
+ session[:simple_sign_in_admin] = nil
22
+ flash[:notice] = 'You have been signed out'
23
+ redirect_to :root
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,4 @@
1
+ module SimpleSignIn
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module SimpleSignIn
2
+ module LoginHelper
3
+ end
4
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>SimpleSignIn</title>
5
+ <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
6
+ <%= stylesheet_link_tag "simple_sign_in/application", media: "all" %>
7
+ <%= javascript_include_tag "simple_sign_in/application" %>
8
+ <%= csrf_meta_tags %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,29 @@
1
+ <div class="container-fluid">
2
+ <div class="row-fluid login">
3
+ <div class="span-12">
4
+
5
+ <%= form_tag login_path, method: :post do %>
6
+
7
+ <% if flash[:notice] %>
8
+ <div class="alert alert-error">
9
+ <%= flash[:notice] %>
10
+ </div>
11
+ <% end %>
12
+
13
+ <fieldset>
14
+ <div class="control-group">
15
+ <%= label_tag :login %>
16
+ <%= text_field_tag :login %>
17
+ </div>
18
+ <div class="control-group">
19
+ <%= label_tag :password %>
20
+ <%= password_field_tag :password %>
21
+ </div>
22
+ <%= submit_tag "Submit", class: 'btn btn-success' %>
23
+ </fieldset>
24
+
25
+ <% end %>
26
+
27
+ </div>
28
+ </div>
29
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ SimpleSignIn::Engine.routes.draw do
2
+ post "login", to: "login#create"
3
+ match "signout", to: "login#destroy", via: 'delete'
4
+ root to: "login#new"
5
+ end
@@ -0,0 +1,29 @@
1
+ module SimpleSignIn
2
+ module ControllerMethods
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_filter :simple_sign_in_authentication
7
+ @@simple_sign_in_envs ||= nil
8
+ end
9
+
10
+ def simple_sign_in_authentication
11
+ redirect_to "/simple_sign_in" if !simple_sign_in_user_logged_in? && authentication_is_on?
12
+ end
13
+
14
+ def simple_sign_in_envs
15
+ @@simple_sign_in_envs || [:test, :development, :production]
16
+ end
17
+
18
+ def simple_sign_in_user_logged_in?
19
+ session[:simple_sign_in_admin] == ENV['SIMPLE_SIGN_IN_LOGIN']
20
+ end
21
+
22
+ private
23
+
24
+ def authentication_is_on?
25
+ simple_sign_in_envs.include?(Rails.env.to_sym)
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ module SimpleSignIn
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace SimpleSignIn
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec
7
+ end
8
+
9
+ initializer 'simple_sign_in.initialize' do
10
+ config.to_prepare do
11
+ unless ENV['SIMPLE_SIGN_IN_LOGIN'] && ENV['SIMPLE_SIGN_IN_PASSWORD']
12
+ raise "simple_sign_in could not be loaded because login and password were not specified!
13
+ please make sure that the environment variables SIMPLE_SIGN_IN_LOGIN and SIMPLE_SIGN_IN_PASSWORD
14
+ have been set up as described here: https://github.com/Yud/simple_sign_in#installation"
15
+ end
16
+ ActiveSupport.on_load(:action_controller) do
17
+ include SimpleSignIn::ControllerMethods
18
+ end
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module SimpleSignIn
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "simple_sign_in/engine"
2
+ require "simple_sign_in/controller_methods"
3
+
4
+ module SimpleSignIn
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :simple_sign_in do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ module SimpleSignIn
4
+ describe SimpleSignIn::LoginController do
5
+ before do
6
+ @login = ENV['SIMPLE_SIGN_IN_LOGIN']
7
+ @pass = ENV['SIMPLE_SIGN_IN_PASSWORD']
8
+ end
9
+
10
+ describe "GET 'new'" do
11
+ it "returns http success" do
12
+ get 'new', use_route: SimpleSignIn
13
+ response.should be_success
14
+ end
15
+ end
16
+
17
+ describe "POST 'create'" do
18
+ it "should redirect to the app's root if login was successfull" do
19
+ session[:simple_sign_in_admin].should be_nil
20
+ post 'create', login: @login, password: @pass, use_route: SimpleSignIn
21
+ session[:simple_sign_in_admin].should == @login
22
+ response.should redirect_to "/"
23
+ end
24
+
25
+ it "should display an error message if the login/password were incorrect" do
26
+ post 'create', login: '', password: '', use_route: SimpleSignIn
27
+ response.should redirect_to :root
28
+ session[:simple_sign_in_admin].should be_nil
29
+ flash[:notice].should == "Incorrect login or password"
30
+ end
31
+ end
32
+
33
+ describe "DELETE 'destroy'" do
34
+ it "should sign out the user" do
35
+ session[:simple_sign_in_admin] = @login
36
+ delete 'destroy', use_route: SimpleSignIn
37
+ session[:simple_sign_in_admin].should be_nil
38
+ response.should redirect_to :root
39
+ end
40
+ end
41
+ end
42
+ 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
+ Dummy::Application.load_tasks
@@ -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 vendor/assets/javascripts of plugins, if any, 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/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
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 vendor/assets/stylesheets of plugins, if any, 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 top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -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,7 @@
1
+ class PublicController < ApplicationController
2
+ skip_before_action :simple_sign_in_authentication
3
+
4
+ def index
5
+
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class SecretsController < ApplicationController
2
+ def index
3
+
4
+ end
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 @@
1
+ <h1>Public</h1>
@@ -0,0 +1,2 @@
1
+ <%= link_to "Sign Out", 'simple_sign_in/signout', method: 'delete' %>
2
+ <h1>Top Secret</h1>
@@ -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
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "sprockets/railtie"
8
+ require 'jquery-rails'
9
+ # require "rails/test_unit/railtie"
10
+
11
+ Bundler.require(*Rails.groups)
12
+ require "simple_sign_in"
13
+
14
+ module Dummy
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+
20
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
+ # config.time_zone = 'Central Time (US & Canada)'
23
+
24
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
+ # config.i18n.default_locale = :de
27
+ end
28
+ end
29
+
@@ -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.exists?(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
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Dummy::Application.initialize!
@@ -0,0 +1,29 @@
1
+ Dummy::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 and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+ end
@@ -0,0 +1,80 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+ end