sass-archive-importer 1.0.0.beta.4 → 1.0.0.beta.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sass_archive_importer/version.rb +1 -1
- data/sass-archive-importer.gemspec +2 -2
- metadata +3 -33
- data/test/class_loader_importer_test.java +0 -195
- data/test/fixtures/.gitignore +0 -1
- data/test/fixtures/imports_from_zip.scss +0 -7
- data/test/fixtures/imports_from_zip_subfolder.scss +0 -1
- data/test/fixtures/jruby-complete-1.6.5.jar +0 -0
- data/test/fixtures/zipped_files/_css_partial.css +0 -3
- data/test/fixtures/zipped_files/_sass_partial.sass +0 -2
- data/test/fixtures/zipped_files/_scss_partial.scss +0 -3
- data/test/fixtures/zipped_files/a_css_file.css +0 -3
- data/test/fixtures/zipped_files/a_sass_file.sass +0 -2
- data/test/fixtures/zipped_files/a_scss_file.scss +0 -3
- data/test/fixtures/zipped_files/has_missing_import.scss +0 -1
- data/test/fixtures/zipped_files/nested/_nested.scss +0 -4
- data/test/fixtures/zipped_files/nested/deeply_nested/_deeply.scss +0 -3
- data/test/sass_archive_importer_test.rb +0 -100
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7303983418552370f4cebcf9687552ba7816702
|
4
|
+
data.tar.gz: 96a68c45c7d72c83c83bf3318bcecfa805f42b8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8775568ee61a43211e6e2989c4447ccad5c1a5ae42b9190c323c7f6bde421cea5b6a0b0c5138b25f1f39a0bb3d4a9f6927736dd74b9f9880c3f4fe9804029aed
|
7
|
+
data.tar.gz: 0fba98baeb3e499c7a152f55cb03021e8fc8f5dc766bcdc237b2d691cc53ace8ff463b1d82ba8bc900d4151eca3d4e50287a614a3f59b6ba26717e2915e8c313
|
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
"JRuby from the java class loader."
|
17
17
|
s.license = 'Apache 2.0'
|
18
18
|
|
19
|
-
s.files = `git ls-files`.split("\n")
|
20
|
-
s.test_files =
|
19
|
+
s.files = `git ls-files`.split("\n").reject {|f| f =~ /^test/ }
|
20
|
+
s.test_files = []
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
23
|
s.add_runtime_dependency 'sass', '>= 3.1', '< 3.4'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass-archive-importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.beta.
|
4
|
+
version: 1.0.0.beta.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Eppstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -67,21 +67,6 @@ files:
|
|
67
67
|
- lib/sass_archive_importer/monkey_patches.rb
|
68
68
|
- lib/sass_archive_importer/version.rb
|
69
69
|
- sass-archive-importer.gemspec
|
70
|
-
- test/class_loader_importer_test.java
|
71
|
-
- test/fixtures/.gitignore
|
72
|
-
- test/fixtures/imports_from_zip.scss
|
73
|
-
- test/fixtures/imports_from_zip_subfolder.scss
|
74
|
-
- test/fixtures/jruby-complete-1.6.5.jar
|
75
|
-
- test/fixtures/zipped_files/_css_partial.css
|
76
|
-
- test/fixtures/zipped_files/_sass_partial.sass
|
77
|
-
- test/fixtures/zipped_files/_scss_partial.scss
|
78
|
-
- test/fixtures/zipped_files/a_css_file.css
|
79
|
-
- test/fixtures/zipped_files/a_sass_file.sass
|
80
|
-
- test/fixtures/zipped_files/a_scss_file.scss
|
81
|
-
- test/fixtures/zipped_files/has_missing_import.scss
|
82
|
-
- test/fixtures/zipped_files/nested/_nested.scss
|
83
|
-
- test/fixtures/zipped_files/nested/deeply_nested/_deeply.scss
|
84
|
-
- test/sass_archive_importer_test.rb
|
85
70
|
homepage: http://github.com/linkedin/sass-archive-importer
|
86
71
|
licenses:
|
87
72
|
- Apache 2.0
|
@@ -107,20 +92,5 @@ signing_key:
|
|
107
92
|
specification_version: 4
|
108
93
|
summary: Allows sass, scss, and css files within zip and jar files to be found using
|
109
94
|
Sass @import directives.
|
110
|
-
test_files:
|
111
|
-
- test/class_loader_importer_test.java
|
112
|
-
- test/fixtures/.gitignore
|
113
|
-
- test/fixtures/imports_from_zip.scss
|
114
|
-
- test/fixtures/imports_from_zip_subfolder.scss
|
115
|
-
- test/fixtures/jruby-complete-1.6.5.jar
|
116
|
-
- test/fixtures/zipped_files/_css_partial.css
|
117
|
-
- test/fixtures/zipped_files/_sass_partial.sass
|
118
|
-
- test/fixtures/zipped_files/_scss_partial.scss
|
119
|
-
- test/fixtures/zipped_files/a_css_file.css
|
120
|
-
- test/fixtures/zipped_files/a_sass_file.sass
|
121
|
-
- test/fixtures/zipped_files/a_scss_file.scss
|
122
|
-
- test/fixtures/zipped_files/has_missing_import.scss
|
123
|
-
- test/fixtures/zipped_files/nested/_nested.scss
|
124
|
-
- test/fixtures/zipped_files/nested/deeply_nested/_deeply.scss
|
125
|
-
- test/sass_archive_importer_test.rb
|
95
|
+
test_files: []
|
126
96
|
has_rdoc:
|
@@ -1,195 +0,0 @@
|
|
1
|
-
//import org.sass.archive_importer.ClassLoaderImporter;
|
2
|
-
import org.jruby.Ruby;
|
3
|
-
|
4
|
-
class ClassLoaderImporterTest {
|
5
|
-
public void testClassLoaderImporter() {
|
6
|
-
final Ruby runtime = Ruby.newInstance();
|
7
|
-
String script =
|
8
|
-
"# The next three lines make sure no system gems are loaded.\n" +
|
9
|
-
"$:.reject!{|f| !f.start_with?('file:') }\n" +
|
10
|
-
"ENV['GEM_HOME'] = nil\n" +
|
11
|
-
"ENV['GEM_PATH'] = nil\n" +
|
12
|
-
"require 'rubygems'\n" +
|
13
|
-
"require 'sass'\n" +
|
14
|
-
"require 'java'\n" +
|
15
|
-
"require 'org/sass/archive_importer/ClassLoaderImporter'\n" +
|
16
|
-
"class_path_importer = ClassLoaderImporter.new\n" +
|
17
|
-
"sass_file_contents = %Q{\n" +
|
18
|
-
"@import \"css_partial\";\n" +
|
19
|
-
"@import \"sass_partial\";\n" +
|
20
|
-
"@import \"scss_partial\";\n" +
|
21
|
-
"@import \"a_css_file\";\n" +
|
22
|
-
"@import \"a_sass_file\";\n" +
|
23
|
-
"@import \"a_scss_file\";\n" +
|
24
|
-
"@import \"nested/nested\";\n" +
|
25
|
-
"}\n" +
|
26
|
-
"engine = Sass::Engine.new(sass_file_contents,\n" +
|
27
|
-
" :syntax => :scss,\n" +
|
28
|
-
" :filename => 'class_loader_import_test_script.java',\n" +
|
29
|
-
" :cache => false,\n" +
|
30
|
-
" :read_cache => false,\n" +
|
31
|
-
" :load_paths => [class_path_importer])\n" +
|
32
|
-
"result = engine.render\n" +
|
33
|
-
"fail %Q{Unexpected output: #{result}} unless result == <<CSS\n" +
|
34
|
-
".css-partial {\n" +
|
35
|
-
" color: black; }\n" +
|
36
|
-
"\n" +
|
37
|
-
".sass-partial {\n" +
|
38
|
-
" partial: yep; }\n" +
|
39
|
-
"\n" +
|
40
|
-
".scss-partial {\n" +
|
41
|
-
" partial: yes; }\n" +
|
42
|
-
"\n" +
|
43
|
-
".css-file {\n" +
|
44
|
-
" css: boring; }\n" +
|
45
|
-
"\n" +
|
46
|
-
".sass-file {\n" +
|
47
|
-
" indented: yes; }\n" +
|
48
|
-
"\n" +
|
49
|
-
".scss-file {\n" +
|
50
|
-
" curly-braces: omg; }\n" +
|
51
|
-
"\n" +
|
52
|
-
".deeply-nested {\n" +
|
53
|
-
" deeply: nested; }\n" +
|
54
|
-
"\n" +
|
55
|
-
".nested-class {\n" +
|
56
|
-
" nested: yep; }\n" +
|
57
|
-
"CSS\n"+
|
58
|
-
"\n";
|
59
|
-
runtime.evalScriptlet(script);
|
60
|
-
}
|
61
|
-
|
62
|
-
public void testClassLoaderImporterNestedContext() {
|
63
|
-
final Ruby runtime = Ruby.newInstance();
|
64
|
-
String script =
|
65
|
-
"# The next three lines make sure no system gems are loaded.\n" +
|
66
|
-
"$:.reject!{|f| !f.start_with?('file:') }\n" +
|
67
|
-
"ENV['GEM_HOME'] = nil\n" +
|
68
|
-
"ENV['GEM_PATH'] = nil\n" +
|
69
|
-
"require 'rubygems'\n" +
|
70
|
-
"require 'sass'\n" +
|
71
|
-
"require 'java'\n" +
|
72
|
-
"require 'org/sass/archive_importer/ClassLoaderImporter'\n" +
|
73
|
-
"class_path_importer = ClassLoaderImporter.new('sass_files')\n" +
|
74
|
-
"sass_file_contents = %Q{\n" +
|
75
|
-
"@import \"css_partial\";\n" +
|
76
|
-
"@import \"sass_partial\";\n" +
|
77
|
-
"@import \"scss_partial\";\n" +
|
78
|
-
"@import \"a_css_file\";\n" +
|
79
|
-
"@import \"a_sass_file\";\n" +
|
80
|
-
"@import \"a_scss_file\";\n" +
|
81
|
-
"@import \"nested/nested\";\n" +
|
82
|
-
"}\n" +
|
83
|
-
"engine = Sass::Engine.new(sass_file_contents,\n" +
|
84
|
-
" :syntax => :scss,\n" +
|
85
|
-
" :filename => 'class_loader_import_test_script.java',\n" +
|
86
|
-
" :cache => false,\n" +
|
87
|
-
" :read_cache => false,\n" +
|
88
|
-
" :load_paths => [class_path_importer])\n" +
|
89
|
-
"result = engine.render\n" +
|
90
|
-
"fail %Q{Unexpected output: #{result}} unless result == <<CSS\n" +
|
91
|
-
".css-partial {\n" +
|
92
|
-
" color: black; }\n" +
|
93
|
-
"\n" +
|
94
|
-
".sass-partial {\n" +
|
95
|
-
" partial: yep; }\n" +
|
96
|
-
"\n" +
|
97
|
-
".scss-partial {\n" +
|
98
|
-
" partial: yes; }\n" +
|
99
|
-
"\n" +
|
100
|
-
".css-file {\n" +
|
101
|
-
" css: boring; }\n" +
|
102
|
-
"\n" +
|
103
|
-
".sass-file {\n" +
|
104
|
-
" indented: yes; }\n" +
|
105
|
-
"\n" +
|
106
|
-
".scss-file {\n" +
|
107
|
-
" curly-braces: omg; }\n" +
|
108
|
-
"\n" +
|
109
|
-
".deeply-nested {\n" +
|
110
|
-
" deeply: nested; }\n" +
|
111
|
-
"\n" +
|
112
|
-
".nested-class {\n" +
|
113
|
-
" nested: yep; }\n" +
|
114
|
-
"CSS\n"+
|
115
|
-
"\n";
|
116
|
-
runtime.evalScriptlet(script);
|
117
|
-
}
|
118
|
-
|
119
|
-
public void testClassLoaderImporterMissingImport() {
|
120
|
-
final Ruby runtime = Ruby.newInstance();
|
121
|
-
String script =
|
122
|
-
"# The next three lines make sure no system gems are loaded.\n" +
|
123
|
-
"$:.reject!{|f| !f.start_with?('file:') }\n" +
|
124
|
-
"ENV['GEM_HOME'] = nil\n" +
|
125
|
-
"ENV['GEM_PATH'] = nil\n" +
|
126
|
-
"require 'rubygems'\n" +
|
127
|
-
"require 'sass'\n" +
|
128
|
-
"require 'java'\n" +
|
129
|
-
"require 'org/sass/archive_importer/ClassLoaderImporter'\n" +
|
130
|
-
"class_path_importer = ClassLoaderImporter.new\n" +
|
131
|
-
"sass_file_contents = %Q{\n" +
|
132
|
-
"@import \"has_missing_import\";\n" +
|
133
|
-
"}\n" +
|
134
|
-
"engine = Sass::Engine.new(sass_file_contents,\n" +
|
135
|
-
" :syntax => :scss,\n" +
|
136
|
-
" :filename => 'class_loader_import_test_script.java',\n" +
|
137
|
-
" :cache => false,\n" +
|
138
|
-
" :read_cache => false,\n" +
|
139
|
-
" :load_paths => [class_path_importer])\n" +
|
140
|
-
"begin\n" +
|
141
|
-
" engine.render\n" +
|
142
|
-
" fail 'Exception expected'\n" +
|
143
|
-
"rescue => e\n" +
|
144
|
-
" fail 'Expected a Sass::SyntaxError' unless e.is_a?(Sass::SyntaxError)\n" +
|
145
|
-
" fail %Q{expected message but got: #{e.message}} unless e.message == <<MSG.strip\n" +
|
146
|
-
"File to import not found or unreadable: this_does_not_exist.\n" +
|
147
|
-
"Load path: <ClassLoaderImporter>\n" +
|
148
|
-
"MSG\n" +
|
149
|
-
"end\n" +
|
150
|
-
"\n";
|
151
|
-
runtime.evalScriptlet(script);
|
152
|
-
}
|
153
|
-
|
154
|
-
public void testClassLoaderImporterWithCompass() {
|
155
|
-
final Ruby runtime = Ruby.newInstance();
|
156
|
-
String script =
|
157
|
-
"# The next three lines make sure no system gems are loaded.\n" +
|
158
|
-
"$:.reject!{|f| !f.start_with?('file:') }\n" +
|
159
|
-
"ENV['GEM_HOME'] = nil\n" +
|
160
|
-
"ENV['GEM_PATH'] = nil\n" +
|
161
|
-
"require 'rubygems'\n" +
|
162
|
-
"require 'compass'\n" +
|
163
|
-
"require 'sass_archive_importer'\n" +
|
164
|
-
"sass_file_contents = %Q{\n" +
|
165
|
-
"@import \"compass\";\n" +
|
166
|
-
".test { @include border-radius(5px) };\n" +
|
167
|
-
"}\n" +
|
168
|
-
"engine = Sass::Engine.new(sass_file_contents,\n" +
|
169
|
-
" :syntax => :scss,\n" +
|
170
|
-
" :filename => 'class_loader_compass_test.java',\n" +
|
171
|
-
" :cache => false,\n" +
|
172
|
-
" :read_cache => false,\n" +
|
173
|
-
" :load_paths => Compass.configuration.sass_load_paths)\n" +
|
174
|
-
"result = engine.render\n" +
|
175
|
-
"fail %Q{Unexpected output: #{result}} unless result == <<CSS\n" +
|
176
|
-
".test {\n" +
|
177
|
-
" -webkit-border-radius: 5px;\n" +
|
178
|
-
" -moz-border-radius: 5px;\n" +
|
179
|
-
" -ms-border-radius: 5px;\n" +
|
180
|
-
" -o-border-radius: 5px;\n" +
|
181
|
-
" border-radius: 5px; }\n" +
|
182
|
-
"CSS\n"+
|
183
|
-
"\n";
|
184
|
-
runtime.evalScriptlet(script);
|
185
|
-
}
|
186
|
-
|
187
|
-
public static void main(String [] args) {
|
188
|
-
ClassLoaderImporterTest test = new ClassLoaderImporterTest();
|
189
|
-
test.testClassLoaderImporter();
|
190
|
-
test.testClassLoaderImporterNestedContext();
|
191
|
-
test.testClassLoaderImporterMissingImport();
|
192
|
-
test.testClassLoaderImporterWithCompass();
|
193
|
-
System.out.println("ALL Java Tests Passed");
|
194
|
-
}
|
195
|
-
}
|
data/test/fixtures/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
zipped_files.zip
|
@@ -1 +0,0 @@
|
|
1
|
-
@import "nested";
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
@import "this_does_not_exist";
|
@@ -1,100 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# Copyright 2013 LinkedIn Corp. All rights reserved.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
|
18
|
-
$: << lib_dir unless $:.include?(lib_dir)
|
19
|
-
require 'test/unit'
|
20
|
-
require 'zip/zip'
|
21
|
-
require 'pathname'
|
22
|
-
require 'fileutils'
|
23
|
-
require 'sass'
|
24
|
-
require 'sass-archive-importer'
|
25
|
-
|
26
|
-
class SassArchiveImporterTest < Test::Unit::TestCase
|
27
|
-
FIXTURES_DIR = File.expand_path(File.join(File.dirname(__FILE__), "fixtures"))
|
28
|
-
# These fixtures are created and kept up to date by the rakefile
|
29
|
-
# Run `rake test` to re-create them
|
30
|
-
ZIP_FIXTURE = File.join(FIXTURES_DIR, "zipped_files.zip")
|
31
|
-
JAR_FIXTURE = File.join(FIXTURES_DIR, "jarred_files.jar")
|
32
|
-
|
33
|
-
def test_can_import_files_from_zip
|
34
|
-
css = render_file_from_zip("imports_from_zip.scss")
|
35
|
-
assert_match(/\.css-partial/, css)
|
36
|
-
assert_match(/\.css-file/, css)
|
37
|
-
assert_match(/\.sass-partial/, css)
|
38
|
-
assert_match(/\.sass-file/, css)
|
39
|
-
assert_match(/\.scss-partial/, css)
|
40
|
-
assert_match(/\.scss-file/, css)
|
41
|
-
assert_match(/\.nested-class/, css)
|
42
|
-
assert_match(/\.deeply-nested/, css)
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_can_import_files_from_jar
|
46
|
-
css = render_file_from_jar("imports_from_zip.scss")
|
47
|
-
assert_match(/\.css-partial/, css)
|
48
|
-
assert_match(/\.css-file/, css)
|
49
|
-
assert_match(/\.sass-partial/, css)
|
50
|
-
assert_match(/\.sass-file/, css)
|
51
|
-
assert_match(/\.scss-partial/, css)
|
52
|
-
assert_match(/\.scss-file/, css)
|
53
|
-
assert_match(/\.nested-class/, css)
|
54
|
-
assert_match(/\.deeply-nested/, css)
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_can_import_files_from_jar_subfolder
|
58
|
-
results = render_file("imports_from_zip_subfolder.scss", "#{JAR_FIXTURE}!nested")
|
59
|
-
assert_equal <<CSS, results
|
60
|
-
.deeply-nested {
|
61
|
-
deeply: nested; }
|
62
|
-
|
63
|
-
.nested-class {
|
64
|
-
nested: yep; }
|
65
|
-
CSS
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_can_import_files_from_zip_subfolder
|
69
|
-
results = render_file("imports_from_zip_subfolder.scss", "#{ZIP_FIXTURE}!nested")
|
70
|
-
assert_equal <<CSS, results
|
71
|
-
.deeply-nested {
|
72
|
-
deeply: nested; }
|
73
|
-
|
74
|
-
.nested-class {
|
75
|
-
nested: yep; }
|
76
|
-
CSS
|
77
|
-
end
|
78
|
-
|
79
|
-
private
|
80
|
-
def render_file(filename, fixture)
|
81
|
-
fixtures_dir = File.expand_path("fixtures", File.dirname(__FILE__))
|
82
|
-
full_filename = File.expand_path(filename, fixtures_dir)
|
83
|
-
syntax = File.extname(full_filename)[1..-1].to_sym
|
84
|
-
engine = Sass::Engine.new(File.read(full_filename),
|
85
|
-
:syntax => syntax,
|
86
|
-
:filename => full_filename,
|
87
|
-
:cache => false,
|
88
|
-
:read_cache => false,
|
89
|
-
:load_paths => [fixture])
|
90
|
-
engine.render
|
91
|
-
end
|
92
|
-
|
93
|
-
def render_file_from_zip(filename)
|
94
|
-
render_file(filename, ZIP_FIXTURE)
|
95
|
-
end
|
96
|
-
|
97
|
-
def render_file_from_jar(filename)
|
98
|
-
render_file(filename, JAR_FIXTURE)
|
99
|
-
end
|
100
|
-
end
|