yarrow 0.2.6 → 0.2.7

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
- ZjViODEzNDFmNDI5OTgwNjNkODY1YWExMDE4ZTM4YWYzNDQ3ZDJiOA==
4
+ YjkyNjg4NmRiYzY3OTc4YTI2ZTMxYjhjZjZjMDFkMDY0YmFhMDlhYQ==
5
5
  data.tar.gz: !binary |-
6
- ODYwNjY4Y2QxMDYzZjdjZDEwOWMzOWY1ZjdhZGU0ZDBjZThlOWNhMg==
6
+ Yjc1NzE0YzRiYzQzNjk5OTFiNjQ2MzQ3ZWU2ZWQzODc2MWI3NGRkNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OGI4OWIxZTNjMDc1NWM4NGVlMGIwNGJiYzQwZWI3YTNhOTYxMWY0YWFjMjQy
10
- MTlmODlhYmU3YTA5ZjJkNWQ3NTdjYjYzYmI3ZTNjMDc1ZjU3NDA3MDQ5NjY4
11
- MzBmZmJlZTNmOTk4N2NmMzE1YjZkMDA4NDQyNDM2YmUxZTU5YzQ=
9
+ OGE5NTdmNDViN2MwY2JmMGQyY2Y5ZGM2OTAyNmNmNTZjZjg1Y2E1Mjg5OGM5
10
+ YWVlZDUzOTg4ZDM2OTM0MmM3Y2VjMDA5YTI4MmNkYmVlYmNhNTEyNDg2MmI5
11
+ NThkZDM4YjQ4NTk4OTVhMzg4Yjk4OTVjOTJmODRjMzVlNmU3ZmY=
12
12
  data.tar.gz: !binary |-
13
- NTRhZWNjNzcyNjcyM2M4YzkyZmQyNjMxYmMwNDVkMGVlNzYwYzcxMTVkOGYw
14
- ZDBiOWY1Mjg4NzNiMjJkMTM2MWE0YzRiYzI4NDIzMzkyMDEzMzJkZGE4YWZl
15
- NjEwNGYxN2RhMTQyM2UxZWU5ZTI3NjVkMzA2ODVlYTRlNzA5OGE=
13
+ ZjVmZGY3ZDBiOGE5MjI5YmFhOWZiZWViNzM3MjhmZGM3NDAwYjAwMGJlNmU3
14
+ NGM3NDA1YTliNDVhNzg5MjRhNzk1OTlmZjY1ODJmZTA3MTM0ZWU0OTU3ZDBk
15
+ YzhiOTZiMzA5NWMwNzdjNDcyZjIwNWQ1ZjgxMjFjZTZiMzAzNGQ=
@@ -1,22 +1,81 @@
1
1
  module Yarrow
2
+
3
+ ##
4
+ # Hash-like object containing runtime configuration values. Can be accessed indifferently
5
+ # via object style lookups or symbol keys.
6
+ #
2
7
  class Configuration < Hashie::Mash
3
8
 
4
9
  class << self
5
10
 
11
+ ##
12
+ # Provides access to the registered global configuration.
13
+ #
14
+ # If no configuration is registered, returns a blank object.
15
+ #
16
+ # @return [Yarrow::Configuration]
17
+ #
6
18
  def instance
7
- @@configuration || Hashie::Mash.new
19
+ @@configuration ||= self.new
8
20
  end
9
21
 
22
+ ##
23
+ # Loads and registers a global configuration object.
24
+ #
25
+ # @param [String] path to YAML file
26
+ #
10
27
  def register(file)
11
28
  @@configuration = self.load(file)
12
29
  end
13
30
 
31
+ ##
32
+ # Clears the global configuration to the empty default.
33
+ #
34
+ def clear
35
+ @@configuration = self.new
36
+ end
37
+
38
+
39
+ ##
40
+ # Merges the given configuration or hash-like object with the
41
+ # registered global configuration.
42
+ #
43
+ # @param [Hash, Hashie::Mash, Yarrow::Configuration]
44
+ #
45
+ def merge(config)
46
+ instance.deep_merge!(config)
47
+ end
48
+
49
+ ##
50
+ # Loads a configuration object from the given YAML file.
51
+ #
52
+ # @param [String] path to YAML file
53
+ #
54
+ # @return [Yarrow::Configuration]
55
+ #
14
56
  def load(file)
15
- configuration = self.new(YAML.load_file(file))
16
- configuration
57
+ self.new(YAML.load_file(file))
17
58
  end
18
59
 
19
60
  end
20
61
 
21
62
  end
63
+
64
+ ##
65
+ # Embeds global configuration access in a client object.
66
+ #
67
+ module Configurable
68
+
69
+ ##
70
+ # Provides access to the registered global configuration. This can
71
+ # be overriden by subclasses to customize behaviour (eg: in test cases).
72
+ #
73
+ # @return [Yarrow::Configuration]
74
+ #
75
+ def config
76
+ Configuration.instance
77
+ end
78
+
79
+ end
80
+
22
81
  end
@@ -2,6 +2,10 @@ module Yarrow
2
2
  module HTML
3
3
  module AssetTags
4
4
 
5
+ def config
6
+ Yarrow::Configuration.instance
7
+ end
8
+
5
9
  # TODO: make sprockets manifest optional/pluggable
6
10
  def manifest
7
11
  Yarrow::Assets::Manifest.new(config || {})
@@ -1,4 +1,4 @@
1
1
  module Yarrow
2
2
  APP_NAME = "Yarrow"
3
- VERSION = "0.2.6"
3
+ VERSION = "0.2.7"
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.6
4
+ version: 0.2.7
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-12-28 00:00:00.000000000 Z
11
+ date: 2014-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: coveralls
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: Yarrow is a tool for generating well structured documentation from a
112
126
  variety of input sources.
113
127
  email: me@maetl.net