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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c0c4de769bbc705e7197d64484bba78ba8098e5
4
- data.tar.gz: e0c329a73043ac55bff9959d583cfe85622597da
3
+ metadata.gz: 816b8dcd28b03d13a217371a7e9c016cf072627d
4
+ data.tar.gz: 60f28e295c57b891ee3285b54deb3db00e76bf3e
5
5
  SHA512:
6
- metadata.gz: de5fc2052f4fec4c70ccf40084b01916f9148f129dea8dba3e64ec8906996a01e6cc4bd4d0870fc459d3c26ab9e555a96d03753ae4b3642f7e0585797921a749
7
- data.tar.gz: 80b8e6457dbdae079bbba09b83e6cea16d72935431768a3b3f40ac25ada2e049d89d6c5e710dff21bd177e81eec65319c699449dd11213c524c0b964c5af85d0
6
+ metadata.gz: 27abeb2e298592b7deb55779567e5388afaf6c87ac557fdf7597c5b8b27625bd08ff391c29066b106800254a55a8e7d452fe6d5bb714c22f8aac5b4ea541e7de
7
+ data.tar.gz: a0c7cd625589e230babed7a9294a41f3df91726bb3b50532fde8d874b3d89113edb7398c0de0a051deb828fe8a863813e27d54b73fb54c53d83171a33932c9be
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ source "http://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  gem 'rake'
6
+ gem 'compass', '~> 0.12.5'
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.2)
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.3.4)
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
- file "test/fixtures/tmpjava/specifications/sass-3.2.19.gemspec" => "test/fixtures/tmpjava" do
27
- cwd = Dir.getwd
28
- Dir.chdir ".." do
29
- # this is done withing a chdir because the Gemfile in this folder was causing issues
30
- execute_or_fail("gem install sass-archive-importer/test/fixtures/sass-3.2.19.gem -i #{cwd}/test/fixtures/tmpjava --no-rdoc --no-ri",
31
- "Sass 3.2 Install")
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
- %w(test/fixtures/tmpjava/org/sass/archive_importer/ClassLoaderImporter.rb
64
- test/fixtures/tmpjava/specifications/sass-3.2.19.gemspec) +
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
- end
113
+ end
114
+
74
115
 
75
- desc "Run java tests"
76
- task :java_test => "test/fixtures/class_loader_importer_test.jar" do
77
- execute_or_fail("java -cp test/fixtures/jruby-complete-1.6.5.jar:test/fixtures/class_loader_importer_test.jar ClassLoaderImporterTest",
78
- "Java test")
79
- end
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
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module SassArchiveImporter
16
- VERSION = "1.0.0.beta.3"
16
+ VERSION = "1.0.0.beta.4"
17
17
  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.3
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-14 00:00:00.000000000 Z
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';