slim-rails 3.1.3 → 3.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +40 -0
- data/README.md +12 -6
- data/lib/generators/slim/controller/controller_generator.rb +3 -3
- data/lib/generators/slim/mailer/mailer_generator.rb +3 -2
- data/lib/generators/slim/mailer/templates/view.html.slim +1 -1
- data/lib/generators/slim/mailer/templates/view.text.slim +1 -1
- data/lib/generators/slim/scaffold/legacy_templates/edit.html.slim.tt +7 -0
- data/lib/generators/slim/scaffold/{templates/index.html.slim → legacy_templates/index.html.slim.tt} +4 -4
- data/lib/generators/slim/scaffold/legacy_templates/new.html.slim.tt +5 -0
- data/lib/generators/slim/scaffold/{templates/show.html.slim → legacy_templates/show.html.slim.tt} +3 -3
- data/lib/generators/slim/scaffold/scaffold_generator.rb +14 -5
- data/lib/generators/slim/scaffold/templates/_form.html.slim.tt +28 -0
- data/lib/generators/slim/scaffold/templates/edit.html.slim.tt +10 -0
- data/lib/generators/slim/scaffold/templates/index.html.slim.tt +11 -0
- data/lib/generators/slim/scaffold/templates/new.html.slim.tt +8 -0
- data/lib/generators/slim/scaffold/templates/partial.html.slim.tt +14 -0
- data/lib/generators/slim/scaffold/templates/show.html.slim.tt +10 -0
- data/lib/slim-rails/register_engine.rb +26 -23
- data/lib/slim-rails/version.rb +1 -1
- data/lib/slim-rails.rb +8 -8
- metadata +64 -42
- data/.gitignore +0 -20
- data/.travis.yml +0 -33
- data/Appraisals +0 -21
- data/Gemfile +0 -3
- data/Rakefile +0 -12
- data/gemfiles/rails_3.gemfile +0 -9
- data/gemfiles/rails_4.1.gemfile +0 -7
- data/gemfiles/rails_4.2.gemfile +0 -7
- data/gemfiles/rails_4.gemfile +0 -7
- data/gemfiles/rails_5.gemfile +0 -7
- data/lib/generators/slim/scaffold/templates/edit.html.slim +0 -8
- data/lib/generators/slim/scaffold/templates/new.html.slim +0 -5
- data/slim-rails.gemspec +0 -34
- data/test/fixtures/routes.rb +0 -58
- data/test/lib/generators/slim/controller_generator_test.rb +0 -17
- data/test/lib/generators/slim/mailer_generator_test.rb +0 -70
- data/test/lib/generators/slim/scaffold_generator_test.rb +0 -26
- data/test/lib/generators/slim/testing_helper.rb +0 -1
- data/test/lib/slim-rails_assets_test.rb +0 -34
- data/test/test_helper.rb +0 -66
- /data/lib/generators/slim/scaffold/{templates/_form.html.slim → legacy_templates/_form.html.slim.tt} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 23256a5c386378763c0d2b7a8b521c0678266b8e5e4c1f6a7d979d6aa1a324eb
|
4
|
+
data.tar.gz: af9ad07273823090a9f658d546dcd4377e1d1e4a5d1b3dc3cfc8295d32b560aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be908a61dc57ec4577bb12a5032cb12ff225537cd0fb1981e62454c1eb7537f16cf04518ba5d928352f94dc0d71e53649f411aca5e87bb50949a634849112cd3
|
7
|
+
data.tar.gz: aff344cd89822d7410df81f8704a06558cafddb60519ae3f054a0315be52ab272f4d870d2f2e66324cbfce12c9c56847a07880e0a0e4133a98b8e8f5e3539260
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,43 @@
|
|
1
|
+
## 3.6.1 (February 14, 2023)
|
2
|
+
|
3
|
+
- Fix to avoid depending on the failed Slim 5.0.0 release ([#188])
|
4
|
+
|
5
|
+
[#188]: https://github.com/slim-template/slim-rails/pull/188
|
6
|
+
|
7
|
+
## 3.6.0 (February 14, 2023)
|
8
|
+
|
9
|
+
- Add support for Slim 5 ([#185])
|
10
|
+
|
11
|
+
Thanks https://github.com/michaelbaudino ([#185])
|
12
|
+
|
13
|
+
[#185]: https://github.com/slim-template/slim-rails/pull/185
|
14
|
+
|
15
|
+
## 3.5.0 (May 2022)
|
16
|
+
|
17
|
+
* Restored legacy templates for Rails < 7
|
18
|
+
* Updated Appraisals to supported Rails versions
|
19
|
+
* Replace Travis CI with Github Actions.
|
20
|
+
|
21
|
+
Thanks https://github.com/davidwessman (#180)
|
22
|
+
|
23
|
+
|
24
|
+
## 3.4.0 (March 2022)
|
25
|
+
|
26
|
+
* Updated templates to Rails 7 style (thanks github.com/viktorianer) (#178)
|
27
|
+
|
28
|
+
|
29
|
+
## 3.3.0 (July 19, 2021)
|
30
|
+
|
31
|
+
* Enabled asset helpers in precompiled templates (#135)
|
32
|
+
* Tested with Rails 6.0, 6.1 and Ruby 3.0
|
33
|
+
* Improved CI and tests with Sprockets 4
|
34
|
+
|
35
|
+
|
36
|
+
## 3.2.0 (October 7, 2018)
|
37
|
+
|
38
|
+
* Support for Slim 4
|
39
|
+
|
40
|
+
|
1
41
|
## 3.1.3 (April 3, 2017)
|
2
42
|
|
3
43
|
* Improved compatibility with Sprockets 4
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# slim-rails [![
|
1
|
+
# slim-rails [![Gem Version](https://img.shields.io/gem/v/slim-rails.svg)](http://rubygems.org/gems/slim-rails) [![Build Status](https://github.com/slim-template/slim-rails/actions/workflows/main.yml/badge.svg)](https://github.com/slim-template/slim-rails/actions/workflows/main.yml) [![Code Climate](https://codeclimate.com/github/slim-template/slim-rails/badges/gpa.svg)](https://codeclimate.com/github/slim-template/slim-rails)
|
2
2
|
|
3
|
-
slim-rails provides Slim generators for Rails
|
4
|
-
[haml-rails](http://github.com/indirect/haml-rails) and it does basically the
|
5
|
-
same:
|
3
|
+
slim-rails provides Slim generators for Rails:
|
6
4
|
|
7
5
|
* Any time you generate a controller or scaffold, you'll get Slim templates
|
8
6
|
(instead of ERB)
|
@@ -18,6 +16,14 @@ gem "slim-rails"
|
|
18
16
|
|
19
17
|
And that's it.
|
20
18
|
|
21
|
-
|
19
|
+
Every time you generate a controller or scaffold, you'll get Slim templates.
|
20
|
+
|
21
|
+
If you have existing `.erb` templates, check out our guide [How to convert your `.erb` templates to `.slim`](https://github.com/slim-template/slim/wiki/Template-Converters-ERB-to-SLIM) on how to achieve this.
|
22
|
+
|
23
|
+
This gem is [tested with Ruby on Rails 5.2+](/.github/workflows/main.yml).
|
22
24
|
|
23
|
-
|
25
|
+
## History
|
26
|
+
|
27
|
+
`slim-rails` was based on [haml-rails](https://github.com/haml/haml-rails) and it does basically the same thing.
|
28
|
+
|
29
|
+
From the version 0.2.0, there is no need to include gem "slim" in your Gemfile.
|
@@ -1,15 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require "rails/generators/erb/controller/controller_generator"
|
2
2
|
|
3
3
|
module Slim
|
4
4
|
module Generators
|
5
5
|
class ControllerGenerator < Erb::Generators::ControllerGenerator
|
6
|
-
source_root File.expand_path(File.join(
|
6
|
+
source_root File.expand_path(File.join("..", "templates"), __FILE__)
|
7
7
|
|
8
8
|
protected
|
9
|
+
|
9
10
|
def handler
|
10
11
|
:slim
|
11
12
|
end
|
12
|
-
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -1,11 +1,12 @@
|
|
1
|
-
require
|
1
|
+
require "rails/generators/erb/mailer/mailer_generator"
|
2
2
|
|
3
3
|
module Slim
|
4
4
|
module Generators
|
5
5
|
class MailerGenerator < Erb::Generators::MailerGenerator
|
6
|
-
source_root File.expand_path(File.join(
|
6
|
+
source_root File.expand_path(File.join("..", "templates"), __FILE__)
|
7
7
|
|
8
8
|
protected
|
9
|
+
|
9
10
|
def format
|
10
11
|
:text
|
11
12
|
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
h1 <%= class_name %>#<%= @action %>
|
2
|
-
p = @greeting
|
2
|
+
p = "#{@greeting}, find me in <%= @path %>"
|
data/lib/generators/slim/scaffold/{templates/index.html.slim → legacy_templates/index.html.slim.tt}
RENAMED
@@ -16,10 +16,10 @@ table
|
|
16
16
|
<% attributes.each do |attribute| -%>
|
17
17
|
td = <%= singular_table_name %>.<%= attribute.name %>
|
18
18
|
<% end -%>
|
19
|
-
td = link_to
|
20
|
-
td = link_to
|
21
|
-
td = link_to
|
19
|
+
td = link_to "Show", <%= singular_table_name %>
|
20
|
+
td = link_to "Edit", edit_<%= singular_table_name %>_path(<%= singular_table_name %>)
|
21
|
+
td = link_to "Destroy", <%= singular_table_name %>, data: {confirm: "Are you sure?"}, method: :delete
|
22
22
|
|
23
23
|
br
|
24
24
|
|
25
|
-
= link_to
|
25
|
+
= link_to "New <%= human_name %>", new_<%= singular_table_name %>_path
|
data/lib/generators/slim/scaffold/{templates/show.html.slim → legacy_templates/show.html.slim.tt}
RENAMED
@@ -1,11 +1,11 @@
|
|
1
1
|
p#notice = notice
|
2
|
-
|
3
2
|
<% attributes.each do |attribute| -%>
|
3
|
+
|
4
4
|
p
|
5
5
|
strong <%= attribute.human_name %>:
|
6
6
|
= @<%= singular_table_name %>.<%= attribute.name %>
|
7
7
|
<% end -%>
|
8
8
|
|
9
|
-
=> link_to
|
9
|
+
=> link_to "Edit", edit_<%= singular_table_name %>_path(@<%= singular_table_name %>)
|
10
10
|
'|
|
11
|
-
=< link_to
|
11
|
+
=< link_to "Back", <%= index_helper %>_path
|
@@ -1,22 +1,31 @@
|
|
1
|
-
require
|
1
|
+
require "rails/generators/erb/scaffold/scaffold_generator"
|
2
2
|
|
3
3
|
module Slim
|
4
4
|
module Generators
|
5
|
-
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
6
|
-
|
5
|
+
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator # :nodoc:
|
6
|
+
if ::Rails::VERSION::MAJOR >= 7
|
7
|
+
source_root File.expand_path(File.join("..", "templates"), __FILE__)
|
8
|
+
else
|
9
|
+
source_root File.expand_path(File.join("..", "legacy_templates"), __FILE__)
|
10
|
+
end
|
7
11
|
|
8
12
|
def copy_view_files
|
9
13
|
available_views.each do |view|
|
10
14
|
filename = filename_with_extensions view
|
11
|
-
template "#{view}.html.slim", File.join(
|
15
|
+
template "#{view}.html.slim", File.join("app", "views", controller_file_path, filename)
|
16
|
+
end
|
17
|
+
|
18
|
+
if ::Rails::VERSION::MAJOR >= 7
|
19
|
+
template "partial.html.slim", File.join("app/views", controller_file_path, "_#{singular_name}.html.slim")
|
12
20
|
end
|
13
21
|
end
|
14
22
|
|
15
23
|
hook_for :form_builder, as: :scaffold
|
16
24
|
|
17
25
|
protected
|
26
|
+
|
18
27
|
def available_views
|
19
|
-
[
|
28
|
+
%w[index edit show new _form]
|
20
29
|
end
|
21
30
|
|
22
31
|
def handler
|
@@ -0,0 +1,28 @@
|
|
1
|
+
= form_with(model: @<%= model_resource_name %>) do |form|
|
2
|
+
- if @<%= singular_table_name %>.errors.any?
|
3
|
+
div style="color: red"
|
4
|
+
h2 = "#{pluralize(@<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"
|
5
|
+
ul
|
6
|
+
- @<%= singular_table_name %>.errors.each do |error|
|
7
|
+
li = error.full_message
|
8
|
+
|
9
|
+
<% attributes.each do |attribute| -%>
|
10
|
+
div
|
11
|
+
<% if attribute.password_digest? -%>
|
12
|
+
= form.label :password, style: "display: block"
|
13
|
+
= form.password_field :password
|
14
|
+
|
15
|
+
div
|
16
|
+
= form.label :password_confirmation, style: "display: block"
|
17
|
+
= form.password_field :password_confirmation
|
18
|
+
<% elsif attribute.attachments? -%>
|
19
|
+
= form.label :<%= attribute.column_name %>, style: "display: block"
|
20
|
+
= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true
|
21
|
+
<% else -%>
|
22
|
+
= form.label :<%= attribute.column_name %>, style: "display: block"
|
23
|
+
= form.<%= attribute.field_type %> :<%= attribute.column_name %>
|
24
|
+
<% end -%>
|
25
|
+
|
26
|
+
<% end -%>
|
27
|
+
div
|
28
|
+
= form.submit
|
@@ -0,0 +1,10 @@
|
|
1
|
+
h1 Editing <%= human_name.downcase %>
|
2
|
+
|
3
|
+
== render "form", <%= singular_table_name %>: @<%= singular_table_name %>
|
4
|
+
|
5
|
+
br
|
6
|
+
|
7
|
+
div
|
8
|
+
=> link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>
|
9
|
+
'|
|
10
|
+
=< link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
p style="color: green" = notice
|
2
|
+
|
3
|
+
h1 <%= human_name.pluralize %>
|
4
|
+
|
5
|
+
#<%= plural_table_name %>
|
6
|
+
- @<%= plural_table_name %>.each do |<%= singular_table_name %>|
|
7
|
+
== render <%= singular_table_name %>
|
8
|
+
p
|
9
|
+
= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(singular_table_name) %>
|
10
|
+
|
11
|
+
= link_to "New <%= human_name.downcase %>", <%= new_helper(type: :path) %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
div id="#{dom_id <%= singular_name %>}"
|
2
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
3
|
+
p
|
4
|
+
strong <%= attribute.human_name %>:
|
5
|
+
<% if attribute.attachment? -%>
|
6
|
+
= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached?
|
7
|
+
<% elsif attribute.attachments? -%>
|
8
|
+
- <%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>|
|
9
|
+
div
|
10
|
+
= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %>
|
11
|
+
<% else -%>
|
12
|
+
=< <%= singular_name %>.<%= attribute.column_name %>
|
13
|
+
<% end -%>
|
14
|
+
<% end -%>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
p style="color: green" = notice
|
2
|
+
|
3
|
+
== render @<%= singular_table_name %>
|
4
|
+
|
5
|
+
div
|
6
|
+
=> link_to "Edit this <%= human_name.downcase %>", <%= edit_helper(type: :path) %>
|
7
|
+
'|
|
8
|
+
=< link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %>
|
9
|
+
|
10
|
+
= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete
|
@@ -3,38 +3,41 @@ module Slim
|
|
3
3
|
module RegisterEngine
|
4
4
|
class Transformer
|
5
5
|
def self.call(input)
|
6
|
-
|
6
|
+
context = input[:environment].context_class.new(input)
|
7
|
+
Slim::Template.new(input[:name]) { input[:data] }.render(context)
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
class << self
|
12
|
+
def register_engine(app, config)
|
13
|
+
if ::Rails::VERSION::MAJOR == 3
|
14
|
+
_register_engine3(app)
|
15
|
+
else
|
16
|
+
_register_engine(config)
|
17
|
+
end
|
15
18
|
end
|
16
|
-
end
|
17
19
|
|
18
|
-
|
20
|
+
private
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
def _register_engine3(app)
|
23
|
+
return unless app.assets
|
24
|
+
return unless app.assets.respond_to?(:register_engine)
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
+
app.assets.register_engine(".slim", Slim::Template)
|
27
|
+
end
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
+
def _register_engine(config)
|
30
|
+
return unless config.respond_to?(:assets)
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
config.assets.configure do |env|
|
33
|
+
if env.respond_to?(:register_transformer) && Sprockets::VERSION.to_i > 3
|
34
|
+
env.register_mime_type "text/slim", extensions: [".slim", ".slim.html"] # , charset: :html
|
35
|
+
env.register_transformer "text/slim", "text/html", RegisterEngine::Transformer
|
36
|
+
elsif env.respond_to?(:register_engine)
|
37
|
+
args = [".slim", Slim::Template]
|
38
|
+
args << {silence_deprecation: true} if Sprockets::VERSION.start_with?("3")
|
39
|
+
env.register_engine(*args)
|
40
|
+
end
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
data/lib/slim-rails/version.rb
CHANGED
data/lib/slim-rails.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "slim-rails/version"
|
2
|
+
require "rails"
|
3
|
+
require "slim"
|
4
|
+
require "slim-rails/register_engine"
|
5
5
|
|
6
6
|
module Slim
|
7
7
|
module Rails
|
8
8
|
class Railtie < ::Rails::Railtie
|
9
9
|
config.app_generators.template_engine :slim
|
10
10
|
|
11
|
-
initializer
|
11
|
+
initializer "slim_rails.configure_template_digestor" do |app|
|
12
12
|
Slim::Rails::RegisterEngine.register_engine(app, config)
|
13
13
|
|
14
14
|
ActiveSupport.on_load(:action_view) do
|
15
15
|
ActiveSupport.on_load(:after_initialize) do
|
16
|
-
begin
|
16
|
+
begin # rubocop:disable Style/RedundantBegin
|
17
17
|
if defined?(CacheDigests::DependencyTracker)
|
18
18
|
# 'cache_digests' gem being used (overrides Rails 4 implementation)
|
19
19
|
CacheDigests::DependencyTracker.register_tracker :slim, CacheDigests::DependencyTracker::ERBTracker
|
@@ -22,9 +22,9 @@ module Slim
|
|
22
22
|
# recalculate cache digest keys for each request
|
23
23
|
CacheDigests::TemplateDigestor.cache = ActiveSupport::Cache::NullStore.new
|
24
24
|
end
|
25
|
-
elsif ::Rails.version.to_s >=
|
25
|
+
elsif ::Rails.version.to_s >= "4.0"
|
26
26
|
# will only apply if Rails 4, which includes 'action_view/dependency_tracker'
|
27
|
-
require
|
27
|
+
require "action_view/dependency_tracker"
|
28
28
|
ActionView::DependencyTracker.register_tracker :slim, ActionView::DependencyTracker::ERBTracker
|
29
29
|
end
|
30
30
|
rescue
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slim-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonardo Almeida
|
8
|
-
|
8
|
+
- Janusz Mordarski
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2023-03-09 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: actionpack
|
@@ -42,16 +43,28 @@ dependencies:
|
|
42
43
|
name: slim
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
44
45
|
requirements:
|
45
|
-
- - "
|
46
|
+
- - ">="
|
46
47
|
- !ruby/object:Gem::Version
|
47
48
|
version: '3.0'
|
49
|
+
- - "!="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 5.0.0
|
52
|
+
- - "<"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '6.0'
|
48
55
|
type: :runtime
|
49
56
|
prerelease: false
|
50
57
|
version_requirements: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- - "
|
59
|
+
- - ">="
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '3.0'
|
62
|
+
- - "!="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 5.0.0
|
65
|
+
- - "<"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '6.0'
|
55
68
|
- !ruby/object:Gem::Dependency
|
56
69
|
name: sprockets-rails
|
57
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +79,20 @@ dependencies:
|
|
66
79
|
- - ">="
|
67
80
|
- !ruby/object:Gem::Version
|
68
81
|
version: '0'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: slim_lint
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.24.0
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.24.0
|
69
96
|
- !ruby/object:Gem::Dependency
|
70
97
|
name: rocco
|
71
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,26 +163,31 @@ dependencies:
|
|
136
163
|
- - ">="
|
137
164
|
- !ruby/object:Gem::Version
|
138
165
|
version: '0'
|
139
|
-
|
166
|
+
- !ruby/object:Gem::Dependency
|
167
|
+
name: standardrb
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
type: :development
|
174
|
+
prerelease: false
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
description: Provides the generator settings required for Rails to use Slim
|
140
181
|
email:
|
141
182
|
- lalmeida08@gmail.com
|
183
|
+
- janusz.m@gmail.com
|
142
184
|
executables: []
|
143
185
|
extensions: []
|
144
186
|
extra_rdoc_files: []
|
145
187
|
files:
|
146
|
-
- ".gitignore"
|
147
|
-
- ".travis.yml"
|
148
|
-
- Appraisals
|
149
188
|
- CHANGELOG.md
|
150
|
-
- Gemfile
|
151
189
|
- LICENSE
|
152
190
|
- README.md
|
153
|
-
- Rakefile
|
154
|
-
- gemfiles/rails_3.gemfile
|
155
|
-
- gemfiles/rails_4.1.gemfile
|
156
|
-
- gemfiles/rails_4.2.gemfile
|
157
|
-
- gemfiles/rails_4.gemfile
|
158
|
-
- gemfiles/rails_5.gemfile
|
159
191
|
- lib/generators/slim/controller/controller_generator.rb
|
160
192
|
- lib/generators/slim/controller/templates/view.html.slim
|
161
193
|
- lib/generators/slim/mailer/mailer_generator.rb
|
@@ -163,28 +195,26 @@ files:
|
|
163
195
|
- lib/generators/slim/mailer/templates/layout.text.slim
|
164
196
|
- lib/generators/slim/mailer/templates/view.html.slim
|
165
197
|
- lib/generators/slim/mailer/templates/view.text.slim
|
198
|
+
- lib/generators/slim/scaffold/legacy_templates/_form.html.slim.tt
|
199
|
+
- lib/generators/slim/scaffold/legacy_templates/edit.html.slim.tt
|
200
|
+
- lib/generators/slim/scaffold/legacy_templates/index.html.slim.tt
|
201
|
+
- lib/generators/slim/scaffold/legacy_templates/new.html.slim.tt
|
202
|
+
- lib/generators/slim/scaffold/legacy_templates/show.html.slim.tt
|
166
203
|
- lib/generators/slim/scaffold/scaffold_generator.rb
|
167
|
-
- lib/generators/slim/scaffold/templates/_form.html.slim
|
168
|
-
- lib/generators/slim/scaffold/templates/edit.html.slim
|
169
|
-
- lib/generators/slim/scaffold/templates/index.html.slim
|
170
|
-
- lib/generators/slim/scaffold/templates/new.html.slim
|
171
|
-
- lib/generators/slim/scaffold/templates/
|
204
|
+
- lib/generators/slim/scaffold/templates/_form.html.slim.tt
|
205
|
+
- lib/generators/slim/scaffold/templates/edit.html.slim.tt
|
206
|
+
- lib/generators/slim/scaffold/templates/index.html.slim.tt
|
207
|
+
- lib/generators/slim/scaffold/templates/new.html.slim.tt
|
208
|
+
- lib/generators/slim/scaffold/templates/partial.html.slim.tt
|
209
|
+
- lib/generators/slim/scaffold/templates/show.html.slim.tt
|
172
210
|
- lib/slim-rails.rb
|
173
211
|
- lib/slim-rails/register_engine.rb
|
174
212
|
- lib/slim-rails/version.rb
|
175
|
-
- slim-rails.gemspec
|
176
|
-
- test/fixtures/routes.rb
|
177
|
-
- test/lib/generators/slim/controller_generator_test.rb
|
178
|
-
- test/lib/generators/slim/mailer_generator_test.rb
|
179
|
-
- test/lib/generators/slim/scaffold_generator_test.rb
|
180
|
-
- test/lib/generators/slim/testing_helper.rb
|
181
|
-
- test/lib/slim-rails_assets_test.rb
|
182
|
-
- test/test_helper.rb
|
183
213
|
homepage: https://github.com/slim-template/slim-rails
|
184
214
|
licenses:
|
185
215
|
- MIT
|
186
216
|
metadata: {}
|
187
|
-
post_install_message:
|
217
|
+
post_install_message:
|
188
218
|
rdoc_options: []
|
189
219
|
require_paths:
|
190
220
|
- lib
|
@@ -199,16 +229,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
229
|
- !ruby/object:Gem::Version
|
200
230
|
version: '0'
|
201
231
|
requirements: []
|
202
|
-
|
203
|
-
|
204
|
-
signing_key:
|
232
|
+
rubygems_version: 3.4.7
|
233
|
+
signing_key:
|
205
234
|
specification_version: 4
|
206
|
-
summary: Slim templates generator for Rails
|
207
|
-
test_files:
|
208
|
-
- test/fixtures/routes.rb
|
209
|
-
- test/lib/generators/slim/controller_generator_test.rb
|
210
|
-
- test/lib/generators/slim/mailer_generator_test.rb
|
211
|
-
- test/lib/generators/slim/scaffold_generator_test.rb
|
212
|
-
- test/lib/generators/slim/testing_helper.rb
|
213
|
-
- test/lib/slim-rails_assets_test.rb
|
214
|
-
- test/test_helper.rb
|
235
|
+
summary: Slim templates generator for Rails
|
236
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp/
|
18
|
-
.ruby-version
|
19
|
-
.ruby-gemset
|
20
|
-
gemfiles/*.gemfile.lock
|
data/.travis.yml
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
before_install:
|
3
|
-
- gem install bundler
|
4
|
-
rvm:
|
5
|
-
- ruby-head
|
6
|
-
- 2.4.0
|
7
|
-
- 2.3
|
8
|
-
- 2.2
|
9
|
-
- 2.1
|
10
|
-
- 2.0
|
11
|
-
gemfile:
|
12
|
-
- gemfiles/rails_3.gemfile
|
13
|
-
- gemfiles/rails_4.gemfile
|
14
|
-
- gemfiles/rails_4.1.gemfile
|
15
|
-
- gemfiles/rails_4.2.gemfile
|
16
|
-
- gemfiles/rails_5.gemfile
|
17
|
-
matrix:
|
18
|
-
allow_failures:
|
19
|
-
- rvm: ruby-head
|
20
|
-
- rvm: 2.4.0
|
21
|
-
gemfile: gemfiles/rails_4.gemfile
|
22
|
-
- rvm: 2.4.0
|
23
|
-
gemfile: gemfiles/rails_4.1.gemfile
|
24
|
-
- rvm: 2.4.0
|
25
|
-
gemfile: gemfiles/rails_4.2.gemfile
|
26
|
-
exclude:
|
27
|
-
- rvm: 2.1
|
28
|
-
gemfile: gemfiles/rails_5.gemfile
|
29
|
-
- rvm: 2.0
|
30
|
-
gemfile: gemfiles/rails_5.gemfile
|
31
|
-
addons:
|
32
|
-
code_climate:
|
33
|
-
repo_token: 294f0ec8183176c0259b75eb21b38414508616985a7b39fc48fec9dfcf40a52e
|
data/Appraisals
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
appraise "rails-3" do
|
2
|
-
gem "rails", "~> 3.2"
|
3
|
-
gem 'minitest'
|
4
|
-
gem 'test-unit', '~> 3.0'
|
5
|
-
end
|
6
|
-
|
7
|
-
appraise "rails-4" do
|
8
|
-
gem "rails", "~> 4.0.0"
|
9
|
-
end
|
10
|
-
|
11
|
-
appraise "rails-4.1" do
|
12
|
-
gem "rails", "~> 4.1.0"
|
13
|
-
end
|
14
|
-
|
15
|
-
appraise "rails-4.2" do
|
16
|
-
gem "rails", "~> 4.2.0"
|
17
|
-
end
|
18
|
-
|
19
|
-
appraise "rails-5" do
|
20
|
-
gem "rails", "~> 5.0.0"
|
21
|
-
end
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
require 'bundler'
|
3
|
-
Bundler::GemHelper.install_tasks
|
4
|
-
|
5
|
-
require 'rake/testtask'
|
6
|
-
Rake::TestTask.new(:test) do |test|
|
7
|
-
test.libs << 'lib' << 'test'
|
8
|
-
test.pattern = 'test/**/*_test.rb'
|
9
|
-
test.verbose = true
|
10
|
-
end
|
11
|
-
|
12
|
-
task :default => :test
|
data/gemfiles/rails_3.gemfile
DELETED
data/gemfiles/rails_4.1.gemfile
DELETED
data/gemfiles/rails_4.2.gemfile
DELETED
data/gemfiles/rails_4.gemfile
DELETED
data/gemfiles/rails_5.gemfile
DELETED
data/slim-rails.gemspec
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'slim-rails/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'slim-rails'
|
8
|
-
spec.version = Slim::Rails::VERSION
|
9
|
-
spec.authors = ["Leonardo Almeida"]
|
10
|
-
spec.email = ["lalmeida08@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = 'Slim templates generator for Rails 3+'
|
13
|
-
spec.description = 'Provides the generator settings required for Rails 3+ to use Slim'
|
14
|
-
spec.homepage = 'https://github.com/slim-template/slim-rails'
|
15
|
-
spec.license = 'MIT'
|
16
|
-
|
17
|
-
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
-
spec.files = `git ls-files`.split("\n")
|
19
|
-
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
-
spec.require_paths = ['lib']
|
21
|
-
|
22
|
-
spec.required_ruby_version = '>= 2.0.0'
|
23
|
-
|
24
|
-
spec.add_runtime_dependency 'actionpack', ['>= 3.1']
|
25
|
-
spec.add_runtime_dependency 'railties', ['>= 3.1']
|
26
|
-
spec.add_runtime_dependency 'slim', ['~> 3.0']
|
27
|
-
|
28
|
-
spec.add_development_dependency 'sprockets-rails'
|
29
|
-
spec.add_development_dependency 'rocco'
|
30
|
-
spec.add_development_dependency 'redcarpet'
|
31
|
-
spec.add_development_dependency 'awesome_print'
|
32
|
-
spec.add_development_dependency 'actionmailer', ['>= 3.1']
|
33
|
-
spec.add_development_dependency 'appraisal'
|
34
|
-
end
|
data/test/fixtures/routes.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
TestApp.routes.draw do
|
2
|
-
# The priority is based upon order of creation:
|
3
|
-
# first created -> highest priority.
|
4
|
-
|
5
|
-
# Sample of regular route:
|
6
|
-
# match 'products/:id' => 'catalog#view'
|
7
|
-
# Keep in mind you can assign values other than :controller and :action
|
8
|
-
|
9
|
-
# Sample of named route:
|
10
|
-
# match 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
11
|
-
# This route can be invoked with purchase_url(id: product.id)
|
12
|
-
|
13
|
-
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
-
# resources :products
|
15
|
-
|
16
|
-
# Sample resource route with options:
|
17
|
-
# resources :products do
|
18
|
-
# member do
|
19
|
-
# get :short
|
20
|
-
# post :toggle
|
21
|
-
# end
|
22
|
-
#
|
23
|
-
# collection do
|
24
|
-
# get :sold
|
25
|
-
# end
|
26
|
-
# end
|
27
|
-
|
28
|
-
# Sample resource route with sub-resources:
|
29
|
-
# resources :products do
|
30
|
-
# resources :comments, :sales
|
31
|
-
# resource :seller
|
32
|
-
# end
|
33
|
-
|
34
|
-
# Sample resource route with more complex sub-resources
|
35
|
-
# resources :products do
|
36
|
-
# resources :comments
|
37
|
-
# resources :sales do
|
38
|
-
# get :recent, on: :collection
|
39
|
-
# end
|
40
|
-
# end
|
41
|
-
|
42
|
-
# Sample resource route within a namespace:
|
43
|
-
# namespace :admin do
|
44
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
-
# # (app/controllers/admin/products_controller.rb)
|
46
|
-
# resources :products
|
47
|
-
# end
|
48
|
-
|
49
|
-
# You can have the root of your site routed with "root"
|
50
|
-
# just remember to delete public/index.html.
|
51
|
-
# root to: "welcome#index"
|
52
|
-
|
53
|
-
# See how all your routes lay out with "rake routes"
|
54
|
-
|
55
|
-
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
-
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
-
# match ':controller(/:action(/:id(.:format)))'
|
58
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'lib/generators/slim/testing_helper'
|
3
|
-
|
4
|
-
class Slim::Generators::ControllerGeneratorTest < Rails::Generators::TestCase
|
5
|
-
destination File.join(Rails.root)
|
6
|
-
tests Rails::Generators::ControllerGenerator
|
7
|
-
arguments %w(Account foo bar --template-engine slim)
|
8
|
-
|
9
|
-
setup :prepare_destination
|
10
|
-
setup :copy_routes
|
11
|
-
|
12
|
-
test "should invoke template engine" do
|
13
|
-
run_generator
|
14
|
-
assert_file File.join("app", "views", "account", "foo.html.slim"), %r(app/views/account/foo\.html\.slim)
|
15
|
-
assert_file File.join("app", "views", "account", "bar.html.slim"), %r(app/views/account/bar\.html\.slim)
|
16
|
-
end
|
17
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'lib/generators/slim/testing_helper'
|
3
|
-
|
4
|
-
class Slim::Generators::MailerGeneratorTest < Rails::Generators::TestCase
|
5
|
-
destination File.join(Rails.root)
|
6
|
-
tests Rails::Generators::MailerGenerator
|
7
|
-
arguments %w(notifier foo bar --template-engine slim)
|
8
|
-
|
9
|
-
setup :prepare_destination
|
10
|
-
setup :copy_routes
|
11
|
-
|
12
|
-
test "should invoke template engine" do
|
13
|
-
run_generator
|
14
|
-
|
15
|
-
rails_version = ::Rails.version.to_s
|
16
|
-
|
17
|
-
if rails_version >= '5.0'
|
18
|
-
assert_file "app/views/notifier_mailer/foo.html.slim" do |view|
|
19
|
-
assert_match %r(app/views/notifier_mailer/foo\.html\.slim), view
|
20
|
-
assert_match(/\= @greeting/, view)
|
21
|
-
end
|
22
|
-
|
23
|
-
assert_file "app/views/notifier_mailer/bar.html.slim" do |view|
|
24
|
-
assert_match %r(app/views/notifier_mailer/bar\.html\.slim), view
|
25
|
-
assert_match(/\= @greeting/, view)
|
26
|
-
end
|
27
|
-
|
28
|
-
assert_file "app/views/notifier_mailer/foo.text.slim" do |view|
|
29
|
-
assert_match %r(app/views/notifier_mailer/foo\.text\.slim), view
|
30
|
-
assert_match(/@greeting/, view)
|
31
|
-
end
|
32
|
-
|
33
|
-
assert_file "app/views/notifier_mailer/bar.text.slim" do |view|
|
34
|
-
assert_match %r(app/views/notifier_mailer/bar\.text\.slim), view
|
35
|
-
assert_match(/@greeting/, view)
|
36
|
-
end
|
37
|
-
else
|
38
|
-
if rails_version >= '4.2'
|
39
|
-
assert_file "app/views/layouts/mailer.text.slim" do |view|
|
40
|
-
assert_match(/\= yield/, view)
|
41
|
-
end
|
42
|
-
|
43
|
-
assert_file "app/views/layouts/mailer.html.slim" do |view|
|
44
|
-
assert_match(/\= yield/, view)
|
45
|
-
end
|
46
|
-
|
47
|
-
assert_file "app/views/notifier/foo.html.slim" do |view|
|
48
|
-
assert_match %r(app/views/notifier/foo\.html\.slim), view
|
49
|
-
assert_match(/\= @greeting/, view)
|
50
|
-
end
|
51
|
-
|
52
|
-
assert_file "app/views/notifier/bar.html.slim" do |view|
|
53
|
-
assert_match %r(app/views/notifier/bar\.html\.slim), view
|
54
|
-
assert_match(/\= @greeting/, view)
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
assert_file "app/views/notifier/foo.text.slim" do |view|
|
60
|
-
assert_match %r(app/views/notifier/foo\.text\.slim), view
|
61
|
-
assert_match(/@greeting/, view)
|
62
|
-
end
|
63
|
-
|
64
|
-
assert_file "app/views/notifier/bar.text.slim" do |view|
|
65
|
-
assert_match %r(app/views/notifier/bar\.text\.slim), view
|
66
|
-
assert_match(/@greeting/, view)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'lib/generators/slim/testing_helper'
|
3
|
-
|
4
|
-
class Slim::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
|
5
|
-
destination File.join(Rails.root)
|
6
|
-
tests Rails::Generators::ScaffoldGenerator
|
7
|
-
arguments %w(product_line title:string price:integer --template-engine slim --orm active-record)
|
8
|
-
|
9
|
-
setup :prepare_destination
|
10
|
-
setup :copy_routes
|
11
|
-
|
12
|
-
test "should invoke template engine" do
|
13
|
-
run_generator
|
14
|
-
|
15
|
-
%w(index edit new show _form).each { |view| assert_file File.join "app", "views", "product_lines", "#{view}.html.slim" }
|
16
|
-
assert_no_file File.join "app", "views", "layouts", "product_lines.html.slim"
|
17
|
-
end
|
18
|
-
|
19
|
-
test "should revoke template engine" do
|
20
|
-
run_generator
|
21
|
-
run_generator ["product_line", "--orm", "active-record"], behavior: :revoke
|
22
|
-
|
23
|
-
assert_no_file File.join "app", "views", "product_lines"
|
24
|
-
assert_no_file File.join "app", "views", "layouts", "product_lines.html.slim"
|
25
|
-
end
|
26
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require_generators slim: ['scaffold', 'controller', 'mailer']
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'tmpdir'
|
3
|
-
|
4
|
-
class Slim::Rails::AssetsTest < ActiveSupport::TestCase
|
5
|
-
def with_app(use_sprockets, code)
|
6
|
-
Dir.mktmpdir do |dir|
|
7
|
-
app_path = File.join(dir, 'app.rb')
|
8
|
-
File.write(app_path, <<-APP)
|
9
|
-
require 'rails'
|
10
|
-
require 'sprockets/railtie' if #{use_sprockets}
|
11
|
-
require 'slim-rails'
|
12
|
-
class DummyApp < ::Rails::Application
|
13
|
-
config.root = #{dir.inspect}
|
14
|
-
config.assets.enabled = true if #{use_sprockets}
|
15
|
-
config.eager_load = false
|
16
|
-
end
|
17
|
-
DummyApp.initialize!
|
18
|
-
#{code}
|
19
|
-
APP
|
20
|
-
|
21
|
-
asset_path = File.join(dir, 'app', 'assets', 'html', 'test.slim')
|
22
|
-
FileUtils.mkdir_p(File.dirname(asset_path))
|
23
|
-
File.write(asset_path, ".test\n | hi")
|
24
|
-
|
25
|
-
`BUNDLE_GEMFILE=#{ENV['BUNDLE_GEMFILE']} bundle exec ruby #{app_path}`
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
test 'compile slim view' do
|
30
|
-
assert_equal 'ok', with_app(false, 'print DummyApp.assets || "ok"')
|
31
|
-
assert_equal '<div class="test">hi</div>', with_app(true, 'print DummyApp.assets["test.slim"].to_s')
|
32
|
-
assert_equal '<div class="test">hi</div>', with_app(true, 'print DummyApp.assets["test", accept: "text/html"].to_s')
|
33
|
-
end
|
34
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'minitest/autorun'
|
3
|
-
require 'rails'
|
4
|
-
require 'rails/test_help'
|
5
|
-
require 'rails/generators'
|
6
|
-
require 'rails/generators/test_case'
|
7
|
-
require 'slim-rails'
|
8
|
-
|
9
|
-
class TestApp < Rails::Application
|
10
|
-
config.root = File.dirname(__FILE__)
|
11
|
-
end
|
12
|
-
Rails.application = TestApp
|
13
|
-
|
14
|
-
module Rails
|
15
|
-
def self.root
|
16
|
-
@root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'rails'))
|
17
|
-
end
|
18
|
-
end
|
19
|
-
Rails.application.config.root = Rails.root
|
20
|
-
|
21
|
-
Rails::Generators.configure! Rails.application.config.generators
|
22
|
-
|
23
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
24
|
-
|
25
|
-
def copy_routes
|
26
|
-
routes = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'routes.rb'))
|
27
|
-
destination = File.join(Rails.root, "config")
|
28
|
-
FileUtils.mkdir_p(destination)
|
29
|
-
FileUtils.cp File.expand_path(routes), destination
|
30
|
-
end
|
31
|
-
|
32
|
-
def assert_class(klass, content)
|
33
|
-
assert content =~ /class #{klass}(\(.+\))?(.*?)\nend/m, "Expected to have class #{klass}"
|
34
|
-
yield $2.strip if block_given?
|
35
|
-
end
|
36
|
-
|
37
|
-
def generator_list
|
38
|
-
{
|
39
|
-
rails: ['scaffold', 'controller', 'mailer'],
|
40
|
-
slim: ['scaffold', 'controller', 'mailer']
|
41
|
-
}
|
42
|
-
end
|
43
|
-
|
44
|
-
def path_prefix(name)
|
45
|
-
case name
|
46
|
-
when :rails
|
47
|
-
'rails/generators'
|
48
|
-
else
|
49
|
-
'generators'
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def require_generators(generator_list)
|
54
|
-
generator_list.each do |name, generators|
|
55
|
-
generators.each do |generator_name|
|
56
|
-
if name.to_s == 'rails' && generator_name.to_s == 'mailer'
|
57
|
-
require File.join(path_prefix(name), generator_name.to_s, "#{generator_name}_generator")
|
58
|
-
else
|
59
|
-
require File.join(path_prefix(name), name.to_s, generator_name.to_s, "#{generator_name}_generator")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
alias :require_generator :require_generators
|
65
|
-
|
66
|
-
require_generators generator_list
|
/data/lib/generators/slim/scaffold/{templates/_form.html.slim → legacy_templates/_form.html.slim.tt}
RENAMED
File without changes
|