fudge 0.1.2 → 0.2.0

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
- ZDlmNjU0MTU0NGYwMWRjYTZiNWM1MDUxNTg3YzYxNDI1MjEwMzdlMw==
4
+ NmI5MzM3MjIyMzhkMTA4ODc0N2M2Yzc4YWZhZWNiNmEyNzEzNjkwZg==
5
5
  data.tar.gz: !binary |-
6
- ZGM0NWEzYWEzZThkYThhODQ1NDBjNDY0MTRiY2Q5ZTBmYWM1MzkyNQ==
6
+ N2I3MmZiNDBkMDRiOWE2NjgyM2YxOGY5OThjZWNiNmYzOGM3NjkzMQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MGI2NjMwNjc4Mzk2OTEwZjkzZmRhNmU2NjhmYzQwZjZhMmVlNTMyMmQwNTNm
10
- YTg0N2NlYmViODE4MmZhNGFlY2I4MjNlYmE5YzRmNTQxZDdiOGFmZjQyOTEx
11
- YTc1MWUyYWE4OWI2M2I2NGQ2MzBlZWM4MzFmYTM3ZmM2YTIyYWI=
9
+ OTFhN2IyZWE2OTlmYzEzNmQ2NGEyMDVkZjQ1ZWI3ZjVhNDQ3Y2YyYzQ3YTQ0
10
+ NDBkOGE5MzcxOTgyMTNiMDJlMzBjMzlkMWUyNmU5MjE2OWFhN2Y5MGU3Yjc1
11
+ ZjY2NTk5NWU3ZTE4NDNhMDJhN2NiYzM1MzVjOWU3ZDE4MTQyZjE=
12
12
  data.tar.gz: !binary |-
13
- ZTg0Njk5ODRiNTU5NmNkNjM0MGVjNzQ1MWIwNzljMmQ0YmJkZjNhODY2OWEx
14
- ZTMyYmM0ODgxNDUyNzQ0ZTk1ZWUxMjVjNzMzNWIzM2FiYzQ4ODBiNTVmNDc0
15
- NDEzYmRjMTcwMmQxNGZiOTMyOGJkMDk4N2YzMjU1MjhlN2ZhZjg=
13
+ ZjAwYzMwYzk5NDIxYzU1MzNlYWJkNTIwMGFhY2Y5YTk5MmZmNmI2NWJhZDJh
14
+ ZDljNThjNGExYzE3OTNkZjgyMjg3MjNkZDAxMjdlMzNhMDRiYzNiMjUxYzhh
15
+ MjAxZjI1NjcwNjBlNDFiMDUwZDBlNmVhYzk4NWIwMzhkMWE2YjI=
@@ -13,14 +13,35 @@ module Fudge
13
13
  def run(options={})
14
14
  output = options[:output] || $stdout
15
15
  tasks.each do |t|
16
+ apply_directory_settings(t)
16
17
  output_message(t, output)
17
-
18
18
  return unless t.run(options)
19
19
  end
20
20
  end
21
21
 
22
22
  private
23
23
 
24
+ # load fudge settings for the specified task, by name
25
+ def apply_directory_settings(task)
26
+ task.options.merge!(task_options(task.class.name.to_s)) if defined? task.options
27
+ end
28
+
29
+ # Load the fudge_settings.yml for the current directory and return
30
+ # the options contained for the specified task
31
+ def task_options(task_name)
32
+ # are there settings for the specified task?
33
+ fudge_settings.fetch(task_name, {}).symbolize_keys!
34
+ end
35
+
36
+ # load fudge settings for the current directory
37
+ def fudge_settings
38
+ fpath = "#{Dir.pwd}/fudge_settings.yml"
39
+ if File.exist?(fpath)
40
+ return YAML.load_file(fpath)
41
+ end
42
+ {}
43
+ end
44
+
24
45
  def join_arguments(t)
25
46
  t.respond_to?(:args) && t.args ? t.args.join(', ') : ''
26
47
  end
@@ -1,4 +1,4 @@
1
1
  module Fudge
2
2
  # Define gem version
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
@@ -54,5 +54,18 @@ describe Fudge::Tasks::EachDirectory do
54
54
  task.pwds.sort.should == dirs.sort
55
55
  end
56
56
 
57
+ it "should load fudge_settings.yml in the right directory" do
58
+ ed2 = described_class.new ['spec/lib']
59
+ ed2.tasks << Fudge::Tasks::Shell.new('pwd')
60
+ ed2.run
61
+ ed2.tasks.first.options[:test].should == 'coverage'
62
+ end
63
+
64
+ it "should not load fudge_settings.yml in the wrong directory" do
65
+ ed2 = described_class.new ['spec/support']
66
+ ed2.tasks << Fudge::Tasks::Shell.new('pwd')
67
+ ed2.run
68
+ ed2.tasks.first.options.size.should == 0
69
+ end
57
70
  end
58
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fudge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sage One team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-28 00:00:00.000000000 Z
11
+ date: 2013-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor