yarrow 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OThlZmY1ZGZkMTFmYWE0MTEzYTc0YzRjZGM0YTdjOTI4ZDQ4ZDVmNg==
4
+ OWVjNGNlZTBhY2MyNzA4YjI0OTVjZjVkYzQwOTZjODNjMmEyNTI1Yg==
5
5
  data.tar.gz: !binary |-
6
- ODY2ZmYxYzIwNjMxZWU4ZWI3MDYxNjZkYWYzMmUwODNkMTViYWViZg==
6
+ MDdiZTJhM2MxY2E2MDQxMTQ5OTZkMzRjODkwOWQ1NGI2ZGIwNjU5MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmEwZTkwYWRiMTIxNDA1Zjk0MjA4MzcxOWE5MzZmNTRjNmY1MmM2MWY3Y2Vk
10
- MWU1ZmZhNWE3ZmVmNzliYWIzNjk3YzMyMGQyNjE5NDE1OTgxZTRhNDg0MzAy
11
- MzJlMWJlMmZlZjJjYjliYjk5MWUzNWEyODc2MjE1NmZjMmM0YjQ=
9
+ OGJjNTc4NjAwMzZhNmMzNTRkM2MzYTU2NmFlNGU4YTBiOThjN2FmMjYwYTgy
10
+ YjZiNmVjODdlMjFmY2E3MDM1MGI4MWJmYWQ4YmQ4MTkyZDhkMTE2YjZiNDEz
11
+ MmVlOTU0YjQxMTI3MThmYWNmZTQxODFkOTdjNjgzODM3NmEwZjk=
12
12
  data.tar.gz: !binary |-
13
- ZGYyYjNhMjM0ZDFhMDMzMDcxMDM3MTc3YzYzMGM4OTFlYWEwZTRhNjIzMzdm
14
- NmU0YTEzNjdiODM1YjlmNWQ2MTM3NzAzYThlYTgwZjZjNzg2MWE2ODczNTJm
15
- NTYzMWQ0OTVjZTZlMzM0YWQ1ZGNhZDU2ODY5MDI4ODgwMzk5NTI=
13
+ OTFjNDJiNjQzZWNkNmY1NTk4MjE0NjE0NDdiYjdmYjNhODBlYzhmZmMyNDAy
14
+ MzA4YWM1YTg5OTg2ZDk4OTljZGVjMTZlYzE2OWI3MzgzOTZmMzk4NTdhYjUy
15
+ ZjhkN2QxNTZhODA0M2EzODhhNzJiYjYzYjMwOGU2NTJlYjE4NTc=
@@ -11,32 +11,51 @@ module Yarrow
11
11
 
12
12
  # @param options [Hash, Hashie::Mash, Yarrow::Configuration]
13
13
  def initialize(options)
14
- raise 'Missing asset configuration' unless options[:assets]
15
14
 
16
- @input_dir = options[:assets][:input_dir] || default_input_dir
17
- @output_dir = options[:assets][:output_dir] || default_output_dir
15
+ @input_dir = options[:input_dir] || default_input_dir
16
+ @output_dir = options[:output_dir] || default_output_dir
18
17
 
19
- case options[:assets][:append_paths]
18
+ @append_paths = []
19
+
20
+ case options[:append_paths]
20
21
  when Array
21
- @append_paths = options[:assets][:append_paths]
22
+ @append_paths = options[:append_paths]
22
23
  when '*'
23
24
  @append_paths = Dir[@input_dir + '/*'].select do |path|
24
25
  File.directory?(path)
25
26
  end.map do |path|
26
27
  File.basename(path)
27
28
  end
28
- else
29
- @append_paths = []
29
+ when String
30
+ @append_paths << options[:append_paths]
30
31
  end
31
32
  end
32
33
 
33
- def compile(assets = [])
34
+ # Compiles an asset manifest and processed output files from the given input bundles.
35
+ # Also generates a manifest linking each output bundle to its given input name.
36
+ # @param bundles [Array<String>]
37
+ def compile(bundles = [])
34
38
  manifest = Sprockets::Manifest.new(environment, manifest_file_path)
35
- assets.each do |asset|
36
- manifest.compile(asset)
39
+ bundles.each do |bundle|
40
+ if bundle.include? '*'
41
+ Dir["#{@input_dir}/#{bundle}"].each do |asset|
42
+ manifest.compile(File.basename(asset))
43
+ end
44
+ else
45
+ manifest.compile(bundle)
46
+ end
47
+ end
48
+ end
49
+
50
+ # Copy the given files to the output path without processing or renaming.
51
+ # @param bundle [Array<String>]
52
+ def copy(bundles = [])
53
+ bundles.each do |bundle|
54
+ FileUtils.cp_r "#{@input_dir}/#{bundle}", "#{@output_dir}/#{bundle}"
37
55
  end
38
56
  end
39
57
 
58
+ # Access instance of the Sprockets environment.
40
59
  def environment
41
60
  @environment ||= create_environment
42
61
  end
@@ -62,9 +81,6 @@ module Yarrow
62
81
  environment.append_path path
63
82
  end
64
83
 
65
- # configure css compressor
66
- environment.css_compressor = :scss
67
-
68
84
  environment
69
85
  end
70
86
 
@@ -1,4 +1,4 @@
1
1
  module Yarrow
2
2
  APP_NAME = "Yarrow"
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yarrow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickerby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-03 00:00:00.000000000 Z
11
+ date: 2014-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie