devise_materialize 0.0.4.test3 → 0.0.5.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +18 -0
  3. data/.gitignore +5 -0
  4. data/.rubocop.yml +5 -0
  5. data/.yardopts +1 -0
  6. data/Gemfile +10 -0
  7. data/Gemfile.lock +33 -12
  8. data/README.md +52 -12
  9. data/Rakefile +21 -0
  10. data/circle.yml +21 -0
  11. data/devise_materialize.gemspec +6 -17
  12. data/lib/devise_materialize/version.rb +1 -1
  13. data/lib/generators/devise_materialize/install_generator.rb +17 -31
  14. data/lib/generators/templates/assets/stylesheets/devise.scss +53 -0
  15. data/lib/generators/templates/erb/simple_form/confirmations/new.html.erb +7 -6
  16. data/lib/generators/templates/erb/simple_form/mailer/unlock_instructions.html.erb +8 -1
  17. data/lib/generators/templates/erb/simple_form/passwords/edit.html.erb +36 -0
  18. data/lib/generators/templates/erb/simple_form/passwords/new.html.erb +30 -0
  19. data/lib/generators/templates/erb/simple_form/registrations/edit.html.erb +42 -0
  20. data/lib/generators/templates/erb/simple_form/registrations/new.html.erb +36 -0
  21. data/lib/generators/templates/erb/simple_form/sessions/new.html.erb +34 -0
  22. data/lib/generators/templates/erb/simple_form/shared/_links.html.erb +40 -0
  23. data/lib/generators/templates/erb/simple_form/unlocks/new.html.erb +30 -0
  24. data/lib/generators/templates/haml/simple_form/confirmations/new.html.haml +1 -1
  25. data/lib/generators/templates/haml/simple_form/passwords/edit.html.haml +23 -16
  26. data/lib/generators/templates/haml/simple_form/passwords/new.html.haml +19 -12
  27. data/lib/generators/templates/haml/simple_form/registrations/edit.html.haml +1 -1
  28. data/lib/generators/templates/haml/simple_form/registrations/new.html.haml +23 -16
  29. data/lib/generators/templates/haml/simple_form/sessions/new.html.haml +22 -15
  30. data/lib/generators/templates/haml/simple_form/unlocks/new.html.haml +19 -12
  31. data/lib/generators/templates/helpers/devise_helper.rb +18 -0
  32. data/lib/generators/templates/slim/simple_form/confirmations/new.html.slim +21 -0
  33. data/lib/generators/templates/slim/simple_form/mailer/confirmation_instructions.html.slim +30 -0
  34. data/lib/generators/templates/slim/simple_form/mailer/password_change.html.slim +31 -0
  35. data/lib/generators/templates/slim/simple_form/mailer/reset_password_instructions.html.slim +38 -0
  36. data/lib/generators/templates/slim/simple_form/mailer/unlock_instructions.html.slim +35 -0
  37. data/lib/generators/templates/slim/simple_form/passwords/edit.html.slim +23 -0
  38. data/lib/generators/templates/slim/simple_form/passwords/new.html.slim +20 -0
  39. data/lib/generators/templates/slim/simple_form/registrations/edit.html.slim +30 -0
  40. data/lib/generators/templates/slim/simple_form/registrations/new.html.slim +24 -0
  41. data/lib/generators/templates/slim/simple_form/sessions/new.html.slim +23 -0
  42. data/lib/generators/templates/slim/simple_form/shared/_links.html.slim +29 -0
  43. data/lib/generators/templates/slim/simple_form/unlocks/new.html.slim +20 -0
  44. data/test/devise_materialize_test.rb +5 -0
  45. data/test/lib/install_generator_test.rb +92 -0
  46. data/test/rails_app/Rakefile +8 -0
  47. data/test/rails_app/app/controllers/application_controller.rb +7 -0
  48. data/test/rails_app/app/controllers/home_controller.rb +5 -0
  49. data/test/rails_app/app/helpers/application_helper.rb +4 -0
  50. data/test/rails_app/app/views/home/index.html.erb +1 -0
  51. data/test/rails_app/app/views/layouts/application.html.erb +13 -0
  52. data/test/rails_app/bin/bundle +4 -0
  53. data/test/rails_app/bin/rails +5 -0
  54. data/test/rails_app/bin/rake +5 -0
  55. data/test/rails_app/config.ru +5 -0
  56. data/test/rails_app/config/application.rb +13 -0
  57. data/test/rails_app/config/boot.rb +15 -0
  58. data/test/rails_app/config/database.yml +18 -0
  59. data/test/rails_app/config/environment.rb +6 -0
  60. data/test/rails_app/config/environments/development.rb +31 -0
  61. data/test/rails_app/config/environments/production.rb +87 -0
  62. data/test/rails_app/config/environments/test.rb +46 -0
  63. data/test/rails_app/config/initializers/backtrace_silencers.rb +8 -0
  64. data/test/rails_app/config/initializers/inflections.rb +3 -0
  65. data/test/rails_app/config/initializers/secret_token.rb +4 -0
  66. data/test/rails_app/config/initializers/session_store.rb +2 -0
  67. data/test/rails_app/config/routes.rb +4 -0
  68. data/test/rails_app/log/test.log +288 -0
  69. data/test/rails_app/public/404.html +26 -0
  70. data/test/rails_app/public/422.html +26 -0
  71. data/test/rails_app/public/500.html +26 -0
  72. data/{lib/generators/templates/.keep → test/rails_app/public/favicon.ico} +0 -0
  73. data/test/test_helper.rb +31 -0
  74. metadata +79 -68
  75. data/lib/generators/devise_materialize/USAGE +0 -5
@@ -0,0 +1,20 @@
1
+ .row.login-form
2
+ .col.s12.offset-m3
3
+ .card.hoverable
4
+ .card-content
5
+ span.card-title.center Resend Unlock Instructions
6
+ .divider
7
+ = simple_form_for resource, as: resource_name, url: unlock_path(resource_name),
8
+ | html: { method: :post } do |f|
9
+ - if devise_error_messages? || alert
10
+ .form-errors.red.lighten-1
11
+ = devise_error_messages!
12
+ = alert
13
+ .form-inputs.row
14
+ = f.input :email, autofocus: true, required: true
15
+ .form-actions.center
16
+ = f.button :submit, "Resend Unlock Instructions"
17
+ .card-action
18
+ .devise-links
19
+ = render "<%= namespace.downcase %>/shared/links"
20
+
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ require "test_helper"
3
+
4
+ class DeviseMaterializeTest < Minitest::Test
5
+ end
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+ require "test_helper"
3
+
4
+ class InstallGeneratorTest < Rails::Generators::TestCase
5
+ tests DeviseMaterialize::InstallGenerator
6
+ destination File.expand_path("../../tmp", __FILE__)
7
+ setup :prepare_destination
8
+
9
+ test "assert files created for default namespace and no params" do
10
+ run_generator
11
+ assert_files
12
+ end
13
+
14
+ test "assert files created for default namespace with haml" do
15
+ run_generator %w(-v haml)
16
+ assert_files nil, view_engine: "html.haml"
17
+ end
18
+
19
+ test "assert files created for default namespace wil slim" do
20
+ run_generator %w(-v slim)
21
+ assert_files nil, view_engine: "html.slim"
22
+ end
23
+
24
+ test "assert files created for users namespace with no params" do
25
+ run_generator %w(User)
26
+ assert_files "users"
27
+ end
28
+
29
+ test "assert files created for users namespace with haml" do
30
+ run_generator %w(User -v haml)
31
+ assert_files "users", view_engine: "html.haml"
32
+ end
33
+
34
+ test "assert files created for users namespace wil slim" do
35
+ run_generator %w(User -v slim)
36
+ assert_files "users", view_engine: "html.slim"
37
+ end
38
+
39
+ test "assert files created for default namespace and simple form" do
40
+ run_generator %w(-f simple_form)
41
+ assert_files
42
+ end
43
+
44
+ test "assert files created for default namespace with haml and simple_form" do
45
+ run_generator %w(-v haml -f simple_form)
46
+ assert_files nil, view_engine: "html.haml"
47
+ end
48
+
49
+ test "assert files created for default namespace wil slim and simple form" do
50
+ run_generator %w(-v slim -f simple_form)
51
+ assert_files nil, view_engine: "html.slim"
52
+ end
53
+
54
+ test "assert files created for users namespace with and simple form" do
55
+ run_generator %w(User -f simple_form)
56
+ assert_files "users"
57
+ end
58
+
59
+ test "assert files created for users namespace with haml and simple form" do
60
+ run_generator %w(User -v haml -f simple_form)
61
+ assert_files "users", view_engine: "html.haml"
62
+ end
63
+
64
+ test "assert files created for users namespace wil slim and simple form" do
65
+ run_generator %w(User -v slim -f simple_form)
66
+ assert_files "users", view_engine: "html.slim"
67
+ end
68
+
69
+ def assert_files(scope = nil, options = {})
70
+ scope = "devise" if scope.nil?
71
+ view_engine = options[:view_engine] || "html.erb"
72
+
73
+ assert_file "app/assets/stylesheets/devise.scss"
74
+ assert_file "app/helpers/devise_helper.rb"
75
+ assert_file "app/views/#{scope}/confirmations/new.#{view_engine}"
76
+ assert_file(
77
+ "app/views/#{scope}/mailer/confirmation_instructions.#{view_engine}"
78
+ )
79
+ assert_file "app/views/#{scope}/mailer/password_change.#{view_engine}"
80
+ assert_file(
81
+ "app/views/#{scope}/mailer/reset_password_instructions.#{view_engine}"
82
+ )
83
+ assert_file "app/views/#{scope}/mailer/unlock_instructions.#{view_engine}"
84
+ assert_file "app/views/#{scope}/passwords/edit.#{view_engine}"
85
+ assert_file "app/views/#{scope}/passwords/new.#{view_engine}"
86
+ assert_file "app/views/#{scope}/registrations/edit.#{view_engine}"
87
+ assert_file "app/views/#{scope}/registrations/new.#{view_engine}"
88
+ assert_file "app/views/#{scope}/sessions/new.#{view_engine}"
89
+ assert_file "app/views/#{scope}/shared/_links.#{view_engine}"
90
+ assert_file "app/views/#{scope}/unlocks/new.#{view_engine}"
91
+ end
92
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be
4
+ # available to Rake.
5
+
6
+ require File.expand_path("../config/application", __FILE__)
7
+
8
+ Rails.application.load_tasks
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ # Filters added to this controller apply to all controllers in the application.
3
+ # Likewise, all the methods added will be available for all controllers.
4
+
5
+ class ApplicationController < ActionController::Base
6
+ protect_from_forgery
7
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ class HomeController < ApplicationController
3
+ def index
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ # Methods added to this helper will be available to all templates in the application.
3
+ module ApplicationHelper
4
+ end
@@ -0,0 +1 @@
1
+ Home!
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html>
4
+ <head>
5
+ <title>Devise Materialize Test App</title>
6
+ </head>
7
+ <body>
8
+ <div id="container">
9
+
10
+ <%= yield %>
11
+ </div>
12
+ </body>
13
+ </html>
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
4
+ load Gem.bin_path("bundler", "bundle")
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ APP_PATH = File.expand_path("../../config/application", __FILE__)
4
+ require_relative "../config/boot"
5
+ require "rails/commands"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ require_relative "../config/boot"
4
+ require "rake"
5
+ Rake.application.run
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ # This file is used by Rack-based servers to start the application.
3
+
4
+ require ::File.expand_path("../config/environment", __FILE__)
5
+ run RailsApp::Application
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ require File.expand_path("../boot", __FILE__)
3
+
4
+ require "action_controller/railtie"
5
+ require "action_mailer/railtie"
6
+ require "rails/test_unit/railtie"
7
+
8
+ module RailsApp
9
+ class Application < Rails::Application
10
+ # Add additional load paths for your own custom dirs
11
+ config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers mailers views).include?($1) }
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ unless defined?(DEVISE_ORM)
3
+ DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
4
+ end
5
+
6
+ module Devise
7
+ # Detection for minor differences between Rails 4 and 5 in tests.
8
+ def self.rails5?
9
+ Rails.version.start_with? "5"
10
+ end
11
+ end
12
+
13
+ # Set up gems listed in the Gemfile.
14
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile", __FILE__)
15
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
@@ -0,0 +1,18 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: ":memory:"
15
+
16
+ production:
17
+ adapter: sqlite3
18
+ database: ":memory:"
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ # Load the rails application.
3
+ require File.expand_path("../application", __FILE__)
4
+
5
+ # Initialize the rails application.
6
+ RailsApp::Application.initialize!
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+ RailsApp::Application.configure do
3
+ # Settings specified here will take precedence over those in config/application.rb.
4
+
5
+ # In the development environment your application's code is reloaded on
6
+ # every request. This slows down response time but is perfect for development
7
+ # since you don't have to restart the web server when you make code changes.
8
+ config.cache_classes = false
9
+
10
+ # Do not eager load code on boot.
11
+ config.eager_load = false
12
+
13
+ # Show full error reports and disable caching.
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send.
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger.
21
+ config.active_support.deprecation = :log
22
+
23
+ # Only use best-standards-support built into browsers.
24
+ config.action_dispatch.best_standards_support = :builtin
25
+
26
+ # Raise an error on page load if there are pending migrations
27
+ config.active_record.migration_error = :page_load
28
+
29
+ # Debug mode disables concatenation and preprocessing of assets.
30
+ config.assets.debug = true
31
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+ RailsApp::Application.configure do
3
+ # Settings specified here will take precedence over those in config/application.rb.
4
+
5
+ # Code is not reloaded between requests.
6
+ config.cache_classes = true
7
+
8
+ # Eager load code on boot. This eager loads most of Rails and
9
+ # your application in memory, allowing both thread web servers
10
+ # and those relying on copy on write to perform better.
11
+ # Rake tasks automatically ignore this option for performance.
12
+ config.eager_load = true
13
+
14
+ # Full error reports are disabled and caching is turned on.
15
+ config.consider_all_requests_local = false
16
+ config.action_controller.perform_caching = true
17
+
18
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
19
+ # Add `rack-cache` to your Gemfile before enabling this.
20
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
21
+ # config.action_dispatch.rack_cache = true
22
+
23
+ # Disable Rails's static asset server (Apache or nginx will already do this).
24
+ if Rails.version >= "5.0.0"
25
+ config.public_file_server.enabled = false
26
+ elsif Rails.version >= "4.2.0"
27
+ config.serve_static_files = false
28
+ else
29
+ config.serve_static_assets = false
30
+ end
31
+
32
+ # Compress JavaScripts and CSS.
33
+ config.assets.js_compressor = :uglifier
34
+ # config.assets.css_compressor = :sass
35
+
36
+ # Whether to fallback to assets pipeline if a precompiled asset is missed.
37
+ config.assets.compile = false
38
+
39
+ # Generate digests for assets URLs.
40
+ config.assets.digest = true
41
+
42
+ # Version of your assets, change this if you want to expire all your assets.
43
+ config.assets.version = "1.0"
44
+
45
+ # Specifies the header that your server uses for sending files.
46
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
47
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
48
+
49
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
50
+ # config.force_ssl = true
51
+
52
+ # Set to :debug to see everything in the log.
53
+ config.log_level = :info
54
+
55
+ # Prepend all log lines with the following tags.
56
+ # config.log_tags = [:subdomain, :uuid]
57
+
58
+ # Use a different logger for distributed setups.
59
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
60
+
61
+ # Use a different cache store in production.
62
+ # config.cache_store = :mem_cache_store
63
+
64
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
65
+ # config.action_controller.asset_host = "http://assets.example.com"
66
+
67
+ # Precompile additional assets.
68
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
69
+ # config.assets.precompile += %w( search.js )
70
+
71
+ # Ignore bad email addresses and do not raise email delivery errors.
72
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
73
+ # config.action_mailer.raise_delivery_errors = false
74
+
75
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
76
+ # the I18n.default_locale when a translation can not be found).
77
+ config.i18n.fallbacks = true
78
+
79
+ # Send deprecation notices to registered listeners.
80
+ config.active_support.deprecation = :notify
81
+
82
+ # Disable automatic flushing of the log to improve performance.
83
+ # config.autoflush_log = false
84
+
85
+ # Use default logging formatter so that PID and timestamp are not suppressed.
86
+ config.log_formatter = ::Logger::Formatter.new
87
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+ RailsApp::Application.configure do
3
+ # Settings specified here will take precedence over those in config/application.rb.
4
+
5
+ # The test environment is used exclusively to run your application's
6
+ # test suite. You never need to work with it otherwise. Remember that
7
+ # your test database is "scratch space" for the test suite and is wiped
8
+ # and recreated between test runs. Don't rely on the data there!
9
+ config.cache_classes = true
10
+
11
+ # Do not eager load code on boot. This avoids loading your whole application
12
+ # just for the purpose of running a single test. If you are using a tool that
13
+ # preloads Rails for running tests, you may have to set it to true.
14
+ config.eager_load = false
15
+
16
+ # Disable serving static files from the `/public` folder by default since
17
+ # Apache or NGINX already handles this.
18
+ if Rails.version >= "5.0.0"
19
+ config.public_file_server.enabled = true
20
+ config.public_file_server.headers = {"Cache-Control" => "public, max-age=3600"}
21
+ elsif Rails.version >= "4.2.0"
22
+ config.serve_static_files = true
23
+ config.static_cache_control = "public, max-age=3600"
24
+ else
25
+ config.serve_static_assets = true
26
+ config.static_cache_control = "public, max-age=3600"
27
+ end
28
+
29
+ # Show full error reports and disable caching.
30
+ config.consider_all_requests_local = true
31
+ config.action_controller.perform_caching = false
32
+
33
+ # Raise exceptions instead of rendering exception templates.
34
+ config.action_dispatch.show_exceptions = false
35
+
36
+ # Disable request forgery protection in test environment.
37
+ config.action_controller.allow_forgery_protection = false
38
+
39
+ # Tell Action Mailer not to deliver emails to the real world.
40
+ # The :test delivery method accumulates sent emails in the
41
+ # ActionMailer::Base.deliveries array.
42
+ config.action_mailer.delivery_method = :test
43
+
44
+ # Print deprecation notices to the stderr.
45
+ config.active_support.deprecation = :stderr
46
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
5
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
6
+
7
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
8
+ Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+ ActiveSupport::Inflector.inflections do |inflect|
3
+ end