pug-rails 2.0.3 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +32 -13
  3. data/Appraisals +33 -11
  4. data/Gemfile +6 -6
  5. data/Gemfile.lock +70 -67
  6. data/{vendor/assets/javascripts/pug/LICENCE → LICENSE} +7 -5
  7. data/README.md +5 -5
  8. data/Rakefile +3 -8
  9. data/gemfiles/{rails_3.gemfile → rails_3.1.gemfile} +2 -2
  10. data/gemfiles/{rails_3.gemfile.lock → rails_3.1.gemfile.lock} +11 -11
  11. data/gemfiles/rails_3.2.gemfile +9 -0
  12. data/gemfiles/rails_3.2.gemfile.lock +124 -0
  13. data/gemfiles/rails_4.1_with_sprockets_2.gemfile +9 -0
  14. data/gemfiles/rails_4.1_with_sprockets_2.gemfile.lock +140 -0
  15. data/gemfiles/{rails_4_with_sprockets_3.gemfile → rails_4.1_with_sprockets_3.gemfile} +2 -2
  16. data/gemfiles/{rails_4_with_sprockets_3.gemfile.lock → rails_4.1_with_sprockets_3.gemfile.lock} +46 -48
  17. data/gemfiles/rails_4.2_with_sprockets_2.gemfile +9 -0
  18. data/gemfiles/rails_4.2_with_sprockets_2.gemfile.lock +140 -0
  19. data/gemfiles/{rails_4_with_sprockets_2.gemfile → rails_4.2_with_sprockets_3.gemfile} +2 -2
  20. data/gemfiles/{rails_4_with_sprockets_2.gemfile.lock → rails_4.2_with_sprockets_3.gemfile.lock} +46 -48
  21. data/gemfiles/{rails_5.gemfile → rails_5.0.gemfile} +2 -2
  22. data/gemfiles/{rails_5.gemfile.lock → rails_5.0.gemfile.lock} +59 -59
  23. data/gemfiles/rails_5.1.gemfile +9 -0
  24. data/gemfiles/rails_5.1.gemfile.lock +142 -0
  25. data/lib/jade-rails/railtie.rb +14 -14
  26. data/lib/jade-rails/sprockets/transformer.rb +28 -4
  27. data/lib/pug-rails.rb +8 -23
  28. data/lib/pug-rails/railtie.rb +14 -14
  29. data/lib/pug-rails/sprockets/transformer.rb +28 -4
  30. data/lib/pug-rails/version.rb +1 -0
  31. data/pug-rails.gemspec +18 -16
  32. data/test/fixtures/javascripts/{application.js → application-1.js} +0 -0
  33. data/test/fixtures/javascripts/application-1.js.expected +10 -0
  34. data/test/fixtures/javascripts/application-2.js +2 -0
  35. data/test/test-helper.rb +62 -0
  36. data/test/test-pug-rails.rb +21 -76
  37. metadata +33 -21
  38. data/vendor/assets/javascripts/jade/LICENCE +0 -22
  39. data/vendor/assets/javascripts/jade/runtime.js +0 -252
  40. data/vendor/assets/javascripts/pug/runtime.js +0 -259
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 5.1"
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.1.2)
11
+ actionpack (= 5.1.2)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (~> 0.6.1)
14
+ actionmailer (5.1.2)
15
+ actionpack (= 5.1.2)
16
+ actionview (= 5.1.2)
17
+ activejob (= 5.1.2)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.1.2)
21
+ actionview (= 5.1.2)
22
+ activesupport (= 5.1.2)
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.1.2)
28
+ activesupport (= 5.1.2)
29
+ builder (~> 3.1)
30
+ erubi (~> 1.4)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
+ activejob (5.1.2)
34
+ activesupport (= 5.1.2)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.1.2)
37
+ activesupport (= 5.1.2)
38
+ activerecord (5.1.2)
39
+ activemodel (= 5.1.2)
40
+ activesupport (= 5.1.2)
41
+ arel (~> 8.0)
42
+ activesupport (5.1.2)
43
+ concurrent-ruby (~> 1.0, >= 1.0.2)
44
+ i18n (~> 0.7)
45
+ minitest (~> 5.1)
46
+ tzinfo (~> 1.1)
47
+ appraisal (2.2.0)
48
+ bundler
49
+ rake
50
+ thor (>= 0.14.0)
51
+ arel (8.0.0)
52
+ builder (3.2.3)
53
+ byebug (9.0.6)
54
+ coderay (1.1.1)
55
+ concurrent-ruby (1.0.5)
56
+ erubi (1.6.1)
57
+ globalid (0.4.0)
58
+ activesupport (>= 4.2.0)
59
+ i18n (0.8.6)
60
+ loofah (2.0.3)
61
+ nokogiri (>= 1.5.9)
62
+ mail (2.6.6)
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.3)
70
+ nio4r (2.1.0)
71
+ nokogiri (1.6.8.1)
72
+ mini_portile2 (~> 2.1.0)
73
+ power_assert (1.0.2)
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.3)
83
+ rack-test (0.6.3)
84
+ rack (>= 1.0)
85
+ rails (5.1.2)
86
+ actioncable (= 5.1.2)
87
+ actionmailer (= 5.1.2)
88
+ actionpack (= 5.1.2)
89
+ actionview (= 5.1.2)
90
+ activejob (= 5.1.2)
91
+ activemodel (= 5.1.2)
92
+ activerecord (= 5.1.2)
93
+ activesupport (= 5.1.2)
94
+ bundler (>= 1.3.0, < 2.0)
95
+ railties (= 5.1.2)
96
+ sprockets-rails (>= 2.0.0)
97
+ rails-dom-testing (2.0.3)
98
+ activesupport (>= 4.2.0)
99
+ nokogiri (>= 1.6)
100
+ rails-html-sanitizer (1.0.3)
101
+ loofah (~> 2.0)
102
+ railties (5.1.2)
103
+ actionpack (= 5.1.2)
104
+ activesupport (= 5.1.2)
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.5)
118
+ power_assert
119
+ thor (0.19.4)
120
+ thread_safe (0.3.6)
121
+ tzinfo (1.2.3)
122
+ thread_safe (~> 0.1)
123
+ websocket-driver (0.6.5)
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.1)
137
+ rake (~> 10.0)
138
+ sprockets (~> 3)
139
+ test-unit (~> 3.1)
140
+
141
+ BUNDLED WITH
142
+ 1.15.3
@@ -1,34 +1,34 @@
1
- # encoding: utf-8
1
+ # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'rails/railtie'
5
-
6
4
  module Jade
7
5
  class Railtie < Rails::Railtie
8
6
  config.jade = Jade.config
9
7
  config.jade.pretty = Rails.env.development?
10
8
  config.jade.compile_debug = Rails.env.development?
11
9
 
12
- initializer 'sprockets.jade.transformer', after: 'sprockets.environment', group: :all do |app|
10
+ initializer "sprockets.jade.transformer", after: "sprockets.environment", group: :all do |app|
13
11
  access_assets_environment app do |env|
14
- # Sprockets 2, 3, and 4
12
+ # Sprockets 2.x, 3.x, and 4.x.
13
+ # https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#registering-all-versions-of-sprockets-in-processors
15
14
  if env.respond_to?(:register_transformer)
16
- env.register_mime_type 'text/x-jade', extensions: ['.jade']
17
- env.register_transformer 'text/x-jade', 'application/javascript+function', Jade::Sprockets::Transformer
15
+ env.register_mime_type "text/x-jade", extensions: [".jade"]
16
+ env.register_transformer "text/x-jade", "application/javascript+function", Jade::Sprockets::Transformer
18
17
  end
19
18
 
20
19
  if env.respond_to?(:register_engine)
21
- args = ['.jade', Jade::Sprockets::Transformer]
22
- args << { mime_type: 'text/x-jade', silence_deprecation: true } if ::Sprockets::VERSION.start_with?('3')
20
+ args = [".jade", Jade::Sprockets::Transformer]
21
+ args << { mime_type: "text/x-jade", silence_deprecation: true } if ::Sprockets::VERSION.start_with?("3")
23
22
  env.register_engine(*args)
24
23
  end
25
24
  end
26
25
  end
27
26
 
28
- initializer 'sprockets.jade.runtime', after: :append_assets_path, group: :all do |app|
27
+ initializer "sprockets.jade.paths", after: :append_assets_path, group: :all do |app|
29
28
  access_assets_config app do |assets|
30
- assets.precompile += %w( jade/runtime.js )
31
- assets.paths += [File.expand_path('../../../vendor/assets/javascripts', __FILE__)]
29
+ File.join(Gem::Specification.find_by_name("pug-ruby").gem_dir, "vendor").tap do |path|
30
+ assets.paths << path unless assets.paths.include?(path)
31
+ end
32
32
  end
33
33
  end
34
34
 
@@ -39,10 +39,10 @@ module Jade
39
39
 
40
40
  def access_assets_environment(app)
41
41
  if config.respond_to?(:assets) && config.assets.respond_to?(:configure)
42
- # Rails 4.x 5.x
42
+ # Rails 4.x and 5.x.
43
43
  config.assets.configure { |env| yield env }
44
44
  else
45
- # Rails 3.2
45
+ # Rails 3.x.
46
46
  yield app.assets
47
47
  end
48
48
  end
@@ -1,10 +1,20 @@
1
- # encoding: utf-8
1
+ # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
+ require "digest/sha1"
5
+
4
6
  module Jade
5
7
  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 << self
9
+ def compile(source, options = {})
10
+ Jade.compile(source, options)
11
+ end
12
+ end
13
+
14
+ #
15
+ # Friendly with sprockets 2.x, 3.x, and 4.x.
16
+ # https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
17
+ #
8
18
  class Transformer
9
19
  def initialize(filename, &block)
10
20
  @filename = filename
@@ -15,8 +25,12 @@ module Jade
15
25
  self.class.run(@filename, @source, context)
16
26
  end
17
27
 
28
+ def cache_key
29
+ self.class.cache_key
30
+ end
31
+
18
32
  def self.run(filename, source, context)
19
- Jade.compile(source, filename: filename, client: true)
33
+ Jade::Sprockets.compile(source, filename: filename, client: true)
20
34
  end
21
35
 
22
36
  def self.call(input)
@@ -27,6 +41,16 @@ module Jade
27
41
  result = run(filename, source, context)
28
42
  context.metadata.merge(data: result)
29
43
  end
44
+
45
+ def self.cache_key
46
+ [name,
47
+ PUG_RUBY_GEM_VERSION,
48
+ PUG_RAILS_GEM_VERSION,
49
+ Jade.compiler.version,
50
+ Jade.compiler.class.name,
51
+ Digest::SHA1.hexdigest(Jade.config.to_h.to_a.flatten.map(&:to_s).join(""))
52
+ ].join(":").freeze
53
+ end
30
54
  end
31
55
  end
32
56
  end
@@ -1,28 +1,13 @@
1
- # encoding: utf-8
1
+ # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- module Jade
5
- class << self
6
- attr_accessor :runtime_version
7
- end
8
- end
4
+ require "rails"
5
+ require "rails/railtie"
9
6
 
10
- module Pug
11
- class << self
12
- attr_accessor :runtime_version
13
- end
14
- end
7
+ require "pug-ruby"
15
8
 
16
- # https://github.com/pugjs/pug/blob/v1.x.x/runtime.js
17
- Jade.runtime_version = '1.11.0'
9
+ require "pug-rails/sprockets/transformer"
10
+ require "pug-rails/railtie"
18
11
 
19
- # https://github.com/pugjs/pug-runtime
20
- Pug.runtime_version = '2.0.2'
21
-
22
- require 'pug-ruby'
23
-
24
- require 'pug-rails/sprockets/transformer'
25
- require 'pug-rails/railtie'
26
-
27
- require 'jade-rails/sprockets/transformer'
28
- require 'jade-rails/railtie'
12
+ require "jade-rails/sprockets/transformer"
13
+ require "jade-rails/railtie"
@@ -1,34 +1,34 @@
1
- # encoding: utf-8
1
+ # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'rails/railtie'
5
-
6
4
  module Pug
7
5
  class Railtie < Rails::Railtie
8
6
  config.pug = Pug.config
9
7
  config.pug.pretty = Rails.env.development?
10
8
  config.pug.compile_debug = Rails.env.development?
11
9
 
12
- initializer 'sprockets.pug.transformer', after: 'sprockets.environment', group: :all do |app|
10
+ initializer "sprockets.pug.transformer", after: "sprockets.environment", group: :all do |app|
13
11
  access_assets_environment app do |env|
14
- # Sprockets 2, 3, and 4
12
+ # Sprockets 2.x, 3.x, and 4.x.
13
+ # https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#registering-all-versions-of-sprockets-in-processors
15
14
  if env.respond_to?(:register_transformer)
16
- env.register_mime_type 'text/x-pug', extensions: ['.pug']
17
- env.register_transformer 'text/x-pug', 'application/javascript+function', Pug::Sprockets::Transformer
15
+ env.register_mime_type "text/x-pug", extensions: [".pug"]
16
+ env.register_transformer "text/x-pug", "application/javascript+function", Pug::Sprockets::Transformer
18
17
  end
19
18
 
20
19
  if env.respond_to?(:register_engine)
21
- args = ['.pug', Pug::Sprockets::Transformer]
22
- args << { mime_type: 'text/x-pug', silence_deprecation: true } if ::Sprockets::VERSION.start_with?('3')
20
+ args = [".pug", Pug::Sprockets::Transformer]
21
+ args << { mime_type: "text/x-pug", silence_deprecation: true } if ::Sprockets::VERSION.start_with?("3")
23
22
  env.register_engine(*args)
24
23
  end
25
24
  end
26
25
  end
27
26
 
28
- initializer 'sprockets.pug.runtime', after: :append_assets_path, group: :all do |app|
27
+ initializer "sprockets.pug.paths", after: :append_assets_path, group: :all do |app|
29
28
  access_assets_config app do |assets|
30
- assets.precompile += %w( pug/runtime.js )
31
- assets.paths += [File.expand_path('../../../vendor/assets/javascripts', __FILE__)]
29
+ File.join(Gem::Specification.find_by_name("pug-ruby").gem_dir, "vendor").tap do |path|
30
+ assets.paths << path unless assets.paths.include?(path)
31
+ end
32
32
  end
33
33
  end
34
34
 
@@ -39,10 +39,10 @@ module Pug
39
39
 
40
40
  def access_assets_environment(app)
41
41
  if config.respond_to?(:assets) && config.assets.respond_to?(:configure)
42
- # Rails 4.x 5.x
42
+ # Rails 4.x and 5.x.
43
43
  config.assets.configure { |env| yield env }
44
44
  else
45
- # Rails 3.2
45
+ # Rails 3.x.
46
46
  yield app.assets
47
47
  end
48
48
  end
@@ -1,10 +1,20 @@
1
- # encoding: utf-8
1
+ # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
+ require "digest/sha1"
5
+
4
6
  module Pug
5
7
  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 << self
9
+ def compile(source, options = {})
10
+ Pug.compile(source, options)
11
+ end
12
+ end
13
+
14
+ #
15
+ # Friendly with sprockets 2.x, 3.x, and 4.x.
16
+ # https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
17
+ #
8
18
  class Transformer
9
19
  def initialize(filename, &block)
10
20
  @filename = filename
@@ -15,8 +25,12 @@ module Pug
15
25
  self.class.run(@filename, @source, context)
16
26
  end
17
27
 
28
+ def cache_key
29
+ self.class.cache_key
30
+ end
31
+
18
32
  def self.run(filename, source, context)
19
- Pug.compile(source, filename: filename, client: true)
33
+ Pug::Sprockets.compile(source, filename: filename, client: true)
20
34
  end
21
35
 
22
36
  def self.call(input)
@@ -27,6 +41,16 @@ module Pug
27
41
  result = run(filename, source, context)
28
42
  context.metadata.merge(data: result)
29
43
  end
44
+
45
+ def self.cache_key
46
+ [name,
47
+ PUG_RUBY_GEM_VERSION,
48
+ PUG_RAILS_GEM_VERSION,
49
+ Pug.compiler.version,
50
+ Pug.compiler.class.name,
51
+ Digest::SHA1.hexdigest(Pug.config.to_h.to_a.flatten.map(&:to_s).join(""))
52
+ ].join(":").freeze
53
+ end
30
54
  end
31
55
  end
32
56
  end
@@ -0,0 +1 @@
1
+ PUG_RAILS_GEM_VERSION = "3.0.0.rc1"
@@ -1,24 +1,26 @@
1
- # encoding: utf-8
1
+ # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
+ require File.expand_path("../lib/pug-rails/version", __FILE__)
5
+
4
6
  Gem::Specification.new do |s|
5
- s.name = 'pug-rails'
6
- s.version = '2.0.3'
7
- s.author = 'Yaroslav Konoplov'
8
- s.email = 'eahome00@gmail.com'
9
- s.summary = 'Pug/Jade template engine integration with Rails asset pipeline.'
10
- s.description = 'Pug/Jade template engine integration with Rails asset pipeline.'
11
- s.homepage = 'https://github.com/yivo/pug-rails'
12
- s.license = 'MIT'
7
+ s.name = "pug-rails"
8
+ s.version = PUG_RAILS_GEM_VERSION
9
+ s.author = "Yaroslav Konoplov"
10
+ s.email = "eahome00@gmail.com"
11
+ s.summary = "Pug/Jade template engine integration with Rails asset pipeline."
12
+ s.description = "Pug/Jade template engine integration with Rails asset pipeline."
13
+ s.homepage = "https://github.com/yivo/pug-rails"
14
+ s.license = "MIT"
13
15
 
14
16
  s.files = `git ls-files -z`.split("\x0")
15
17
  s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
16
- s.require_paths = ['lib']
18
+ s.require_paths = ["lib"]
17
19
 
18
- s.add_dependency 'pug-ruby', '~> 1.0'
19
- s.add_development_dependency 'bundler', '~> 1.7'
20
- s.add_development_dependency 'rake', '~> 10.0'
21
- s.add_development_dependency 'appraisal', '~> 2.1'
22
- s.add_development_dependency 'test-unit', '~> 3.1'
23
- s.add_development_dependency 'nokogiri', '~> 1.6', '< 1.7'
20
+ s.add_dependency "pug-ruby", "~> 2.0.0"
21
+ s.add_development_dependency "bundler", "~> 1.7"
22
+ s.add_development_dependency "rake", "~> 10.0"
23
+ s.add_development_dependency "appraisal", "~> 2.1"
24
+ s.add_development_dependency "test-unit", "~> 3.1"
25
+ s.add_development_dependency "nokogiri", "~> 1.6", "< 1.7"
24
26
  end