figleaf 0.2.4 → 0.2.5

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: 5869ef2c999e43091e838f2a33ce9459f794263b
4
- data.tar.gz: 6d17596302f7159732184840c7470f259723b7a9
3
+ metadata.gz: ebc37827cd68fb9d931fa327581d19acd47a2c02
4
+ data.tar.gz: 7f5c2050291f1ead028c57e98febeba9329fbe97
5
5
  SHA512:
6
- metadata.gz: 41b2fe47cd6eaf320643f34aa773649e0f23f6fa69e3a272132e0644d51edf19a4b37c9d7a3138c93df565518b3618584a28abeb99194aea6d239d4e05a312e9
7
- data.tar.gz: 26f5296732827c581a12c9c50603dfca4c8febb294052356cf5d513a5f263653b8ddb8134d2d70e2e5df80a3bf0a87e96599aa5da3203f6c64c5c63408af9e57
6
+ metadata.gz: 73bc054a55de88db693d019a84d816e5a6e2adf40d76b8fcbba5484a49d79e0afc36fddada3e9d72bd1ff6e2797844c193f765cdd482d7166656f8d424f8d34e
7
+ data.tar.gz: 452291366fe8950e631cf4a0c77c8da558e68291b904481e9df10b3abf797656d0b31b86640a5b95c280b9ea7882a45b300065c8cf39d9449ced1493ad9262b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.2.5 (2017/09/28)
4
+ Add support for `default` options
5
+
3
6
  ## 0.2.4 (2017/08/25)
4
7
  Relax active support version dependency
5
8
 
data/Gemfile CHANGED
@@ -12,10 +12,14 @@ group :development do
12
12
  gem "rb-fchange", require: false
13
13
  gem "rb-fsevent", require: false
14
14
  gem "rb-inotify", require: false
15
- gem "ruby_gntp"
16
- gem "terminal-notifier-guard"
17
- gem "guard-bundler"
18
- gem "guard-rspec"
15
+
16
+ gem 'guard-bundler', :require => false
17
+ gem 'guard-livereload', :require => false
18
+ gem 'guard-rspec', :require => false
19
+ gem 'libnotify', :require => false # linux notifications
20
+ gem 'ruby_gntp', :require => false # os x notifications
21
+ gem "terminal-notifier-guard", :require => false
22
+
19
23
  gem "pry"
20
24
  gem "pry-debugger", platforms: :ruby_19
21
25
  end
data/Guardfile CHANGED
@@ -1,10 +1,46 @@
1
- guard 'bundler' do
2
- watch('Gemfile')
3
- watch(/^.+\.gemspec/)
1
+ platform = RUBY_PLATFORM.match(/(linux|darwin)/)[0].to_sym
2
+ notification case platform
3
+ when :darwin
4
+ :gntp
5
+ when :linux
6
+ require 'libnotify'
7
+ :libnotify
8
+ end
9
+
10
+ guard :bundler do
11
+ require 'guard/bundler'
12
+ require 'guard/bundler/verify'
13
+ helper = Guard::Bundler::Verify.new
14
+
15
+ files = ['Gemfile']
16
+ files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
17
+
18
+ # Assume files are symlinked from somewhere
19
+ files.each { |file| watch(helper.real_path(file)) }
4
20
  end
5
21
 
6
- guard :rspec do
7
- watch(%r{^spec/.+_spec\.rb$})
8
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
9
- watch('spec/spec_helper.rb') { "spec" }
22
+ # Note: The cmd option is now required due to the increasing number of ways
23
+ # rspec may be run, below are examples of the most common uses.
24
+ # * bundler: 'bundle exec rspec'
25
+ # * bundler binstubs: 'bin/rspec'
26
+ # * spring: 'bin/rspec' (This will use spring if running and you have
27
+ # installed the spring binstubs per the docs)
28
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
29
+ # * 'just' rspec: 'rspec'
30
+
31
+ guard :rspec, cmd: "bundle exec rspec" do
32
+ require "guard/rspec/dsl"
33
+ dsl = Guard::RSpec::Dsl.new(self)
34
+
35
+ # Feel free to open issues for suggestions and improvements
36
+
37
+ # RSpec files
38
+ rspec = dsl.rspec
39
+ watch(rspec.spec_helper) { rspec.spec_dir }
40
+ watch(rspec.spec_support) { rspec.spec_dir }
41
+ watch(rspec.spec_files)
42
+
43
+ # Ruby files
44
+ ruby = dsl.ruby
45
+ dsl.watch_spec_files_for(ruby.lib_files)
10
46
  end
@@ -43,8 +43,11 @@ module Figleaf
43
43
  Dir.glob(file_pattern).each do |file|
44
44
  property_name = File.basename(file, '.yml')
45
45
  yaml_hash = load_file(file) or next
46
+ default = yaml_hash["default"]
46
47
  property = yaml_hash[env_to_load]
47
48
 
49
+ property = default.merge(property) if !default.nil?
50
+
48
51
  next if property.nil?
49
52
 
50
53
  if self.respond_to?(property_name) &&
@@ -1,3 +1,3 @@
1
1
  module Figleaf
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
@@ -109,5 +109,35 @@ describe Figleaf::Settings do
109
109
  expect(described_class.boolean).to eq(true) # remains unchanged
110
110
  end
111
111
  end
112
+
113
+ context "default is applied" do
114
+ before do
115
+ default = File.expand_path("../../fixtures/extra/default.yml", __FILE__)
116
+ described_class.load_settings(default, "test")
117
+ end
118
+
119
+ it "overrides values" do
120
+ expect(described_class.default.foo).to eq("overriden")
121
+ end
122
+
123
+ it "respects values set in default" do
124
+ expect(described_class.default.bar).to eq("baz")
125
+ end
126
+ end
127
+
128
+ context "using default as a YAML anchor is OK" do
129
+ before do
130
+ default = File.expand_path("../../fixtures/extra/default_anchor.yml", __FILE__)
131
+ described_class.load_settings(default, "test")
132
+ end
133
+
134
+ it "overrides values" do
135
+ expect(described_class.default.foo).to eq("overriden")
136
+ end
137
+
138
+ it "respects values set in default" do
139
+ expect(described_class.default.bar).to eq("baz")
140
+ end
141
+ end
112
142
  end
113
143
  end
@@ -0,0 +1,6 @@
1
+ default:
2
+ foo: bar
3
+ bar: baz
4
+
5
+ test:
6
+ foo: overriden
@@ -0,0 +1,7 @@
1
+ default: &default
2
+ foo: bar
3
+ bar: baz
4
+
5
+ test:
6
+ <<: *default
7
+ foo: overriden
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: figleaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan C. Müller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-25 00:00:00.000000000 Z
11
+ date: 2017-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -69,6 +69,8 @@ files:
69
69
  - spec/fixtures/errors/bad_file.yml
70
70
  - spec/fixtures/extra/array.yml
71
71
  - spec/fixtures/extra/boolean.yml
72
+ - spec/fixtures/extra/default.yml
73
+ - spec/fixtures/extra/default_anchor.yml
72
74
  - spec/fixtures/extra/service.yml
73
75
  - spec/fixtures/service.yml
74
76
  - spec/fixtures/string.yml
@@ -106,6 +108,8 @@ test_files:
106
108
  - spec/fixtures/errors/bad_file.yml
107
109
  - spec/fixtures/extra/array.yml
108
110
  - spec/fixtures/extra/boolean.yml
111
+ - spec/fixtures/extra/default.yml
112
+ - spec/fixtures/extra/default_anchor.yml
109
113
  - spec/fixtures/extra/service.yml
110
114
  - spec/fixtures/service.yml
111
115
  - spec/fixtures/string.yml