adzap-mustache-rails 0.2.4 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 476d2c75a92363ebef330cbb423b7183aad959f1
4
- data.tar.gz: d21198323052cce261c2e52130bb3b909132a5bf
2
+ SHA256:
3
+ metadata.gz: 86a3fc3bf8c02edbee77905a250bb1a7bc47c0c4f6ae4d1236f44fcc6fefc2b2
4
+ data.tar.gz: 46f8858f5c4ee6846d3b2b5841f5b310412070833fdeb6a93d8a30a187037a4f
5
5
  SHA512:
6
- metadata.gz: 8c5856b23fe7adfc323abfba3367f28ca33a65933ba88024131f7bb4ee33061ad7b910b1842fb479e703e220c132675782949cde5c1824fdd0d9b61927803c67
7
- data.tar.gz: ac72e5de3f91c03e5ed7cd3cf272bb8f16b5cba0fe3d6cd0da0220a7eef5fe0fb33e6a35da7ace9c4f1db8a2422c210cc128eb72fc6de2daa85e8e58450f39d6
6
+ metadata.gz: 1cae847b8e3ae0e2034d1005731327bb44d7a155bc56db12ef3db27601773ef389fbcf17d3f5d147576b7e0f7ea037bbc3f72c4196121e906176ec1ec286a23c
7
+ data.tar.gz: 7e03505c6265b8eeba1a11d77067ec2fb6aaa3eda1508ebe5075e9d496a828627ed2263bdfc325e392898952c41a7812b1d6282ce5cc2aef3b1806bffc7aab29
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Mustache Rails
2
2
 
3
- Implements Mustache views and templates for Rails 3.x
3
+ Implements Mustache views and templates for Rails 3+
4
4
 
5
5
  ## Installation
6
6
 
@@ -1,4 +1,5 @@
1
1
  require 'action_view'
2
+ require 'action_dispatch'
2
3
  require 'mustache'
3
4
 
4
5
  module ActionView
@@ -11,7 +12,7 @@ module ActionView
11
12
 
12
13
  # Escape helper isn't used, its all handled by Rails' SafeBuffer
13
14
  # auto escaping.
14
- undef_method :escapeHTML
15
+ undef_method :escape
15
16
 
16
17
  # Internal: Evaluate section block.
17
18
  #
@@ -0,0 +1,25 @@
1
+ require 'rails/generators/named_base'
2
+
3
+ class Mustache # :nodoc:
4
+ module Generators # :nodoc:
5
+ class Base < Rails::Generators::NamedBase #:nodoc:
6
+ protected
7
+
8
+ def formats
9
+ [format]
10
+ end
11
+
12
+ def format
13
+ :html
14
+ end
15
+
16
+ def handler
17
+ :mustache
18
+ end
19
+
20
+ def filename_with_extensions(name, format = self.format)
21
+ [name, format, handler].compact.join(".")
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require 'generators/mustache'
2
+
3
+ class Mustache # :nodoc:
4
+ module Generators # :nodoc:
5
+ class ControllerGenerator < Base # :nodoc:
6
+ argument :actions, type: :array, default: [], banner: "action action"
7
+
8
+ source_root File.expand_path("../templates", __FILE__)
9
+
10
+ def copy_view_files
11
+ empty_directory File.join("app/views", class_path, file_name)
12
+ empty_directory File.join("app/templates", class_path, file_name)
13
+
14
+ actions.each do |action|
15
+ @action = action
16
+ template 'view.rb', File.join("app/views", class_path, file_name, "#{action}.rb")
17
+
18
+ formats.each do |format|
19
+ template filename_with_extensions(:view, format), File.join("app/templates", class_path, file_name, filename_with_extensions(action, format))
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ module Views
2
+ module <%= class_name %>
3
+ class <%= @action.titleize %> < <%= Rails.configuration.mustache.view_base_class %>
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,38 @@
1
+ require 'generators/mustache'
2
+ require 'rails/generators/resource_helpers'
3
+
4
+ class Mustache # :nodoc:
5
+ module Generators # :nodoc:
6
+ class ScaffoldGenerator < Base # :nodoc:
7
+ include Rails::Generators::ResourceHelpers
8
+
9
+ source_root File.expand_path("../templates", __FILE__)
10
+
11
+ argument :attributes, type: :array, default: [], banner: "field:type field:type"
12
+
13
+ def create_root_folder
14
+ empty_directory File.join("app/views", controller_file_path)
15
+ empty_directory File.join("app/templates", controller_file_path)
16
+ end
17
+
18
+ def copy_view_files
19
+ available_views.each do |view|
20
+ @action = view
21
+
22
+ formats.each do |format|
23
+ template_filename = filename_with_extensions(view, format)
24
+
25
+ template template_filename, File.join("app/templates", controller_file_path, template_filename)
26
+ template "view.rb", File.join("app/views", controller_file_path, "#{view}.rb")
27
+ end
28
+ end
29
+ end
30
+
31
+ protected
32
+
33
+ def available_views
34
+ %w(index edit show new _form)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,6 @@
1
+ module Views
2
+ module <%= class_name %>
3
+ class <%= @action.titleize %> < <%= Rails.configuration.mustache.view_base_class %>
4
+ end
5
+ end
6
+ end
@@ -60,6 +60,15 @@ class Mustache
60
60
  # Returns nil, String or Class.
61
61
  config.mustache.default_view_class = nil
62
62
 
63
+ # Public: Set Mustache View base class to use.
64
+ #
65
+ # Defaults to base class provided by gem (ActionView::Mustache)
66
+ # but can be changed to another base class to override the parent
67
+ # class name output by view generators.
68
+ #
69
+ # Returns String or Class.
70
+ config.mustache.view_base_class = 'ActionView::Mustache'
71
+
63
72
  # Internal: Ensures view path is included in autoload path.
64
73
  initializer 'mustache.add_autoload_paths', :before => :set_autoload_paths do |app|
65
74
  app.config.autoload_paths << app.root.join(app.config.mustache.view_path).to_s
@@ -68,7 +77,7 @@ class Mustache
68
77
  # Internal: Adds .mustache template path to ActionController's view paths.
69
78
  initializer 'mustache.add_view_paths', :after => :add_view_paths do |app|
70
79
  ActiveSupport.on_load(:action_controller) do
71
- append_view_path app.root.join(app.config.mustache.template_path).to_s
80
+ prepend_view_path app.root.join(app.config.mustache.template_path).to_s
72
81
  end
73
82
  end
74
83
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adzap-mustache-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
- - Joshua Peek
8
- autorequire:
7
+ - Adam Meehan
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-27 00:00:00.000000000 Z
11
+ date: 2020-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -17,9 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
20
- - - "<"
20
+ - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.0'
22
+ version: 5.2.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,23 +27,23 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.2'
30
- - - "<"
30
+ - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.0'
32
+ version: 5.2.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: mustache
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.99.8
39
+ version: 1.1.0
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.99.8
46
+ version: 1.1.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +59,7 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  description: Implements Mustache views and templates for Rails 4.0
62
- email: josh@joshpeek.com
62
+ email: adam.meehan@gmail.com
63
63
  executables: []
64
64
  extensions: []
65
65
  extra_rdoc_files: []
@@ -70,11 +70,22 @@ files:
70
70
  - lib/action_view/mustache/context.rb
71
71
  - lib/action_view/mustache/generator.rb
72
72
  - lib/action_view/template/handlers/mustache.rb
73
+ - lib/generators/mustache.rb
74
+ - lib/generators/mustache/controller/controller_generator.rb
75
+ - lib/generators/mustache/controller/templates/view.html.mustache
76
+ - lib/generators/mustache/controller/templates/view.rb
77
+ - lib/generators/mustache/scaffold/scaffold_generator.rb
78
+ - lib/generators/mustache/scaffold/templates/_form.html.mustache
79
+ - lib/generators/mustache/scaffold/templates/edit.html.mustache
80
+ - lib/generators/mustache/scaffold/templates/index.html.mustache
81
+ - lib/generators/mustache/scaffold/templates/new.html.mustache
82
+ - lib/generators/mustache/scaffold/templates/show.html.mustache
83
+ - lib/generators/mustache/scaffold/templates/view.rb
73
84
  - lib/mustache/railtie.rb
74
- homepage: https://github.com/josh/mustache-rails
85
+ homepage: https://github.com/adzap/mustache-rails
75
86
  licenses: []
76
87
  metadata: {}
77
- post_install_message:
88
+ post_install_message:
78
89
  rdoc_options: []
79
90
  require_paths:
80
91
  - lib
@@ -89,9 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
100
  - !ruby/object:Gem::Version
90
101
  version: '0'
91
102
  requirements: []
92
- rubyforge_project:
93
- rubygems_version: 2.4.5
94
- signing_key:
103
+ rubygems_version: 3.0.3
104
+ signing_key:
95
105
  specification_version: 4
96
106
  summary: Mustache Rails adapter
97
107
  test_files: []