sass-archive-importer 1.0.0.beta.3 → 1.0.0.beta.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +9 -2
- data/Rakefile +56 -14
- data/lib/sass_archive_importer/monkey_patches.rb +26 -0
- data/lib/sass_archive_importer/version.rb +1 -1
- data/test/class_loader_importer_test.java +34 -5
- metadata +2 -3
- data/lib/sass/archive_importer.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 816b8dcd28b03d13a217371a7e9c016cf072627d
|
4
|
+
data.tar.gz: 60f28e295c57b891ee3285b54deb3db00e76bf3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27abeb2e298592b7deb55779567e5388afaf6c87ac557fdf7597c5b8b27625bd08ff391c29066b106800254a55a8e7d452fe6d5bb714c22f8aac5b4ea541e7de
|
7
|
+
data.tar.gz: a0c7cd625589e230babed7a9294a41f3df91726bb3b50532fde8d874b3d89113edb7398c0de0a051deb828fe8a863813e27d54b73fb54c53d83171a33932c9be
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,28 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sass-archive-importer (1.0.0.beta.
|
4
|
+
sass-archive-importer (1.0.0.beta.3)
|
5
5
|
rubyzip (~> 0.9.9)
|
6
6
|
sass (>= 3.1, < 3.4)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
+
chunky_png (1.3.0)
|
12
|
+
compass (0.12.5)
|
13
|
+
chunky_png (~> 1.2)
|
14
|
+
fssm (>= 0.2.7)
|
15
|
+
sass (~> 3.2.19)
|
16
|
+
fssm (0.2.10)
|
11
17
|
rake (10.2.2)
|
12
18
|
rubyzip (0.9.9)
|
13
|
-
sass (3.
|
19
|
+
sass (3.2.19)
|
14
20
|
|
15
21
|
PLATFORMS
|
16
22
|
java
|
17
23
|
ruby
|
18
24
|
|
19
25
|
DEPENDENCIES
|
26
|
+
compass (~> 0.12.5)
|
20
27
|
rake
|
21
28
|
sass-archive-importer!
|
data/Rakefile
CHANGED
@@ -23,15 +23,55 @@ task :test => [:java_test, :mri_test]
|
|
23
23
|
directory "test/fixtures/tmpjava"
|
24
24
|
directory "test/fixtures/tmpjava/org/sass/archive_importer"
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
class GemPackage < Struct.new(:name, :version, :location, :installable)
|
27
|
+
def gemspec_path
|
28
|
+
"test/fixtures/tmpjava/specifications/#{name}-#{version}.gemspec"
|
29
|
+
end
|
30
|
+
|
31
|
+
def gem_path
|
32
|
+
"#{location}/#{name}-#{version}.gem"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
gems_to_install = {
|
38
|
+
:fssm => GemPackage.new("fssm", "0.2.10", "test/fixtures", true),
|
39
|
+
:chunky_png => GemPackage.new("chunky_png", "1.3.0", "test/fixtures", true),
|
40
|
+
:compass => GemPackage.new("compass", "0.12.5", "test/fixtures", true),
|
41
|
+
:sass => GemPackage.new("sass", "3.2.19", "test/fixtures", true),
|
42
|
+
:rubyzip => GemPackage.new("rubyzip", "0.9.9", "test/fixtures", true),
|
43
|
+
:"sass-archive-importer" => GemPackage.new("sass-archive-importer", SassArchiveImporter::VERSION, "pkg", false),
|
44
|
+
}
|
45
|
+
|
46
|
+
gems_to_install.values.each do |gem_definition|
|
47
|
+
directory File.dirname(gem_definition.gemspec_path)
|
48
|
+
directory File.dirname(gem_definition.gem_path)
|
49
|
+
if gem_definition.installable
|
50
|
+
file gem_definition.gem_path => File.dirname(gem_definition.gem_path) do
|
51
|
+
Dir.chdir File.dirname(gem_definition.gem_path) do
|
52
|
+
execute_or_fail("gem fetch #{gem_definition.name} --version #{gem_definition.version}",
|
53
|
+
"Download #{gem_definition.name} version #{gem_definition.version}")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
file gem_definition.gemspec_path => [
|
58
|
+
gem_definition.gem_path,
|
59
|
+
File.dirname(gem_definition.gemspec_path)
|
60
|
+
] do
|
61
|
+
cwd = Dir.getwd
|
62
|
+
Dir.chdir ".." do
|
63
|
+
# this is done withing a chdir because the Gemfile in this folder was causing issues
|
64
|
+
execute_or_fail("gem install sass-archive-importer/#{gem_definition.gem_path} -i #{cwd}/test/fixtures/tmpjava --no-rdoc --no-ri",
|
65
|
+
"Gem install of #{gem_definition.name}")
|
66
|
+
end
|
32
67
|
end
|
33
68
|
end
|
34
69
|
|
70
|
+
file "pkg/sass-archive-importer-#{SassArchiveImporter::VERSION}.gem" do
|
71
|
+
Rake::Task["build"].invoke
|
72
|
+
end
|
73
|
+
|
74
|
+
|
35
75
|
file "test/fixtures/tmpjava/org/sass/archive_importer/ClassLoaderImporter.rb" =>
|
36
76
|
%w(test/fixtures/tmpjava/org/sass/archive_importer
|
37
77
|
lib/org/sass/archive_importer/ClassLoaderImporter.rb) do
|
@@ -60,8 +100,8 @@ end
|
|
60
100
|
|
61
101
|
desc "Build the java test jar"
|
62
102
|
file "test/fixtures/class_loader_importer_test.jar" =>
|
63
|
-
%
|
64
|
-
|
103
|
+
%W(test/fixtures/tmpjava/org/sass/archive_importer/ClassLoaderImporter.rb) +
|
104
|
+
gems_to_install.values.map{|g| g.gemspec_path} +
|
65
105
|
FileList["test/fixtures/zipped_files/**/*"] +
|
66
106
|
FileList["test/class_loader_importer_test.java"] +
|
67
107
|
[:copy_sass_artifacts] do
|
@@ -70,13 +110,15 @@ file "test/fixtures/class_loader_importer_test.jar" =>
|
|
70
110
|
"Java compilation")
|
71
111
|
execute_or_fail("jar -cf test/fixtures/class_loader_importer_test.jar -C test/fixtures/tmpjava .",
|
72
112
|
"Jar creation")
|
73
|
-
|
113
|
+
end
|
114
|
+
|
74
115
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
116
|
+
desc "Run java tests"
|
117
|
+
task :java_test => %W(test/fixtures/class_loader_importer_test.jar
|
118
|
+
pkg/sass-archive-importer-#{SassArchiveImporter::VERSION}.gem) do
|
119
|
+
execute_or_fail("java -cp test/fixtures/jruby-complete-1.6.5.jar:test/fixtures/class_loader_importer_test.jar ClassLoaderImporterTest",
|
120
|
+
"Java test")
|
121
|
+
end
|
80
122
|
|
81
123
|
Rake::TestTask.new(:mri_test) do |t|
|
82
124
|
t.libs << 'lib'
|
@@ -29,3 +29,29 @@ class Sass::Engine
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
begin
|
33
|
+
require 'compass'
|
34
|
+
module Compass
|
35
|
+
module Configuration
|
36
|
+
# The adapters module provides methods that make configuration data from a compass project
|
37
|
+
# adapt to various consumers of configuration data
|
38
|
+
module Adapters
|
39
|
+
alias sass_load_paths_without_archive_importer sass_load_paths
|
40
|
+
def sass_load_paths
|
41
|
+
sass_load_paths_without_archive_importer.map! do |importer|
|
42
|
+
if importer.respond_to?(:root) && importer.root =~ /^(?:file:)?(.*\.jar)!\/(.*)$/
|
43
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
44
|
+
require 'org/sass/archive_importer/ClassLoaderImporter'
|
45
|
+
ClassLoaderImporter.new($2)
|
46
|
+
else
|
47
|
+
SassArchiveImporter::Importer.new($1, $2)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
rescue LoadError
|
56
|
+
# Compass isn't present
|
57
|
+
end
|
@@ -2,10 +2,6 @@
|
|
2
2
|
import org.jruby.Ruby;
|
3
3
|
|
4
4
|
class ClassLoaderImporterTest {
|
5
|
-
//public void testJavaInstantiation() {
|
6
|
-
//ClassLoaderImporter importer = new ClassLoaderImporter(null);
|
7
|
-
//}
|
8
|
-
|
9
5
|
public void testClassLoaderImporter() {
|
10
6
|
final Ruby runtime = Ruby.newInstance();
|
11
7
|
String script =
|
@@ -155,12 +151,45 @@ class ClassLoaderImporterTest {
|
|
155
151
|
runtime.evalScriptlet(script);
|
156
152
|
}
|
157
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
|
+
|
158
187
|
public static void main(String [] args) {
|
159
188
|
ClassLoaderImporterTest test = new ClassLoaderImporterTest();
|
160
|
-
//test.testJavaInstantiation();
|
161
189
|
test.testClassLoaderImporter();
|
162
190
|
test.testClassLoaderImporterNestedContext();
|
163
191
|
test.testClassLoaderImporterMissingImport();
|
192
|
+
test.testClassLoaderImporterWithCompass();
|
164
193
|
System.out.println("ALL Java Tests Passed");
|
165
194
|
}
|
166
195
|
}
|
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.4
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -62,7 +62,6 @@ files:
|
|
62
62
|
- Rakefile
|
63
63
|
- lib/org/sass/archive_importer/ClassLoaderImporter.rb
|
64
64
|
- lib/sass-archive-importer.rb
|
65
|
-
- lib/sass/archive_importer.rb
|
66
65
|
- lib/sass_archive_importer.rb
|
67
66
|
- lib/sass_archive_importer/importer.rb
|
68
67
|
- lib/sass_archive_importer/monkey_patches.rb
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# Copyright 2013 LinkedIn Corp. All rights reserved.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
module Sass
|
16
|
-
module ArchiveImporter
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
require 'sass/archive_importer/importer';
|
21
|
-
require 'sass/archive_importer/monkey_patches';
|