yarrow 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Mzg5NmM3ZGE3ZDk5N2Q1Mjc5NTNiMDg4M2YyYmY5NDk5MThkMzYxZQ==
4
+ ZDcyYTlkMDhjYTY3YjYzMGE3MzgwODM1MGNhY2Y2ZWFjNTdlY2Y4MQ==
5
5
  data.tar.gz: !binary |-
6
- YjA1ODIyMWU4Yzg2NjljNDY4MjEyODIzNGZhNmY1YjBjZTI4ZmNlMQ==
6
+ NjQ5MzE1N2RhMTkwNmU1YTQwMDhiOWVhM2FhZjNiYmRkZGQ0MDY5OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTk2NDU5ZDE1MDI4NWU2YjI2NmRjNzcwNDE0MjhiNGJhYjViNTMyMjk1YjRl
10
- MzkxZjVhMjc2ZGE5ODE2OTNiM2UxNWFmN2E4NDViMmI2ZDRmY2M2MGQ3NWMy
11
- YTZkNDg1NGU4NjdmNDZkZmE5NWZhYjg5NzU2OGVmZWM1MTU5ZTY=
9
+ MmZhNDRjMWMyOTlhZmNiZDFhZGM5NzBlMGJjYmQ5NWNmN2QzZTk5NjA5NzM1
10
+ OTY4NDU3NjBkNGY3M2RlNTdjNmU3MzIyZjQ1YjU5MDkxZjIzMTYzZGFiZDU5
11
+ ZTJlZGMyNjkxYjJjYWJhYjQ5NWE0Zjg3MDI4YTYwMGM1M2U5MjA=
12
12
  data.tar.gz: !binary |-
13
- ZWU0MWY0OTE1ZDA5OGZjZWI1ODgyMjExN2VkZDU5ZmQxMmIxZWM0MTA3MGJh
14
- Zjc4YzgxMWI0NTgyYmY3OTg3MGI3MTVlNzY4ZjA1YjExNjgwN2FkN2MzZTQy
15
- ZTBhOTkxMWQ4NDQ2OWJhZjg0ZTIyOTc4ODVmZDE3YWNjNzk5OTk=
13
+ YmVlZTdjNzRiZWQ5NjlmNzc2MmViNGMwYTY1MTM4MDViZDNkYTU3ZWI4NjMx
14
+ ZDE3Yjk5MzcxNDEyYzM5N2JjYjI2MTAyNGRlNDJiNjBjYmFjMDRiZjMyZjZi
15
+ ZTM1NGQzMDBjOWYyNTBkYzU0ZmExOWUxYTI2ZDgwOWUwOWI5M2Q=
@@ -9,11 +9,24 @@ module Yarrow
9
9
  attr_reader :input_dir, :output_dir, :bundles, :assets
10
10
 
11
11
  # TODO: handle configuration
12
- def initialize(options = {})
13
- @input_dir = Dir.pwd + "/assets"
14
- @output_dir = Dir.pwd + "/web/ui"
12
+ def initialize(options)
13
+ raise "Missing asset configuration" unless options[:assets]
14
+
15
+ @input_dir = options[:assets][:input_dir] || default_input_dir
16
+ @output_dir = options[:assets][:input_dir] || default_output_dir
15
17
 
16
- raise "#{@input_dir} is not a directory" unless File.directory? @input_dir
18
+ case options[:assets][:append_paths]
19
+ when Array
20
+ @append_paths = options[:assets][:append_paths]
21
+ when "*"
22
+ @append_paths = Dir[@input_dir + "/*"].select do |path|
23
+ File.directory?(path)
24
+ end.map do |path|
25
+ File.basename(path)
26
+ end
27
+ else
28
+ @append_paths = []
29
+ end
17
30
  end
18
31
 
19
32
  def compile(assets=[])
@@ -29,17 +42,26 @@ module Yarrow
29
42
 
30
43
  private
31
44
 
45
+ def default_input_dir
46
+ Dir.pwd + "/assets"
47
+ end
48
+
49
+ def default_output_dir
50
+ @output_dir = Dir.pwd + "/web/ui"
51
+ end
52
+
32
53
  def manifest_file_path
33
54
  "#{@output_dir}/manifest.json"
34
55
  end
35
56
 
36
57
  def create_environment
37
58
  environment = Sprockets::Environment.new(@input_dir)
38
- # configure javascript
39
- environment.append_path 'js'
59
+
60
+ @append_paths.each do |path|
61
+ environment.append_path path
62
+ end
40
63
 
41
- # configure stylesheets
42
- environment.append_path 'css'
64
+ # configure css compressor
43
65
  environment.css_compressor = :scss
44
66
 
45
67
  environment
@@ -1,4 +1,4 @@
1
1
  module Yarrow
2
2
  APP_NAME = "Yarrow"
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yarrow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickerby