nov-stylus 1.0.2

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,64 @@
1
+ require 'spec_helper'
2
+ require 'stylus/tilt/rails'
3
+
4
+ describe Stylus::Rails::StylusTemplate do
5
+ it 'registers the template for .styl files' do
6
+ expect(Tilt['application.styl']).to eq(Stylus::Rails::StylusTemplate)
7
+ end
8
+
9
+ it 'has a content-type' do
10
+ expect(Stylus::Rails::StylusTemplate.default_mime_type).to eq('text/css')
11
+ end
12
+
13
+ context 'when no resources other then css found' do
14
+ it 'compiles the given source without changes' do
15
+ result = fixture(:simple).last
16
+
17
+ app = create_app
18
+ expect(app.assets['simple'].to_s).to eq(result)
19
+ end
20
+ end
21
+
22
+
23
+ it 'substitutes asset_path with path' do
24
+ app = create_app do |app|
25
+ app.config.assets.paths << images_root
26
+ app.config.asset_host = 'http://localhost'
27
+ end
28
+ result = fixture(:asset_path).last
29
+ expect(app.assets['asset_path'].to_s).to eq(result)
30
+ end
31
+
32
+ it 'substitutes asset_url with url' do
33
+ app = create_app do |app|
34
+ app.config.assets.paths << images_root
35
+ app.config.asset_host = 'http://localhost'
36
+ end
37
+ result = fixture(:asset_url).last
38
+ expect(app.assets['asset_url'].to_s).to eq(result)
39
+ end
40
+
41
+ context 'when config.assets.digest = true' do
42
+ let(:app) do
43
+ create_app do |app|
44
+ app.config.assets.paths << images_root
45
+ app.config.asset_host = 'http://localhost'
46
+ app.config.assets.digest = true
47
+ end
48
+ end
49
+
50
+ it 'appends fingerprint to asset path' do
51
+ digested_image_path = app.assets['rails.png'].digest_path
52
+ expect(digested_image_path).to match(/^rails-(\w+)\.png$/)
53
+ asset = app.assets['digested_asset_path']
54
+ expect(asset.to_s).to eq("body {\n background-image: url(\"http://localhost/assets/#{digested_image_path}\");\n}\n")
55
+ end
56
+
57
+ it 'appends fingerprint to asset url' do
58
+ digested_image_path = app.assets['rails.png'].digest_path
59
+ expect(digested_image_path).to match(/^rails-(\w+)\.png$/)
60
+ asset = app.assets['digested_asset_url']
61
+ expect(asset.to_s).to eq("body {\n background-image: url(\"http://localhost/assets/#{digested_image_path}\");\n}\n")
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+ require 'stylus/tilt/stylus'
3
+
4
+ describe Tilt::StylusTemplate do
5
+ it 'registers the template for .styl files' do
6
+ expect(Tilt['application.styl']).to eq(Stylus::Rails::StylusTemplate)
7
+ end
8
+
9
+ it 'has a content-type' do
10
+ expect(Tilt::StylusTemplate.default_mime_type).to eq('text/css')
11
+ end
12
+
13
+ it 'compiles the given source' do
14
+ input, output = fixture(:simple)
15
+ template = Tilt::StylusTemplate.new { |_| input }
16
+ expect(template.render).to eq(output)
17
+ end
18
+
19
+ it 'compiles with the compress option' do
20
+ input, output = fixture(:compressed)
21
+ template = Tilt::StylusTemplate.new(compress: true) { |_| input }
22
+ expect(template.render).to eq(output)
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nov-stylus
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Lucas Mazza
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: execjs
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: stylus-source
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.8.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.8.0
55
+ description: Bridge library to compile .styl stylesheets from ruby code.
56
+ email:
57
+ - luc4smazza@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - CHANGELOG.md
63
+ - LICENSE
64
+ - README.md
65
+ - lib/rails/generators/stylus/assets/assets_generator.rb
66
+ - lib/rails/generators/stylus/assets/templates/stylesheet.css.styl
67
+ - lib/rails/generators/stylus/scaffold/scaffold_generator.rb
68
+ - lib/stylus.rb
69
+ - lib/stylus/import_processor.rb
70
+ - lib/stylus/railtie.rb
71
+ - lib/stylus/runtime.rb
72
+ - lib/stylus/runtime/compiler.js
73
+ - lib/stylus/runtime/runner.js
74
+ - lib/stylus/sprockets.rb
75
+ - lib/stylus/tilt.rb
76
+ - lib/stylus/tilt/rails.rb
77
+ - lib/stylus/tilt/stylus.rb
78
+ - lib/stylus/version.rb
79
+ - spec/generators/assets_generator_spec.rb
80
+ - spec/generators/controller_generator_spec.rb
81
+ - spec/generators/scaffold_generator_spec.rb
82
+ - spec/import_processor_spec.rb
83
+ - spec/rails_spec.rb
84
+ - spec/runtime_spec.rb
85
+ - spec/spec_helper.rb
86
+ - spec/sprockets_spec.rb
87
+ - spec/stylus_spec.rb
88
+ - spec/support/generators/test_case.rb
89
+ - spec/support/helpers.rb
90
+ - spec/support/matchers.rb
91
+ - spec/tilt/rails_spec.rb
92
+ - spec/tilt/stylus_spec.rb
93
+ homepage: https://github.com/lucasmazza/ruby-stylus
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.6.13
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Ruby Stylus Compiler
117
+ test_files:
118
+ - spec/spec_helper.rb
119
+ - spec/runtime_spec.rb
120
+ - spec/sprockets_spec.rb
121
+ - spec/stylus_spec.rb
122
+ - spec/support/helpers.rb
123
+ - spec/support/matchers.rb
124
+ - spec/support/generators/test_case.rb
125
+ - spec/generators/assets_generator_spec.rb
126
+ - spec/generators/scaffold_generator_spec.rb
127
+ - spec/generators/controller_generator_spec.rb
128
+ - spec/rails_spec.rb
129
+ - spec/tilt/stylus_spec.rb
130
+ - spec/tilt/rails_spec.rb
131
+ - spec/import_processor_spec.rb