automateit 0.71031.2 → 0.71101

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,9 @@
1
+ 0.71101:
2
+ Date: Thu, 01 Nov 2007 17:07:51 -0700
3
+ Desc:
4
+ - (%) Fixed bug in TagManager#tagged? when checking tag names containing dashes ("-"), refactored to improve tag tokenizing rules, added test. Thank you, David Brewer.
5
+ - Fixed bug in TemplateManager#render when rendering templates to strings, added tests. Thank you for the report, David Brewer.
6
+
1
7
  0.71031.2:
2
8
  Date: Wed, 31 Oct 2007 23:48:41 -0700
3
9
  Desc:
data/Rakefile CHANGED
@@ -15,7 +15,6 @@ def automateit
15
15
  end
16
16
 
17
17
  # Run a hoe +task+.
18
- #
19
18
  def hoe(task)
20
19
  # XXX Hoe provides many tasks I don't need, don't like the implementation of,
21
20
  # or don't like their names. I'd use Rake's 'import' and 'invoke' but the Hoe
@@ -180,6 +179,7 @@ end
180
179
  task :publish do
181
180
  automateit
182
181
  hoe("release VERSION=#{AutomateIt::VERSION}")
182
+ Rake::Task[:after].invoke
183
183
  end
184
184
 
185
185
  #---[ Install and uninstall ]-------------------------------------------
data/TODO.txt CHANGED
@@ -5,6 +5,7 @@ KEY: Important? Urgent? Easy? 1=yes, 0=no
5
5
  BUGS
6
6
  - does service_manager.start_and_enable work as expected?
7
7
 
8
+ 111 PackageManager -- Improve PEAR spec by having it check files with and without channel URL
8
9
  111 aissh or aion -- Write command for running stuff against servers with ssh, e.g., "aissh rails_servers ls", which is basically a wrapper over "for t in aitag -w rails_servers; do echo $t; ssh $t "ls"; done"
9
10
  111 Shell -- Write #su(user, *command) as a wrapper around #sh
10
11
  101 Shell -- Expand glob patterns, e.g. chown_R(500, 500, "*")
@@ -1,7 +1,7 @@
1
1
  # See AutomateIt::Interpreter for usage information.
2
2
  module AutomateIt # :nodoc:
3
3
  # AutomateIt version
4
- VERSION=Gem::Version.new("0.71031.2")
4
+ VERSION=Gem::Version.new("0.71101")
5
5
 
6
6
  # Instantiates a new Interpreter. See documentation for
7
7
  # Interpreter#setup.
@@ -50,15 +50,19 @@ class AutomateIt::TagManager::Struct < AutomateIt::TagManager::BaseDriver
50
50
  return hosts.select{|hostname| tagged?(query, hostname)}
51
51
  end
52
52
 
53
+ TAG_NEGATION = %r{!?}
54
+ TAG_WORD = %r{[\w\.\-]+}
55
+ TAG_TOKENIZER = %r{\!|\(|\)|\&{1,2}|\|{1,2}|#{TAG_NEGATION}#{TAG_WORD}}
56
+
53
57
  # See TagManager#tagged?
54
58
  def tagged?(query, hostname=nil)
55
59
  query = query.to_s
56
60
  selected_tags = hostname ? tags_for(hostname) : tags
57
- # XXX This tokenization process discards unknown characters, which may hide errors in the query
58
- tokens = query.scan(%r{\!|\(|\)|\&+|\|+|!?[\.\w]+})
61
+ # XXX Tokenizer discards unknown characters, which may hide errors in the query
62
+ tokens = query.scan(TAG_TOKENIZER)
59
63
  if tokens.size > 1
60
64
  booleans = tokens.map do |token|
61
- if matches = token.match(/^(!?)([\.\w]+)$/)
65
+ if matches = token.match(/^(#{TAG_NEGATION})(#{TAG_WORD})$/)
62
66
  selected_tags.include?(matches[2]) && matches[1].empty?
63
67
  else
64
68
  token
@@ -18,7 +18,7 @@ class AutomateIt::TemplateManager::BaseDriver < AutomateIt::Plugin::Driver
18
18
 
19
19
  #.......................................................................
20
20
 
21
- protected
21
+ protected
22
22
 
23
23
  # Return Array of +dependencies+ newer than +filename+. Will be empty if
24
24
  # +filename+ is newer than all of the +dependencies+.
@@ -92,12 +92,11 @@ class AutomateIt::TemplateManager::BaseDriver < AutomateIt::Plugin::Driver
92
92
 
93
93
  raise ArgumentError.new("No source specified with :file or :text") if not source_filename and not source_text
94
94
  raise Errno::ENOENT.new(source_filename) if writing? and source_filename and not _exists?(source_filename)
95
- raise ArgumentError.new("No target specified with :to") if not target_filename
96
95
 
97
96
  begin
98
97
  # source_filename, target_filename, opts={}
99
98
  opts[:check] ||= @default_check
100
- target_exists = _exists?(target_filename)
99
+ target_exists = target_filename && _exists?(target_filename)
101
100
  updates = []
102
101
 
103
102
  unless opts[:force]
@@ -167,8 +166,8 @@ class AutomateIt::TemplateManager::BaseDriver < AutomateIt::Plugin::Driver
167
166
  end
168
167
 
169
168
  _backup(target_filename) if target_exists and opts[:backup]
170
- result = _write(target_filename, output)
171
- return result
169
+
170
+ return(target_filename ? _write(target_filename, output) : output)
172
171
  ensure
173
172
  if opts[:mode] or opts[:user] or opts[:group]
174
173
  interpreter.chperm(target_filename, :mode => opts[:mode], :user => opts[:user], :group => opts[:group])
@@ -96,6 +96,16 @@ describe "AutomateIt::TagManager", :shared => true do
96
96
  @a.tagged?("magic").should be_true
97
97
  end
98
98
 
99
+ it "should find tags with dashes in the name" do
100
+ tag_with_dash = "pawafuru-mirakuru"
101
+ tag_without_dash = "wandafuru"
102
+
103
+ @a.tags << tag_with_dash << tag_without_dash
104
+
105
+ @a.tagged?(tag_with_dash).should be_true
106
+ @a.tagged?(tag_without_dash).should be_true
107
+ end
108
+
99
109
  it "should find tags for a host using an array" do
100
110
  @a.tags_for(["kurou"]).should include("apache_servers")
101
111
  end
@@ -6,6 +6,7 @@ describe "AutomateIt::TemplateManager::ERB" do
6
6
  @m = @a.template_manager
7
7
  @d = @m[:erb]
8
8
 
9
+ @content = "my template content"
9
10
  @source = "source_for_template"
10
11
  @target = "target_for_template"
11
12
  end
@@ -17,14 +18,25 @@ describe "AutomateIt::TemplateManager::ERB" do
17
18
  end
18
19
  end
19
20
 
20
- it "should render a string template" do
21
+ it "should render a string template to a string" do
22
+ @a.render(:text => @content).should == @content
23
+ end
24
+
25
+ it "should render a file template to a string" do
26
+ @d.should_receive(:_exists?).once.with(@source).and_return(true)
27
+ @d.should_receive(:_read).once.with(@source).and_return(@content)
28
+
29
+ @a.render(:file => @source).should == @content
30
+ end
31
+
32
+ it "should render a string template to a file" do
21
33
  @d.should_receive(:_exists?).once.with(@target).and_return(false)
22
34
  @d.should_receive(:_write).once.with(@target, "my template content").and_return(true)
23
35
 
24
36
  @a.render(:text => "my template content", :to => @target).should be_true
25
37
  end
26
38
 
27
- it "should render a file template" do
39
+ it "should render a file template to a file" do
28
40
  @d.should_receive(:_exists?).once.with(@source).and_return(true)
29
41
  @d.should_receive(:_exists?).once.with(@target).and_return(false)
30
42
  @d.should_receive(:_read).once.with(@source).and_return("my template content")
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: automateit
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.71031.2
6
+ version: "0.71101"
7
7
  date: 2007-11-01 00:00:00 -07:00
8
8
  summary: AutomateIt is an open source tool for automating the setup and maintenance of servers, applications and their dependencies.
9
9
  require_paths:
metadata.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- W+�<f���� ��V?/��j�6���:e��S>Š�@�v�|�d���q�@h����u>?�{�[n��ڭ��9G~r�|�4e
2
- ]$�mS0����f8H0�!�pT�/�c��ۢ���m2����{A�����n;� ��nd�?�rl4���L~Wk�|+��$I޺�
3
- ��L%�b����ŋ�z��C���fw�RՎ��q�= ó����l��R-l��1Л9mR5vX�ې��_���"�{.
1
+ ���q��Nk���������W%{��`������$����$���,F�(~i��:�\i�r�� ˯�6Vog]4�Q&�
2
+ ��|1" �.y Р�U��l��Y��v�e@QFMr����?�eG!���n������_�����s�Ô �*Ƶ�zf`>V�.H���������{Ɲ�:U Lї.�GԔq�A��~/�t��%���vb������w#Sd�N )��!5��ZG�R:�d