pug-rails 2.0.2 → 2.0.3

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.
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 4"
6
+ gem "sprockets", "~> 3"
7
+ gem "pry-byebug"
8
+
9
+ gemspec :path => "../"
@@ -0,0 +1,138 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ pug-rails (2.0.3)
5
+ pug-ruby (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.2.7.1)
11
+ actionpack (= 4.2.7.1)
12
+ actionview (= 4.2.7.1)
13
+ activejob (= 4.2.7.1)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ actionpack (4.2.7.1)
17
+ actionview (= 4.2.7.1)
18
+ activesupport (= 4.2.7.1)
19
+ rack (~> 1.6)
20
+ rack-test (~> 0.6.2)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
+ actionview (4.2.7.1)
24
+ activesupport (= 4.2.7.1)
25
+ builder (~> 3.1)
26
+ erubis (~> 2.7.0)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
+ activejob (4.2.7.1)
30
+ activesupport (= 4.2.7.1)
31
+ globalid (>= 0.3.0)
32
+ activemodel (4.2.7.1)
33
+ activesupport (= 4.2.7.1)
34
+ builder (~> 3.1)
35
+ activerecord (4.2.7.1)
36
+ activemodel (= 4.2.7.1)
37
+ activesupport (= 4.2.7.1)
38
+ arel (~> 6.0)
39
+ activesupport (4.2.7.1)
40
+ i18n (~> 0.7)
41
+ json (~> 1.7, >= 1.7.7)
42
+ minitest (~> 5.1)
43
+ thread_safe (~> 0.3, >= 0.3.4)
44
+ tzinfo (~> 1.1)
45
+ appraisal (2.1.0)
46
+ bundler
47
+ rake
48
+ thor (>= 0.14.0)
49
+ arel (6.0.4)
50
+ builder (3.2.2)
51
+ byebug (9.0.6)
52
+ coderay (1.1.1)
53
+ concurrent-ruby (1.0.4)
54
+ erubis (2.7.0)
55
+ globalid (0.3.7)
56
+ activesupport (>= 4.1.0)
57
+ i18n (0.7.0)
58
+ json (1.8.3)
59
+ loofah (2.0.3)
60
+ nokogiri (>= 1.5.9)
61
+ mail (2.6.4)
62
+ mime-types (>= 1.16, < 4)
63
+ method_source (0.8.2)
64
+ mime-types (3.1)
65
+ mime-types-data (~> 3.2015)
66
+ mime-types-data (3.2016.0521)
67
+ mini_portile2 (2.1.0)
68
+ minitest (5.10.1)
69
+ nokogiri (1.6.8.1)
70
+ mini_portile2 (~> 2.1.0)
71
+ power_assert (0.4.1)
72
+ pry (0.10.4)
73
+ coderay (~> 1.1.0)
74
+ method_source (~> 0.8.1)
75
+ slop (~> 3.4)
76
+ pry-byebug (3.4.2)
77
+ byebug (~> 9.0)
78
+ pry (~> 0.10)
79
+ pug-ruby (1.0.2)
80
+ rack (1.6.5)
81
+ rack-test (0.6.3)
82
+ rack (>= 1.0)
83
+ rails (4.2.7.1)
84
+ actionmailer (= 4.2.7.1)
85
+ actionpack (= 4.2.7.1)
86
+ actionview (= 4.2.7.1)
87
+ activejob (= 4.2.7.1)
88
+ activemodel (= 4.2.7.1)
89
+ activerecord (= 4.2.7.1)
90
+ activesupport (= 4.2.7.1)
91
+ bundler (>= 1.3.0, < 2.0)
92
+ railties (= 4.2.7.1)
93
+ sprockets-rails
94
+ rails-deprecated_sanitizer (1.0.3)
95
+ activesupport (>= 4.2.0.alpha)
96
+ rails-dom-testing (1.0.8)
97
+ activesupport (>= 4.2.0.beta, < 5.0)
98
+ nokogiri (~> 1.6)
99
+ rails-deprecated_sanitizer (>= 1.0.1)
100
+ rails-html-sanitizer (1.0.3)
101
+ loofah (~> 2.0)
102
+ railties (4.2.7.1)
103
+ actionpack (= 4.2.7.1)
104
+ activesupport (= 4.2.7.1)
105
+ rake (>= 0.8.7)
106
+ thor (>= 0.18.1, < 2.0)
107
+ rake (10.5.0)
108
+ slop (3.6.0)
109
+ sprockets (3.7.1)
110
+ concurrent-ruby (~> 1.0)
111
+ rack (> 1, < 3)
112
+ sprockets-rails (3.2.0)
113
+ actionpack (>= 4.0)
114
+ activesupport (>= 4.0)
115
+ sprockets (>= 3.0.0)
116
+ test-unit (3.2.3)
117
+ power_assert
118
+ thor (0.19.4)
119
+ thread_safe (0.3.5)
120
+ tzinfo (1.2.2)
121
+ thread_safe (~> 0.1)
122
+
123
+ PLATFORMS
124
+ ruby
125
+
126
+ DEPENDENCIES
127
+ appraisal (~> 2.1)
128
+ bundler (~> 1.7)
129
+ nokogiri (~> 1.6, < 1.7)
130
+ pry-byebug
131
+ pug-rails!
132
+ rails (~> 4)
133
+ rake (~> 10.0)
134
+ sprockets (~> 3)
135
+ test-unit (~> 3.1)
136
+
137
+ BUNDLED WITH
138
+ 1.13.2
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 5"
6
+ gem "sprockets", "~> 3"
7
+ gem "pry-byebug"
8
+
9
+ gemspec :path => "../"
@@ -0,0 +1,142 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ pug-rails (2.0.3)
5
+ pug-ruby (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (5.0.1)
11
+ actionpack (= 5.0.1)
12
+ nio4r (~> 1.2)
13
+ websocket-driver (~> 0.6.1)
14
+ actionmailer (5.0.1)
15
+ actionpack (= 5.0.1)
16
+ actionview (= 5.0.1)
17
+ activejob (= 5.0.1)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.0.1)
21
+ actionview (= 5.0.1)
22
+ activesupport (= 5.0.1)
23
+ rack (~> 2.0)
24
+ rack-test (~> 0.6.3)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
+ actionview (5.0.1)
28
+ activesupport (= 5.0.1)
29
+ builder (~> 3.1)
30
+ erubis (~> 2.7.0)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
33
+ activejob (5.0.1)
34
+ activesupport (= 5.0.1)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.0.1)
37
+ activesupport (= 5.0.1)
38
+ activerecord (5.0.1)
39
+ activemodel (= 5.0.1)
40
+ activesupport (= 5.0.1)
41
+ arel (~> 7.0)
42
+ activesupport (5.0.1)
43
+ concurrent-ruby (~> 1.0, >= 1.0.2)
44
+ i18n (~> 0.7)
45
+ minitest (~> 5.1)
46
+ tzinfo (~> 1.1)
47
+ appraisal (2.1.0)
48
+ bundler
49
+ rake
50
+ thor (>= 0.14.0)
51
+ arel (7.1.4)
52
+ builder (3.2.2)
53
+ byebug (9.0.6)
54
+ coderay (1.1.1)
55
+ concurrent-ruby (1.0.4)
56
+ erubis (2.7.0)
57
+ globalid (0.3.7)
58
+ activesupport (>= 4.1.0)
59
+ i18n (0.7.0)
60
+ loofah (2.0.3)
61
+ nokogiri (>= 1.5.9)
62
+ mail (2.6.4)
63
+ mime-types (>= 1.16, < 4)
64
+ method_source (0.8.2)
65
+ mime-types (3.1)
66
+ mime-types-data (~> 3.2015)
67
+ mime-types-data (3.2016.0521)
68
+ mini_portile2 (2.1.0)
69
+ minitest (5.10.1)
70
+ nio4r (1.2.1)
71
+ nokogiri (1.6.8.1)
72
+ mini_portile2 (~> 2.1.0)
73
+ power_assert (0.4.1)
74
+ pry (0.10.4)
75
+ coderay (~> 1.1.0)
76
+ method_source (~> 0.8.1)
77
+ slop (~> 3.4)
78
+ pry-byebug (3.4.2)
79
+ byebug (~> 9.0)
80
+ pry (~> 0.10)
81
+ pug-ruby (1.0.2)
82
+ rack (2.0.1)
83
+ rack-test (0.6.3)
84
+ rack (>= 1.0)
85
+ rails (5.0.1)
86
+ actioncable (= 5.0.1)
87
+ actionmailer (= 5.0.1)
88
+ actionpack (= 5.0.1)
89
+ actionview (= 5.0.1)
90
+ activejob (= 5.0.1)
91
+ activemodel (= 5.0.1)
92
+ activerecord (= 5.0.1)
93
+ activesupport (= 5.0.1)
94
+ bundler (>= 1.3.0, < 2.0)
95
+ railties (= 5.0.1)
96
+ sprockets-rails (>= 2.0.0)
97
+ rails-dom-testing (2.0.2)
98
+ activesupport (>= 4.2.0, < 6.0)
99
+ nokogiri (~> 1.6)
100
+ rails-html-sanitizer (1.0.3)
101
+ loofah (~> 2.0)
102
+ railties (5.0.1)
103
+ actionpack (= 5.0.1)
104
+ activesupport (= 5.0.1)
105
+ method_source
106
+ rake (>= 0.8.7)
107
+ thor (>= 0.18.1, < 2.0)
108
+ rake (10.5.0)
109
+ slop (3.6.0)
110
+ sprockets (3.7.1)
111
+ concurrent-ruby (~> 1.0)
112
+ rack (> 1, < 3)
113
+ sprockets-rails (3.2.0)
114
+ actionpack (>= 4.0)
115
+ activesupport (>= 4.0)
116
+ sprockets (>= 3.0.0)
117
+ test-unit (3.2.3)
118
+ power_assert
119
+ thor (0.19.4)
120
+ thread_safe (0.3.5)
121
+ tzinfo (1.2.2)
122
+ thread_safe (~> 0.1)
123
+ websocket-driver (0.6.4)
124
+ websocket-extensions (>= 0.1.0)
125
+ websocket-extensions (0.1.2)
126
+
127
+ PLATFORMS
128
+ ruby
129
+
130
+ DEPENDENCIES
131
+ appraisal (~> 2.1)
132
+ bundler (~> 1.7)
133
+ nokogiri (~> 1.6, < 1.7)
134
+ pry-byebug
135
+ pug-rails!
136
+ rails (~> 5)
137
+ rake (~> 10.0)
138
+ sprockets (~> 3)
139
+ test-unit (~> 3.1)
140
+
141
+ BUNDLED WITH
142
+ 1.13.2
@@ -1,34 +1,50 @@
1
+ # encoding: utf-8
1
2
  # frozen_string_literal: true
3
+
4
+ require 'rails/railtie'
5
+
2
6
  module Jade
3
- class Railtie < Rails::Engine
7
+ class Railtie < Rails::Railtie
4
8
  config.jade = Jade.config
5
9
  config.jade.pretty = Rails.env.development?
6
10
  config.jade.compile_debug = Rails.env.development?
7
11
 
8
- def configure_assets(app)
9
- if config.respond_to?(:assets) && config.assets.respond_to?(:configure)
10
- # Rails 4.x
11
- config.assets.configure { |env| yield(env) }
12
- else
13
- # Rails 3.2
14
- yield(app.assets)
15
- end
16
- end
17
-
18
- initializer 'sprockets.jade', group: :all, after: 'sprockets.environment' do |app|
19
- configure_assets(app) do |env|
12
+ initializer 'sprockets.jade.transformer', after: 'sprockets.environment', group: :all do |app|
13
+ access_assets_environment app do |env|
20
14
  # Sprockets 2, 3, and 4
21
15
  if env.respond_to?(:register_transformer)
22
16
  env.register_mime_type 'text/x-jade', extensions: ['.jade']
23
- env.register_transformer 'text/x-jade', 'application/javascript', Jade::SprocketsTransformer
17
+ env.register_transformer 'text/x-jade', 'application/javascript+function', Jade::Sprockets::Transformer
24
18
  end
25
19
 
26
20
  if env.respond_to?(:register_engine)
27
- args = ['.jade', Jade::SprocketsTransformer]
28
- args << { mime_type: 'text/x-jade', silence_deprecation: true } if Sprockets::VERSION.start_with?('3')
21
+ args = ['.jade', Jade::Sprockets::Transformer]
22
+ args << { mime_type: 'text/x-jade', silence_deprecation: true } if ::Sprockets::VERSION.start_with?('3')
29
23
  env.register_engine(*args)
30
24
  end
31
25
  end
32
26
  end
27
+
28
+ initializer 'sprockets.jade.runtime', after: :append_assets_path, group: :all do |app|
29
+ access_assets_config app do |assets|
30
+ assets.precompile += %w( jade/runtime.js )
31
+ assets.paths += [File.expand_path('../../../vendor/assets/javascripts', __FILE__)]
32
+ end
33
+ end
34
+
35
+ private
36
+ def access_assets_config(app)
37
+ yield app.config.assets
38
+ end
39
+
40
+ def access_assets_environment(app)
41
+ if config.respond_to?(:assets) && config.assets.respond_to?(:configure)
42
+ # Rails 4.x 5.x
43
+ config.assets.configure { |env| yield env }
44
+ else
45
+ # Rails 3.2
46
+ yield app.assets
47
+ end
48
+ end
33
49
  end
34
50
  end
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ module Jade
5
+ module Sprockets
6
+ # Sprockets 2, 3 & 4 interface
7
+ # https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#registering-all-versions-of-sprockets-in-processors
8
+ class Transformer
9
+ def initialize(filename, &block)
10
+ @filename = filename
11
+ @source = block.call
12
+ end
13
+
14
+ def render(context, _)
15
+ self.class.run(@filename, @source, context)
16
+ end
17
+
18
+ def self.run(filename, source, context)
19
+ Jade.compile(source, filename: filename, client: true)
20
+ end
21
+
22
+ def self.call(input)
23
+ filename = input[:filename]
24
+ source = input[:data]
25
+ context = input[:environment].context_class.new(input)
26
+
27
+ result = run(filename, source, context)
28
+ context.metadata.merge(data: result)
29
+ end
30
+ end
31
+ end
32
+ end
data/lib/pug-rails.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Jade
@@ -12,11 +13,16 @@ module Pug
12
13
  end
13
14
  end
14
15
 
16
+ # https://github.com/pugjs/pug/blob/v1.x.x/runtime.js
15
17
  Jade.runtime_version = '1.11.0'
18
+
19
+ # https://github.com/pugjs/pug-runtime
16
20
  Pug.runtime_version = '2.0.2'
17
21
 
18
22
  require 'pug-ruby'
19
- require 'pug-rails/template'
23
+
24
+ require 'pug-rails/sprockets/transformer'
20
25
  require 'pug-rails/railtie'
21
- require 'jade-rails/template'
26
+
27
+ require 'jade-rails/sprockets/transformer'
22
28
  require 'jade-rails/railtie'
@@ -1,34 +1,50 @@
1
+ # encoding: utf-8
1
2
  # frozen_string_literal: true
3
+
4
+ require 'rails/railtie'
5
+
2
6
  module Pug
3
- class Railtie < Rails::Engine
7
+ class Railtie < Rails::Railtie
4
8
  config.pug = Pug.config
5
9
  config.pug.pretty = Rails.env.development?
6
10
  config.pug.compile_debug = Rails.env.development?
7
11
 
8
- def configure_assets(app)
9
- if config.respond_to?(:assets) && config.assets.respond_to?(:configure)
10
- # Rails 4.x
11
- config.assets.configure { |env| yield(env) }
12
- else
13
- # Rails 3.2
14
- yield(app.assets)
15
- end
16
- end
17
-
18
- initializer 'sprockets.pug', group: :all, after: 'sprockets.environment' do |app|
19
- configure_assets(app) do |env|
12
+ initializer 'sprockets.pug.transformer', after: 'sprockets.environment', group: :all do |app|
13
+ access_assets_environment app do |env|
20
14
  # Sprockets 2, 3, and 4
21
15
  if env.respond_to?(:register_transformer)
22
16
  env.register_mime_type 'text/x-pug', extensions: ['.pug']
23
- env.register_transformer 'text/x-pug', 'application/javascript+function', Pug::SprocketsTransformer
17
+ env.register_transformer 'text/x-pug', 'application/javascript+function', Pug::Sprockets::Transformer
24
18
  end
25
19
 
26
20
  if env.respond_to?(:register_engine)
27
- args = ['.pug', Pug::SprocketsTransformer]
28
- args << { mime_type: 'text/x-pug', silence_deprecation: true } if Sprockets::VERSION.start_with?('3')
21
+ args = ['.pug', Pug::Sprockets::Transformer]
22
+ args << { mime_type: 'text/x-pug', silence_deprecation: true } if ::Sprockets::VERSION.start_with?('3')
29
23
  env.register_engine(*args)
30
24
  end
31
25
  end
32
26
  end
27
+
28
+ initializer 'sprockets.pug.runtime', after: :append_assets_path, group: :all do |app|
29
+ access_assets_config app do |assets|
30
+ assets.precompile += %w( pug/runtime.js )
31
+ assets.paths += [File.expand_path('../../../vendor/assets/javascripts', __FILE__)]
32
+ end
33
+ end
34
+
35
+ private
36
+ def access_assets_config(app)
37
+ yield app.config.assets
38
+ end
39
+
40
+ def access_assets_environment(app)
41
+ if config.respond_to?(:assets) && config.assets.respond_to?(:configure)
42
+ # Rails 4.x 5.x
43
+ config.assets.configure { |env| yield env }
44
+ else
45
+ # Rails 3.2
46
+ yield app.assets
47
+ end
48
+ end
33
49
  end
34
50
  end