sprockets-standalone 1.2.1 → 3.0.1

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: 60ade41ceef05668039165f4e4a111c34042ecfd
4
- data.tar.gz: 822458503c6efc7ac8a808fa01cd05bab5eb59f7
3
+ metadata.gz: d698d658b9b0eda1bf448470222e66084d68fd8c
4
+ data.tar.gz: c8ece875b6b8ff1c5db49557a20003ad33d8a63a
5
5
  SHA512:
6
- metadata.gz: b139f01c471e312425fe67bf084758ccb79e3890ccbbd190359990c8b430179fc6c5a17716b7b75b4d6dfefe0bb7eafbb28c823eccdc9998fb10e0562a471118
7
- data.tar.gz: fb4353cad9f233f02e8e4b8b69a5d19d2849af6af8449198fd4b9ea75d888c5cd224cc3729c5e910ea4d516250e307653d4a7a9da686a85a8c098d7b985e1850
6
+ metadata.gz: 29f7a59e76a66484f68e34861567962f3535e8dc9f94adf87d1eabf3f3d1fa0755b959e069e86e0e4530d5e063b1b803568868f75fd2921d021c8eb6321eeaca
7
+ data.tar.gz: 4cb8d6c8a534f778ce39b585e1c239cd8e165ab476c669c09a325992c5fe6185363419247a957fb9d70434ba600d114a6bd5fae1fce16be8450802b298fea7d8
data/README.md CHANGED
@@ -27,8 +27,7 @@ Sprockets::Standalone::RakeTask.new(:assets) do |task, sprockets|
27
27
  task.assets = %w(app.js app.css *.png *.svg *.woff)
28
28
  task.sources = %w(app/assets vendor/assets)
29
29
  task.output = File.expand_path('../assets', __FILE__)
30
- task.compress = false
31
- task.digest = false
30
+ task.manifest_name = 'manifest.json'
32
31
 
33
32
  sprockets.js_compressor = :uglifier
34
33
  sprockets.css_compressor = :sass
@@ -45,15 +44,14 @@ If you pass a block you can configure additional parameters:
45
44
 
46
45
  3) `task.output` - Define output directory. Default is `dist`.
47
46
 
48
- 4) `task.compress` - Set to true if you want pre-compressed assets. Default is false.
47
+ 4) `task.manifest_name` - Set the name to be used for the `manifest.json`
49
48
 
50
- 5) `task.digest` - Set to true if you want to include a file digest in the file name of generated assets. Default is false.
51
-
52
- 6) `task.environment` - Set custom sprockets environment.
49
+ 5) `task.environment` - Set custom sprockets environment.
53
50
 
54
51
  You can also customize the sprockets environment in the block to configure additional preprocessors or compressors.
55
52
 
56
53
  Note: Sprockets-standalone will always use a manifest.json even when asset digests are turned off. The manifest.json will be used to track changes. If you manually change the generated assets that will not be override when compiling assets unless there is also a change if the matching source files.
54
+
57
55
  You will need to remove generated assets (`rake assets:clobber`) to force regeneration of all assets.
58
56
 
59
57
  ## Contributing
@@ -25,21 +25,18 @@ module Sprockets
25
25
  # working directory.
26
26
  attr_accessor :output
27
27
 
28
- # If assets should include digest. Default is false.
29
- attr_accessor :digest
30
-
31
- # If assets should be compressed. Default is false.
32
- attr_accessor :compress
33
-
34
28
  # `Environment` instance used for finding assets.
35
29
  attr_accessor :environment
36
30
 
31
+ # Full path to the manifest json file
32
+ attr_accessor :manifest_name
33
+
37
34
  def index
38
35
  @index ||= environment.index if environment
39
36
  end
40
37
 
41
38
  def manifest
42
- @manifest ||= Sprockets::Standalone::Manifest.new index, File.join(output, "manifest.json")
39
+ @manifest ||= Sprockets::Manifest.new index, File.join(output, manifest_name)
43
40
  end
44
41
 
45
42
  def initialize(*args)
@@ -47,8 +44,7 @@ module Sprockets
47
44
  @assets = %w(application.js application.css *.png *.jpg *.gif)
48
45
  @sources = []
49
46
  @output = File.expand_path('dist', Dir.pwd)
50
- @digest = false
51
- @compress = false
47
+ @manifest_name = 'manifest.json'
52
48
 
53
49
  @environment = Sprockets::Environment.new(Dir.pwd) do |env|
54
50
  env.logger = Logger.new $stdout
@@ -59,9 +55,6 @@ module Sprockets
59
55
 
60
56
  Array(sources).each { |source| environment.append_path source }
61
57
 
62
- manifest.compress_assets = !!@compress
63
- manifest.digest_assets = !!@digest
64
-
65
58
  namespace @namespace do
66
59
  desc 'Compile assets'
67
60
  task :compile do
@@ -80,64 +73,5 @@ module Sprockets
80
73
  end
81
74
  end
82
75
  end
83
-
84
- class Manifest < ::Sprockets::Manifest
85
- attr_writer :digest_assets
86
- def digest_assets?
87
- !!@digest_assets
88
- end
89
-
90
- attr_writer :compress_assets
91
- def compress_assets?
92
- !!@compress_assets
93
- end
94
-
95
- def compile(*args)
96
- unless environment
97
- raise Error, "manifest requires environment for compilation"
98
- end
99
-
100
- paths = environment.each_logical_path(*args).to_a +
101
- args.flatten.select { |fn| Pathname.new(fn).absolute? if fn.is_a?(String)}
102
-
103
- if (missing_paths = (args.reject{|p| p.include?('*')} - paths)).any?
104
- missing_paths.each do |path|
105
- logger.warn "Asset #{path} not found."
106
- end
107
- end
108
-
109
- paths.each do |path|
110
- if asset = find_asset(path)
111
- compile_asset asset
112
- end
113
- end
114
- save
115
- paths
116
- end
117
-
118
- def compile_asset(asset)
119
- path = digest_assets? ? asset.digest_path : asset.logical_path
120
- target = File.join(dir, path)
121
-
122
- if files[path] && (digest = files[path]['digest'])
123
- if digest == asset.digest && File.exists?(target)
124
- logger.debug "Skipping #{target}, up-to-date"
125
- return
126
- end
127
- end
128
-
129
- files[path] = {
130
- 'logical_path' => asset.logical_path,
131
- 'mtime' => asset.mtime.iso8601,
132
- 'size' => asset.bytesize,
133
- 'digest' => asset.digest
134
- }
135
- assets[asset.logical_path] = path
136
-
137
- logger.info "Writing #{target}"
138
- asset.write_to target
139
- asset.write_to "#{target}.gz" if asset.is_a?(BundledAsset) && compress_assets?
140
- end
141
- end
142
76
  end
143
77
  end
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Standalone
3
- VERSION = "1.2.1"
3
+ VERSION = "3.0.1"
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "rake"
22
- spec.add_dependency "sprockets", "~> 2.0"
22
+ spec.add_dependency "sprockets", "~> 3.0"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.4"
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-standalone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-12 00:00:00.000000000 Z
11
+ date: 2018-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  requirements: []
86
86
  rubyforge_project:
87
- rubygems_version: 2.2.2
87
+ rubygems_version: 2.6.13
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: Rack task library for using Sprockets standalone.