devise_materialize 0.0.4.test3 → 0.0.5.alpha
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.
- checksums.yaml +4 -4
- data/.codeclimate.yml +18 -0
- data/.gitignore +5 -0
- data/.rubocop.yml +5 -0
- data/.yardopts +1 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +33 -12
- data/README.md +52 -12
- data/Rakefile +21 -0
- data/circle.yml +21 -0
- data/devise_materialize.gemspec +6 -17
- data/lib/devise_materialize/version.rb +1 -1
- data/lib/generators/devise_materialize/install_generator.rb +17 -31
- data/lib/generators/templates/assets/stylesheets/devise.scss +53 -0
- data/lib/generators/templates/erb/simple_form/confirmations/new.html.erb +7 -6
- data/lib/generators/templates/erb/simple_form/mailer/unlock_instructions.html.erb +8 -1
- data/lib/generators/templates/erb/simple_form/passwords/edit.html.erb +36 -0
- data/lib/generators/templates/erb/simple_form/passwords/new.html.erb +30 -0
- data/lib/generators/templates/erb/simple_form/registrations/edit.html.erb +42 -0
- data/lib/generators/templates/erb/simple_form/registrations/new.html.erb +36 -0
- data/lib/generators/templates/erb/simple_form/sessions/new.html.erb +34 -0
- data/lib/generators/templates/erb/simple_form/shared/_links.html.erb +40 -0
- data/lib/generators/templates/erb/simple_form/unlocks/new.html.erb +30 -0
- data/lib/generators/templates/haml/simple_form/confirmations/new.html.haml +1 -1
- data/lib/generators/templates/haml/simple_form/passwords/edit.html.haml +23 -16
- data/lib/generators/templates/haml/simple_form/passwords/new.html.haml +19 -12
- data/lib/generators/templates/haml/simple_form/registrations/edit.html.haml +1 -1
- data/lib/generators/templates/haml/simple_form/registrations/new.html.haml +23 -16
- data/lib/generators/templates/haml/simple_form/sessions/new.html.haml +22 -15
- data/lib/generators/templates/haml/simple_form/unlocks/new.html.haml +19 -12
- data/lib/generators/templates/helpers/devise_helper.rb +18 -0
- data/lib/generators/templates/slim/simple_form/confirmations/new.html.slim +21 -0
- data/lib/generators/templates/slim/simple_form/mailer/confirmation_instructions.html.slim +30 -0
- data/lib/generators/templates/slim/simple_form/mailer/password_change.html.slim +31 -0
- data/lib/generators/templates/slim/simple_form/mailer/reset_password_instructions.html.slim +38 -0
- data/lib/generators/templates/slim/simple_form/mailer/unlock_instructions.html.slim +35 -0
- data/lib/generators/templates/slim/simple_form/passwords/edit.html.slim +23 -0
- data/lib/generators/templates/slim/simple_form/passwords/new.html.slim +20 -0
- data/lib/generators/templates/slim/simple_form/registrations/edit.html.slim +30 -0
- data/lib/generators/templates/slim/simple_form/registrations/new.html.slim +24 -0
- data/lib/generators/templates/slim/simple_form/sessions/new.html.slim +23 -0
- data/lib/generators/templates/slim/simple_form/shared/_links.html.slim +29 -0
- data/lib/generators/templates/slim/simple_form/unlocks/new.html.slim +20 -0
- data/test/devise_materialize_test.rb +5 -0
- data/test/lib/install_generator_test.rb +92 -0
- data/test/rails_app/Rakefile +8 -0
- data/test/rails_app/app/controllers/application_controller.rb +7 -0
- data/test/rails_app/app/controllers/home_controller.rb +5 -0
- data/test/rails_app/app/helpers/application_helper.rb +4 -0
- data/test/rails_app/app/views/home/index.html.erb +1 -0
- data/test/rails_app/app/views/layouts/application.html.erb +13 -0
- data/test/rails_app/bin/bundle +4 -0
- data/test/rails_app/bin/rails +5 -0
- data/test/rails_app/bin/rake +5 -0
- data/test/rails_app/config.ru +5 -0
- data/test/rails_app/config/application.rb +13 -0
- data/test/rails_app/config/boot.rb +15 -0
- data/test/rails_app/config/database.yml +18 -0
- data/test/rails_app/config/environment.rb +6 -0
- data/test/rails_app/config/environments/development.rb +31 -0
- data/test/rails_app/config/environments/production.rb +87 -0
- data/test/rails_app/config/environments/test.rb +46 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +8 -0
- data/test/rails_app/config/initializers/inflections.rb +3 -0
- data/test/rails_app/config/initializers/secret_token.rb +4 -0
- data/test/rails_app/config/initializers/session_store.rb +2 -0
- data/test/rails_app/config/routes.rb +4 -0
- data/test/rails_app/log/test.log +288 -0
- data/test/rails_app/public/404.html +26 -0
- data/test/rails_app/public/422.html +26 -0
- data/test/rails_app/public/500.html +26 -0
- data/{lib/generators/templates/.keep → test/rails_app/public/favicon.ico} +0 -0
- data/test/test_helper.rb +31 -0
- metadata +79 -68
- data/lib/generators/devise_materialize/USAGE +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 70fb15b8ae846f427cd583a498f91703e0014b87
|
|
4
|
+
data.tar.gz: 49ad450160eee861edd0523072cc5600881e1f56
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bfce59a98a2725110961c881a9fdfaf78d86671f7bd0116635a42240746f9d57ca56a0b00fee66241da3a7d41fa571b30bb2413420608727de83641e592dafc8
|
|
7
|
+
data.tar.gz: 27ce61743bd08ac9d55af5569e7f39f71f989a58b64e79ee0ef29cba1efe3b24c916eb8fd2a9e3ad024403fe6d7235099f4e97d7f4a0a3587da587aa79a9345a
|
data/.codeclimate.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
engines:
|
|
3
|
+
duplication:
|
|
4
|
+
enabled: true
|
|
5
|
+
config:
|
|
6
|
+
languages:
|
|
7
|
+
- ruby
|
|
8
|
+
fixme:
|
|
9
|
+
enabled: true
|
|
10
|
+
rubocop:
|
|
11
|
+
enabled: true
|
|
12
|
+
ratings:
|
|
13
|
+
paths:
|
|
14
|
+
- "**.rb"
|
|
15
|
+
exclude_paths:
|
|
16
|
+
- vendor/
|
|
17
|
+
- test/rails_app
|
|
18
|
+
- lib/generators/templates
|
data/.gitignore
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
/test/tmp/
|
|
10
10
|
/test/version_tmp/
|
|
11
11
|
/tmp/
|
|
12
|
+
/test/reports/
|
|
12
13
|
|
|
13
14
|
# Used by dotenv library to load environment variables.
|
|
14
15
|
# .env
|
|
@@ -48,3 +49,7 @@ build-iPhoneSimulator/
|
|
|
48
49
|
|
|
49
50
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
50
51
|
.rvmrc
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# Linter outputs
|
|
55
|
+
rubocop-results.html
|
data/.rubocop.yml
CHANGED
|
@@ -6,6 +6,7 @@ AllCops:
|
|
|
6
6
|
- Gemfile.lock
|
|
7
7
|
- devise_materialize.gemspec
|
|
8
8
|
- Rakefile
|
|
9
|
+
- test/rails_app/**/*
|
|
9
10
|
TargetRubyVersion: 2.4
|
|
10
11
|
Lint/AmbiguousOperator:
|
|
11
12
|
Description: Checks for ambiguous operators in the first argument of a method invocation
|
|
@@ -156,6 +157,8 @@ Metrics/AbcSize:
|
|
|
156
157
|
Reference: http://c2.com/cgi/wiki?AbcMetric
|
|
157
158
|
Enabled: true
|
|
158
159
|
Max: 15
|
|
160
|
+
Exclude:
|
|
161
|
+
- test/lib/install_generator_test.rb
|
|
159
162
|
Metrics/BlockNesting:
|
|
160
163
|
Description: Avoid excessive block nesting
|
|
161
164
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count
|
|
@@ -178,6 +181,8 @@ Metrics/MethodLength:
|
|
|
178
181
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
|
|
179
182
|
Enabled: true
|
|
180
183
|
Max: 10
|
|
184
|
+
Exclude:
|
|
185
|
+
- test/lib/install_generator_test.rb
|
|
181
186
|
Metrics/ModuleLength:
|
|
182
187
|
Description: Avoid modules longer than 100 lines of code.
|
|
183
188
|
Enabled: true
|
data/.yardopts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--exclude /templates/
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
devise_materialize (0.0.
|
|
5
|
-
|
|
4
|
+
devise_materialize (0.0.5.alpha)
|
|
5
|
+
railties (>= 4.1.0, < 5.1)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
@@ -45,13 +45,17 @@ GEM
|
|
|
45
45
|
minitest (~> 5.1)
|
|
46
46
|
tzinfo (~> 1.1)
|
|
47
47
|
arel (7.1.4)
|
|
48
|
+
ast (2.3.0)
|
|
48
49
|
builder (3.2.3)
|
|
49
|
-
|
|
50
|
+
codeclimate-test-reporter (1.0.5)
|
|
51
|
+
simplecov
|
|
50
52
|
concurrent-ruby (1.0.4)
|
|
53
|
+
docile (1.1.5)
|
|
51
54
|
erubis (2.7.0)
|
|
52
55
|
globalid (0.3.7)
|
|
53
56
|
activesupport (>= 4.1.0)
|
|
54
57
|
i18n (0.8.0)
|
|
58
|
+
json (2.0.3)
|
|
55
59
|
loofah (2.0.3)
|
|
56
60
|
nokogiri (>= 1.5.9)
|
|
57
61
|
mail (2.6.4)
|
|
@@ -62,13 +66,14 @@ GEM
|
|
|
62
66
|
mime-types-data (3.2016.0521)
|
|
63
67
|
mini_portile2 (2.1.0)
|
|
64
68
|
minitest (5.10.1)
|
|
69
|
+
minitest-ci (3.1.0)
|
|
70
|
+
minitest (~> 5.0, >= 5.0.6)
|
|
65
71
|
nio4r (1.2.1)
|
|
66
72
|
nokogiri (1.7.0.1)
|
|
67
73
|
mini_portile2 (~> 2.1.0)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
slop (~> 3.4)
|
|
74
|
+
parser (2.3.3.1)
|
|
75
|
+
ast (~> 2.2)
|
|
76
|
+
powerpack (0.1.1)
|
|
72
77
|
rack (2.0.1)
|
|
73
78
|
rack-test (0.6.3)
|
|
74
79
|
rack (>= 1.0)
|
|
@@ -95,8 +100,20 @@ GEM
|
|
|
95
100
|
method_source
|
|
96
101
|
rake (>= 0.8.7)
|
|
97
102
|
thor (>= 0.18.1, < 2.0)
|
|
103
|
+
rainbow (2.2.1)
|
|
98
104
|
rake (10.5.0)
|
|
99
|
-
|
|
105
|
+
rubocop (0.47.1)
|
|
106
|
+
parser (>= 2.3.3.1, < 3.0)
|
|
107
|
+
powerpack (~> 0.1)
|
|
108
|
+
rainbow (>= 1.99.1, < 3.0)
|
|
109
|
+
ruby-progressbar (~> 1.7)
|
|
110
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
111
|
+
ruby-progressbar (1.8.1)
|
|
112
|
+
simplecov (0.13.0)
|
|
113
|
+
docile (~> 1.1.0)
|
|
114
|
+
json (>= 1.8, < 3)
|
|
115
|
+
simplecov-html (~> 0.10.0)
|
|
116
|
+
simplecov-html (0.10.0)
|
|
100
117
|
sprockets (3.7.1)
|
|
101
118
|
concurrent-ruby (~> 1.0)
|
|
102
119
|
rack (> 1, < 3)
|
|
@@ -108,19 +125,23 @@ GEM
|
|
|
108
125
|
thread_safe (0.3.5)
|
|
109
126
|
tzinfo (1.2.2)
|
|
110
127
|
thread_safe (~> 0.1)
|
|
128
|
+
unicode-display_width (1.1.3)
|
|
111
129
|
websocket-driver (0.6.5)
|
|
112
130
|
websocket-extensions (>= 0.1.0)
|
|
113
131
|
websocket-extensions (0.1.2)
|
|
132
|
+
yard (0.9.8)
|
|
114
133
|
|
|
115
134
|
PLATFORMS
|
|
116
135
|
ruby
|
|
117
136
|
|
|
118
137
|
DEPENDENCIES
|
|
119
|
-
|
|
138
|
+
codeclimate-test-reporter
|
|
120
139
|
devise_materialize!
|
|
121
|
-
minitest
|
|
122
|
-
|
|
123
|
-
|
|
140
|
+
minitest-ci
|
|
141
|
+
rails (~> 5.0.0)
|
|
142
|
+
rubocop
|
|
143
|
+
simplecov
|
|
144
|
+
yard
|
|
124
145
|
|
|
125
146
|
BUNDLED WITH
|
|
126
147
|
1.13.7
|
data/README.md
CHANGED
|
@@ -1,39 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Devise
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://rubygems.org/gems/devise_materialize)
|
|
4
|
+
[](https://circleci.com/gh/techgurupezza/devise_materialize)
|
|
5
|
+
[](https://lima.codeclimate.com/github/techgurupezza/devise_materialize)
|
|
6
|
+
[](https://lima.codeclimate.com/github/techgurupezza/devise_materialize/coverage)
|
|
7
|
+
[](https://gemnasium.com/github.com/techgurupezza/devise_materialize)
|
|
8
|
+
[](https://rubygems.org/gems/devise_materialize)
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
|
|
11
|
+
Devise Materialize gem is here to generate you devise view in a materialize styled format with or w/o simple_form.
|
|
12
|
+
This gem is not intended to live forever in your gemfile. It must be in your gemfile to load the resources needed from the generator.
|
|
13
|
+
Below in the installation section will detail out which gems to install for all to work.
|
|
6
14
|
|
|
7
15
|
## Installation
|
|
8
16
|
|
|
9
|
-
Add
|
|
17
|
+
Add these lines to your application's Gemfile:
|
|
10
18
|
|
|
11
19
|
```ruby
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
# Required gems so you don't have to add files manually
|
|
21
|
+
gem "devise"
|
|
22
|
+
gem "materialize-sass"
|
|
23
|
+
gem "material_icons"
|
|
14
24
|
|
|
15
|
-
|
|
25
|
+
# Required if using HAML
|
|
26
|
+
gem "haml"
|
|
16
27
|
|
|
17
|
-
|
|
28
|
+
# Required if using Slim
|
|
29
|
+
gem "slim"
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
# Required if using Simple Form
|
|
32
|
+
gem "simple_form"
|
|
20
33
|
|
|
21
|
-
|
|
34
|
+
gem "devise_materialize", "~>1.0.0"
|
|
35
|
+
```
|
|
22
36
|
|
|
23
37
|
## Usage
|
|
24
38
|
|
|
25
|
-
|
|
39
|
+
[devise](https://github.com/plataformatec/devise), [materialize-sass](https://github.com/mkhairi/materialize-sass) and [material_icons](https://github.com/Angelmmiguel/material_icons) are required in your gemfile to enable the views to generate without error and in the proper style.
|
|
40
|
+
|
|
41
|
+
| Command Line Flags | Description | Defaults | Options |
|
|
42
|
+
| ----------------------- | -------------------------------------- | -------- | ------------------------ |
|
|
43
|
+
| NAMESPACE | What is the model name used for devise | Devise | Devise, Users, Admins, etc |
|
|
44
|
+
| -f / --form-engine | Define a form Engine to use | default | default, simple_form |
|
|
45
|
+
| -v / --view-engine | Define a View Engine to use | erb | erb, haml, slim |
|
|
46
|
+
|
|
47
|
+
### Basic Usage
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
$ rails g devise_materialize:install
|
|
51
|
+
```
|
|
52
|
+
This will generate the basic views of devise based on defaults
|
|
53
|
+
|
|
54
|
+
### Parameters Defined
|
|
55
|
+
|
|
56
|
+
If you plan to use simple form using this gem [simple_form_materialize](https://github.com/techgurupezza/simple_form_materialize) to install a config file with all wrappers defined as used in this gem.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
$ rails g devise_materialize:install Users --form-engine simple_form --view-engine haml
|
|
60
|
+
```
|
|
61
|
+
This will generate the views in simple form usage and HAML syntax
|
|
26
62
|
|
|
27
63
|
## Development
|
|
28
64
|
|
|
29
65
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
66
|
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake
|
|
67
|
+
To install this gem onto your local machine, run `bundle exec rake build`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
68
|
|
|
33
69
|
## Contributing
|
|
34
70
|
|
|
35
71
|
Bug reports and pull requests are welcome on GitHub at https://github.com/techgurupezza/devise_materialize. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
36
72
|
|
|
73
|
+
1. Fork Repo and create new branch
|
|
74
|
+
2. Once all is changed and committed create a pull request.
|
|
75
|
+
|
|
76
|
+
**Ensure all merge conflicts are fixed and CI is passing.**
|
|
37
77
|
|
|
38
78
|
## License
|
|
39
79
|
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
2
|
require "rake/testtask"
|
|
3
|
+
require "rubocop/rake_task"
|
|
4
|
+
|
|
5
|
+
if ENV['CIRCLECI']
|
|
6
|
+
dir = File.join(ENV['CIRCLE_ARTIFACTS'], 'linters')
|
|
7
|
+
end
|
|
3
8
|
|
|
4
9
|
Rake::TestTask.new(:test) do |t|
|
|
5
10
|
t.libs << "test"
|
|
@@ -7,4 +12,20 @@ Rake::TestTask.new(:test) do |t|
|
|
|
7
12
|
t.test_files = FileList['test/**/*_test.rb']
|
|
8
13
|
end
|
|
9
14
|
|
|
15
|
+
desc 'Rubocop Task'
|
|
16
|
+
task (:rubocop) do
|
|
17
|
+
outputpath =
|
|
18
|
+
if ENV['CIRCLECI']
|
|
19
|
+
"#{dir}/rubocop-results.html"
|
|
20
|
+
else
|
|
21
|
+
'rubocop-results.html'
|
|
22
|
+
end
|
|
23
|
+
RuboCop::RakeTask.new do |t|
|
|
24
|
+
t.options = [
|
|
25
|
+
'-c', '.rubocop.yml', '-D', '-f', 'html', '-o', outputpath,
|
|
26
|
+
]
|
|
27
|
+
t.fail_on_error = true
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
10
31
|
task default: :test
|
data/circle.yml
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
machine:
|
|
2
|
+
timezone: America/New_York
|
|
3
|
+
ruby:
|
|
4
|
+
version: 2.4.0
|
|
5
|
+
|
|
6
|
+
dependencies:
|
|
7
|
+
pre:
|
|
8
|
+
- gem update --system
|
|
9
|
+
- gem install rainbow -v "2.2.1"
|
|
10
|
+
- gem install bundler
|
|
11
|
+
|
|
12
|
+
test:
|
|
13
|
+
override:
|
|
14
|
+
- bundle exec rake test:
|
|
15
|
+
parallel: true
|
|
16
|
+
files:
|
|
17
|
+
- test/**/*_test.rb
|
|
18
|
+
|
|
19
|
+
post:
|
|
20
|
+
- bundle exec codeclimate-test-reporter
|
|
21
|
+
- bundle exec rake rubocop
|
data/devise_materialize.gemspec
CHANGED
|
@@ -7,6 +7,7 @@ require "devise_materialize/version"
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = "devise_materialize"
|
|
9
9
|
spec.version = DeviseMaterialize::VERSION
|
|
10
|
+
spec.platform = Gem::Platform::RUBY
|
|
10
11
|
spec.authors = ["Christopher Pezza"]
|
|
11
12
|
spec.email = ["pezza.chris@gmail.com"]
|
|
12
13
|
|
|
@@ -17,25 +18,13 @@ Gem::Specification.new do |spec|
|
|
|
17
18
|
spec.homepage = "https://github.com/techgurupezza/devise_materialize"
|
|
18
19
|
spec.license = "MIT"
|
|
19
20
|
|
|
20
|
-
if spec.respond_to?(:metadata)
|
|
21
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
22
|
-
else
|
|
23
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
24
|
-
"public gem pushes."
|
|
25
|
-
end
|
|
26
21
|
|
|
27
|
-
spec.files
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
spec.bindir = "exe"
|
|
32
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
|
+
spec.files = `git ls-files`.split("\n")
|
|
23
|
+
spec.test_files = `git ls-files -- test/*`.split("\n")
|
|
33
24
|
spec.require_paths = ["lib"]
|
|
34
25
|
|
|
35
|
-
spec.
|
|
26
|
+
spec.required_ruby_version = ">= 2.2.0"
|
|
27
|
+
spec.required_rubygems_version = "> 1.3.1"
|
|
36
28
|
|
|
37
|
-
spec.
|
|
38
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
|
39
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
|
40
|
-
spec.add_development_dependency "pry", "~> 0.10.4"
|
|
29
|
+
spec.add_dependency("railties", ">= 4.1.0", "< 5.1")
|
|
41
30
|
end
|
|
@@ -1,46 +1,32 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
require "rails/generators"
|
|
3
|
+
|
|
2
4
|
module DeviseMaterialize
|
|
3
5
|
class InstallGenerator < Rails::Generators::Base
|
|
4
6
|
source_root File.expand_path("../../templates", __FILE__)
|
|
5
7
|
|
|
6
8
|
desc "Creates a Devise Materialize Styled Views"
|
|
7
|
-
argument :namespace, type: :string,
|
|
8
|
-
class_option :
|
|
9
|
-
|
|
10
|
-
"to load views built with simple form"
|
|
11
|
-
class_option :template_engine, type: :string, default: "erb", alias: "-e",
|
|
12
|
-
description: "Choose a template engine " \
|
|
13
|
-
"from erb, haml, or slim"
|
|
9
|
+
argument :namespace, type: :string, default: "Devise"
|
|
10
|
+
class_option :form_engine, type: :string, default: "default", aliases: "-f"
|
|
11
|
+
class_option :view_engine, type: :string, default: "erb", aliases: "-v"
|
|
14
12
|
|
|
15
13
|
def generate_views
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
puts "Generating Views..."
|
|
15
|
+
directory "#{options.view_engine.downcase}/#{options.form_engine}",
|
|
16
|
+
"app/views/#{file_name}"
|
|
17
|
+
puts "Generating Stylesheet..."
|
|
18
|
+
directory "assets", "app/assets/"
|
|
19
|
+
puts "Generating Devise Helper..."
|
|
20
|
+
directory "helpers", "app/helpers"
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
private
|
|
24
24
|
|
|
25
|
-
def
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
directory "haml/simple_form", "app/views/#{namespace.downcase}"
|
|
31
|
-
when "slim"
|
|
32
|
-
directory "slim/simple_form", "app/views/#{namespace.downcase}"
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def default_views(data)
|
|
37
|
-
case data
|
|
38
|
-
when "erb"
|
|
39
|
-
directory "erb/defaults", "app/views/#{namespace.downcase}"
|
|
40
|
-
when "haml"
|
|
41
|
-
directory "haml/defaults", "app/views/#{namespace.downcase}"
|
|
42
|
-
when "slim"
|
|
43
|
-
directory "slim/defaults", "app/views/#{namespace.downcase}"
|
|
25
|
+
def file_name
|
|
26
|
+
if namespace.casecmp("devise").zero?
|
|
27
|
+
namespace.downcase.underscore
|
|
28
|
+
else
|
|
29
|
+
namespace.downcase.underscore.pluralize
|
|
44
30
|
end
|
|
45
31
|
end
|
|
46
32
|
end
|