itamae 1.0.0.beta38 → 1.0.0.beta39

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: 8b3714f298036bb34c563fd1d7d95b594af288db
4
- data.tar.gz: 416f02e423816f68ce22d45ba191af0096015690
3
+ metadata.gz: d3a4021dcb9b9977066b6717638e220e25f52ac2
4
+ data.tar.gz: bdce6341d1b945d3a0d46a4e48cde128cc2966d4
5
5
  SHA512:
6
- metadata.gz: eb55a96ab5f7971118cc69d94f95cc795993783f671cd834a0282633410d4946bd0694c4748a837c5584caf37fb5dc3c495eb4e057c05706ce4cabb39a91b1de
7
- data.tar.gz: eeec88c4ccdf6ef0c118b34e2204e05de07e15b17ecd03fdfb2272e47424235c45e78ef2d41016bb64fb52ccfd01e3e3c7780b87c3a7bc4ee3ba30b661a2c85b
6
+ metadata.gz: fc7e7781f0e9b88d3b389ac2ea4b458fe7ac0d84256c5fbf814d09a53758ff987eba395ba7c2f6fd44903a4ced8c356704f0a630dc0cd0d59b348286ef724924
7
+ data.tar.gz: 048e9fd161e15223462c0b33963939ff01c82ea218cd3feb347d42d66797d68be379e475116a1e0e5cfad846f616228061ec09beacccf965b4d2d0967ac76573
@@ -52,6 +52,13 @@ module Itamae
52
52
  @children = RecipeChildren.new
53
53
  end
54
54
 
55
+ def respond_to_missing?(method, include_private = false)
56
+ Resource.get_resource_class(method)
57
+ true
58
+ rescue NameError
59
+ false
60
+ end
61
+
55
62
  def method_missing(method, name, &block)
56
63
  klass = Resource.get_resource_class(method)
57
64
  resource = klass.new(self, name, &block)
data/lib/itamae/logger.rb CHANGED
@@ -82,6 +82,10 @@ module Itamae
82
82
  end
83
83
  end
84
84
 
85
+ def respond_to_missing?(method, include_private = false)
86
+ logger.respond_to?(method)
87
+ end
88
+
85
89
  def method_missing(method, *args, &block)
86
90
  logger.public_send(method, *args, &block)
87
91
  end
data/lib/itamae/recipe.rb CHANGED
@@ -42,6 +42,13 @@ module Itamae
42
42
  instance_eval(File.read(@path), @path, 1)
43
43
  end
44
44
 
45
+ def respond_to_missing?(method, include_private = false)
46
+ Resource.get_resource_class(method)
47
+ true
48
+ rescue NameError
49
+ false
50
+ end
51
+
45
52
  def method_missing(method, name, &block)
46
53
  klass = Resource.get_resource_class(method)
47
54
  resource = klass.new(self, name, &block)
@@ -61,28 +61,7 @@ module Itamae
61
61
  end
62
62
 
63
63
  [specific_action || action].flatten.each do |action|
64
- @current_action = action
65
-
66
- Logger.info "action: #{action}"
67
-
68
- next if action == :nothing
69
-
70
- unless options[:dry_run]
71
- Logger.formatter.indent do
72
- Logger.debug "(in pre_action)"
73
- pre_action
74
-
75
- Logger.debug "(in set_current_attributes)"
76
- set_current_attributes
77
-
78
- Logger.debug "(in show_differences)"
79
- show_differences
80
-
81
- public_send("action_#{specific_action || action}".to_sym, options)
82
- end
83
- end
84
-
85
- @current_action = nil
64
+ run_action(action, options)
86
65
  end
87
66
 
88
67
  updated! if different?
@@ -112,6 +91,35 @@ module Itamae
112
91
 
113
92
  private
114
93
 
94
+ def run_action(action, options)
95
+ @current_action = action
96
+
97
+ Logger.info "action: #{action}"
98
+
99
+ return if action == :nothing
100
+
101
+ unless options[:dry_run]
102
+ Logger.formatter.indent do
103
+ Logger.debug "(in pre_action)"
104
+ pre_action
105
+
106
+ Logger.debug "(in set_current_attributes)"
107
+ set_current_attributes
108
+
109
+ Logger.debug "(in show_differences)"
110
+ show_differences
111
+
112
+ public_send("action_#{action}".to_sym, options)
113
+ end
114
+ end
115
+
116
+ @current_action = nil
117
+ end
118
+
119
+ def respond_to_missing?(method, include_private = false)
120
+ self.class.defined_attributes.has_key?(method) || super
121
+ end
122
+
115
123
  def method_missing(method, *args, &block)
116
124
  if self.class.defined_attributes[method]
117
125
  if args.size == 1
@@ -14,7 +14,7 @@ module Itamae
14
14
  def pre_action
15
15
  begin
16
16
  src = if content_file
17
- content_file
17
+ ::File.expand_path(content_file, ::File.dirname(@recipe.path))
18
18
  else
19
19
  f = Tempfile.open('itamae')
20
20
  f.write(content)
@@ -1 +1 @@
1
- 1.0.0.beta38
1
+ 1.0.0.beta39
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta38
4
+ version: 1.0.0.beta39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-29 00:00:00.000000000 Z
11
+ date: 2014-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor