compass-rails4 0.0.1 → 0.1.0

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: 7d5f44af415e24ca4e7e9910cc8029b39eb5c19a
4
- data.tar.gz: 72e11724e86e814f53244976d9840cada95cb2b9
3
+ metadata.gz: 6778afbb41a33d51640d074c78c33440c3fb4545
4
+ data.tar.gz: d9bbe1a401afef11c2119ee8d97e1682d35cbe96
5
5
  SHA512:
6
- metadata.gz: 18b9e656b02c272e77f1066e962460902ec1a64fd6860ec2f30356839aecde476264909e50e50755e4495e44f1e74e4ff7b086b0356b1d509a4cdcb85cc0a605
7
- data.tar.gz: 36b3100a75f3cfec7c00c5fd0bd894f8915fc1b4b342593a1dfefccb31afc087064532f5445588d54c0d4988c5fae79912d9a87e5ba4849b05028314fa49b40c
6
+ metadata.gz: 85cf11031a3532cb25403ae7c5bfe7748da0b8730c87b3404eff1222e6f863ab1d380320569f044805f8a1135643b5a4d4af9e29985ac93cf56380584865fa74
7
+ data.tar.gz: d76cafb6137238646f6d5bea19d1822670646a8decaea56727df3bfa4916567863fc3df97a34fc8e8e1f44d6c183dbd52edf3cc8eec15de511f0452953b9e881
data/Gemfile.lock CHANGED
@@ -1,28 +1,29 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- compass-rails4 (0.0.1)
4
+ compass-rails4 (0.1.0)
5
5
  compass (~> 0.13.alpha.12)
6
6
  railties (~> 4.0.0)
7
+ sprockets (<= 2.11.0)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
11
- actionpack (4.0.2)
12
- activesupport (= 4.0.2)
12
+ actionpack (4.0.3)
13
+ activesupport (= 4.0.3)
13
14
  builder (~> 3.1.0)
14
15
  erubis (~> 2.7.0)
15
16
  rack (~> 1.5.2)
16
17
  rack-test (~> 0.6.2)
17
- activesupport (4.0.2)
18
+ activesupport (4.0.3)
18
19
  i18n (~> 0.6, >= 0.6.4)
19
20
  minitest (~> 4.2)
20
21
  multi_json (~> 1.3)
21
22
  thread_safe (~> 0.1)
22
23
  tzinfo (~> 0.3.37)
23
- atomic (1.1.14)
24
+ atomic (1.1.15)
24
25
  builder (3.1.4)
25
- chunky_png (1.2.9)
26
+ chunky_png (1.3.0)
26
27
  compass (0.13.alpha.12)
27
28
  chunky_png (~> 1.2)
28
29
  json
@@ -30,6 +31,7 @@ GEM
30
31
  sass (~> 3.3.0.rc.1)
31
32
  erubis (2.7.0)
32
33
  ffi (1.9.3)
34
+ hike (1.2.3)
33
35
  i18n (0.6.9)
34
36
  json (1.8.1)
35
37
  listen (1.1.6)
@@ -37,26 +39,31 @@ GEM
37
39
  rb-inotify (>= 0.9)
38
40
  rb-kqueue (>= 0.2)
39
41
  minitest (4.7.5)
40
- multi_json (1.8.2)
42
+ multi_json (1.8.4)
41
43
  rack (1.5.2)
42
44
  rack-test (0.6.2)
43
45
  rack (>= 1.0)
44
- railties (4.0.2)
45
- actionpack (= 4.0.2)
46
- activesupport (= 4.0.2)
46
+ railties (4.0.3)
47
+ actionpack (= 4.0.3)
48
+ activesupport (= 4.0.3)
47
49
  rake (>= 0.8.7)
48
50
  thor (>= 0.18.1, < 2.0)
49
51
  rake (10.1.1)
50
52
  rb-fsevent (0.9.4)
51
53
  rb-inotify (0.9.3)
52
54
  ffi (>= 0.5.0)
53
- rb-kqueue (0.2.0)
55
+ rb-kqueue (0.2.2)
54
56
  ffi (>= 0.5.0)
55
- sass (3.3.0.rc.2)
56
- listen (~> 1.1.0)
57
+ sass (3.3.2)
58
+ sprockets (2.10.1)
59
+ hike (~> 1.2)
60
+ multi_json (~> 1.0)
61
+ rack (~> 1.0)
62
+ tilt (~> 1.1, != 1.3.0)
57
63
  thor (0.18.1)
58
- thread_safe (0.1.3)
59
- atomic
64
+ thread_safe (0.2.0)
65
+ atomic (>= 1.1.7, < 2)
66
+ tilt (1.4.1)
60
67
  tzinfo (0.3.38)
61
68
 
62
69
  PLATFORMS
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_dependency 'compass', '~> 0.13.alpha.12'
21
21
  spec.add_dependency 'railties', '~> 4.0.0'
22
+ spec.add_dependency 'sprockets', '<= 2.11.0'
22
23
 
23
24
  spec.add_development_dependency 'rake'
24
25
  end
@@ -1 +1,66 @@
1
- require "compass-rails4/configuration/default"
1
+ module CompassRails4
2
+ module Configuration
3
+ module AssetPipeline
4
+
5
+ def default_images_dir
6
+ File.join("app", "assets", "images")
7
+ end
8
+
9
+ def default_fonts_dir
10
+ File.join("app", "assets", "fonts")
11
+ end
12
+
13
+ def default_javascripts_dir
14
+ File.join("app", "assets", "javascripts")
15
+ end
16
+
17
+ def default_sass_dir
18
+ File.join("app", "assets", "stylesheets")
19
+ end
20
+
21
+ def default_css_dir
22
+ File.join('public', CompassRails4.prefix)
23
+ end
24
+
25
+ def default_http_path
26
+ File.join(CompassRails4.prefix)
27
+ end
28
+
29
+ def default_http_generated_images_path
30
+ default_http_path
31
+ end
32
+
33
+ def default_http_images_path
34
+ default_http_path
35
+ end
36
+
37
+ def default_http_javascripts_path
38
+ default_http_path
39
+ end
40
+
41
+ def default_http_fonts_path
42
+ default_http_path
43
+ end
44
+
45
+ def default_http_stylesheets_path
46
+ default_http_path
47
+ end
48
+
49
+ def default_preferred_syntax
50
+ CompassRails4.sass_config.preferred_syntax rescue nil
51
+ end
52
+
53
+ def default_sprite_load_path
54
+ CompassRails4.sprockets.paths
55
+ end
56
+
57
+ def default_project_path
58
+ project_path = CompassRails4.root
59
+ end
60
+
61
+ def default_environment
62
+ CompassRails4.env
63
+ end
64
+ end
65
+ end
66
+ end
@@ -10,7 +10,7 @@ module Sass::Script::Functions
10
10
 
11
11
  def cachebust_generated_images
12
12
  generated_images_path = CompassRails4.root.join(Compass.configuration.generated_images_dir).to_s
13
- sprockets_entries = CompassRails4.sprockets.send(:trail).index.instance_variable_get(:@entries)
13
+ sprockets_entries = CompassRails4.sprockets.send(:trail).instance_variable_get(:@entries)
14
14
  sprockets_entries.delete(generated_images_path) if sprockets_entries.has_key? generated_images_path
15
15
  end
16
16
 
@@ -33,6 +33,34 @@ class Rails::Railtie::Configuration
33
33
  end
34
34
  data.project_type = :rails # Forcing this makes sure all the rails defaults will be loaded.
35
35
 
36
+ data.on_sprite_saved do |filename|
37
+ if CompassRails4.rails_config.assets.digest && # if digesting is enabled
38
+ caller.grep(%r{/sprockets/rails/task.rb}).any? && #OMG HAX - check if we're being precompiled
39
+ Compass.configuration.generated_images_path[Compass.configuration.images_path.to_s] # if the generated images path is not in the assets images directory, we don't have to do these backflips
40
+
41
+ # Clear entries in Hike::Index for this sprite's directory.
42
+ # This makes sure the asset can be found by find_assets
43
+ CompassRails4.sprockets.send(:trail).instance_variable_get(:@entries).delete(File.dirname(filename))
44
+
45
+ pathname = Pathname.new(filename)
46
+ logical_path = pathname.relative_path_from(Pathname.new(Compass.configuration.images_path))
47
+ asset = CompassRails4.sprockets.find_asset(logical_path)
48
+ target = File.join(Rails.public_path, CompassRails4.prefix, asset.digest_path)
49
+
50
+ # Adds the asset to the manifest file.
51
+ manifest = ActionView::Base.assets_manifest
52
+ manifest.assets[logical_path.to_s] = asset.digest_path
53
+
54
+ # Adds the fingerprinted asset to the public directory
55
+ FileUtils.mkdir_p File.dirname(target)
56
+
57
+ logger = CompassRails4.sprockets.logger
58
+ logger.info("Writing #{target}") if logger
59
+
60
+ asset.write_to target
61
+ end
62
+ end
63
+
36
64
  Compass.add_configuration(:rails)
37
65
  Compass.add_configuration(data)
38
66
 
@@ -1,5 +1,5 @@
1
1
  module CompassRails4
2
2
  unless defined?(::CompassRails4::VERSION)
3
- VERSION = "0.0.1" #based on 1.1.3
3
+ VERSION = "0.1.0" #based on 1.1.7
4
4
  end
5
5
  end
@@ -75,11 +75,7 @@ module CompassRails4
75
75
  def configuration
76
76
  load_rails
77
77
  config = Compass::Configuration::Data.new('rails')
78
- config.extend(Configuration::Default)
79
- if asset_pipeline_enabled?
80
- require "compass-rails4/configuration/asset_pipeline"
81
- config.extend(Configuration::AssetPipeline)
82
- end
78
+ config.extend(Configuration::AssetPipeline)
83
79
  config
84
80
  end
85
81
 
@@ -139,13 +135,6 @@ module CompassRails4
139
135
  config
140
136
  end
141
137
 
142
- def asset_pipeline_enabled?
143
- return false unless rails_loaded?
144
- return false if !rails_config.respond_to?(:assets)
145
-
146
- rails_config.assets.enabled != false
147
- end
148
-
149
138
  private
150
139
 
151
140
  # sets the sass config value only if the corresponding compass-based setting
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compass-rails4
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Brazys
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-22 00:00:00.000000000 Z
11
+ date: 2014-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: compass
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: 4.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: sprockets
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - <=
46
+ - !ruby/object:Gem::Version
47
+ version: 2.11.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - <=
53
+ - !ruby/object:Gem::Version
54
+ version: 2.11.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,8 +81,6 @@ files:
67
81
  - compass-rails4.gemspec
68
82
  - lib/compass-rails4.rb
69
83
  - lib/compass-rails4/configuration.rb
70
- - lib/compass-rails4/configuration/asset_pipeline.rb
71
- - lib/compass-rails4/configuration/default.rb
72
84
  - lib/compass-rails4/patches.rb
73
85
  - lib/compass-rails4/patches/compass.rb
74
86
  - lib/compass-rails4/patches/sass_importer.rb
@@ -1,51 +0,0 @@
1
- module CompassRails4
2
- module Configuration
3
- module AssetPipeline
4
-
5
- def default_images_dir
6
- File.join("app", "assets", "images")
7
- end
8
-
9
- def default_fonts_dir
10
- File.join("app", "assets", "fonts")
11
- end
12
-
13
- def default_javascripts_dir
14
- File.join("app", "assets", "javascripts")
15
- end
16
-
17
- def default_css_dir
18
- File.join('public', CompassRails4.prefix)
19
- end
20
-
21
- def default_http_path
22
- File.join(CompassRails4.prefix)
23
- end
24
-
25
- def default_http_images_path
26
- "#{top_level.http_path}"
27
- end
28
-
29
- def default_http_javascripts_path
30
- "#{top_level.http_path}"
31
- end
32
-
33
- def default_http_fonts_path
34
- "#{top_level.http_path}"
35
- end
36
-
37
- def default_http_stylesheets_path
38
- "#{top_level.http_path}"
39
- end
40
-
41
- def default_preferred_syntax
42
- CompassRails4.sass_config.preferred_syntax rescue nil
43
- end
44
-
45
- def default_sprite_load_path
46
- CompassRails4.sprockets.paths
47
- end
48
-
49
- end
50
- end
51
- end
@@ -1,75 +0,0 @@
1
- module CompassRails4
2
- module Configuration
3
- module Default
4
-
5
- def project_type_without_default
6
- :rails
7
- end
8
-
9
- def default_sass_dir
10
- File.join("app", "assets", "stylesheets")
11
- end
12
-
13
- def default_css_dir
14
- File.join("public", "stylesheets")
15
- end
16
-
17
- def default_images_dir
18
- File.join("public", "images")
19
- end
20
-
21
- def default_fonts_dir
22
- File.join("public", "fonts")
23
- end
24
-
25
- def default_javascripts_dir
26
- File.join("public", "javascripts")
27
- end
28
-
29
- def default_http_images_path
30
- # Relies on the fact that this will be loaded after the "normal"
31
- # defaults, so that method_missing finds http_root_relative
32
- http_root_relative "images"
33
- end
34
-
35
- def default_http_generated_images_path
36
- # Relies on the fact that this will be loaded after the "normal"
37
- # defaults, so that method_missing finds http_root_relative
38
- http_root_relative "images"
39
- end
40
-
41
- def default_http_javascripts_path
42
- http_root_relative "javascripts"
43
- end
44
-
45
- def default_http_fonts_path
46
- http_root_relative "fonts"
47
- end
48
-
49
- def default_http_stylesheets_path
50
- http_root_relative "stylesheets"
51
- end
52
-
53
- def default_extensions_dir
54
- File.join("vendor", "plugins", "compass_extensions")
55
- end
56
-
57
- def default_cache_dir
58
- File.join("tmp", "sass-cache")
59
- end
60
-
61
- def default_project_path
62
- project_path = CompassRails4.root
63
- end
64
-
65
- def default_http_path
66
- "/" # XXX Where is/was this stored in the Rails config?
67
- end
68
-
69
- def default_environment
70
- CompassRails4.env
71
- end
72
-
73
- end
74
- end
75
- end