yggdrasil 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yggdrasil/help.rb +4 -2
- data/lib/yggdrasil/init.rb +1 -0
- data/lib/yggdrasil/version.rb +1 -1
- data/lib/yggdrasil_server/results.rb +5 -1
- data/spec/help_spec.rb +4 -2
- data/spec/results_spec.rb +28 -6
- metadata +4 -4
data/lib/yggdrasil/help.rb
CHANGED
@@ -131,8 +131,10 @@ usage: #@base_cmd init-server [OPTIONS...]
|
|
131
131
|
Valid options:
|
132
132
|
--port ARG : specify a TCP port number ARG
|
133
133
|
--repo ARG : URL of subversion repository
|
134
|
-
ARG
|
135
|
-
|
134
|
+
ARG can contain {HOST} or a {host}
|
135
|
+
{HOST} is replaced by client hostname with domain
|
136
|
+
{host} is replaced by client hostname without domain
|
137
|
+
e.g. svn://192.168.3.5/servers/{host}/ygg
|
136
138
|
--ro-username ARG : specify a username ARG for read only
|
137
139
|
--ro-password ARG : specify a password ARG for read only
|
138
140
|
|
data/lib/yggdrasil/init.rb
CHANGED
@@ -31,6 +31,7 @@ class Yggdrasil
|
|
31
31
|
@options[:repo].chomp!
|
32
32
|
@options[:repo].chomp!('/')
|
33
33
|
@options[:repo].gsub!(/\{HOST\}/, Socket.gethostname)
|
34
|
+
@options[:repo].gsub!(/\{host\}/, Socket.gethostname.split('.')[0])
|
34
35
|
if @options[:repo] == "private"
|
35
36
|
Dir.mkdir @config_dir, 0755 unless File.exist?(@config_dir)
|
36
37
|
repo_dir = "#@config_dir/private_repo"
|
data/lib/yggdrasil/version.rb
CHANGED
@@ -10,21 +10,25 @@ class YggdrasilServer
|
|
10
10
|
|
11
11
|
return unless File.exist?(@results_dir)
|
12
12
|
files = Dir.entries(@results_dir)
|
13
|
+
alert = false
|
13
14
|
files.each do |file|
|
14
15
|
next if /^\./ =~ file
|
15
16
|
absolute = "#@results_dir/#{file}"
|
16
17
|
if @options.has_key?(:limit)
|
17
18
|
stat = File.stat(absolute)
|
18
19
|
if stat.mtime < (Time.now - @options[:limit].to_i * 60)
|
19
|
-
|
20
|
+
alert = true
|
21
|
+
puts "######## #{file}: last check is too old: #{stat.mtime.to_s}"
|
20
22
|
next
|
21
23
|
end
|
22
24
|
end
|
23
25
|
buf = File.read("#@results_dir/#{file}")
|
24
26
|
if buf.gsub(/\s*\n/m, '') != ''
|
27
|
+
alert = true
|
25
28
|
puts "######## #{file} Mismatch:"
|
26
29
|
puts buf
|
27
30
|
end
|
28
31
|
end
|
32
|
+
exit 1 if alert
|
29
33
|
end
|
30
34
|
end
|
data/spec/help_spec.rb
CHANGED
@@ -306,8 +306,10 @@ usage: #{File.basename($0)} init-server [OPTIONS...]
|
|
306
306
|
Valid options:
|
307
307
|
--port ARG : specify a TCP port number ARG
|
308
308
|
--repo ARG : URL of subversion repository
|
309
|
-
ARG
|
310
|
-
|
309
|
+
ARG can contain {HOST} or a {host}
|
310
|
+
{HOST} is replaced by client hostname with domain
|
311
|
+
{host} is replaced by client hostname without domain
|
312
|
+
e.g. svn://192.168.3.5/servers/{host}/ygg
|
311
313
|
--ro-username ARG : specify a username ARG for read only
|
312
314
|
--ro-password ARG : specify a password ARG for read only
|
313
315
|
|
data/spec/results_spec.rb
CHANGED
@@ -25,34 +25,56 @@ describe Yggdrasil, "results" do
|
|
25
25
|
Yggdrasil.command %w{server --debug}
|
26
26
|
end
|
27
27
|
sleep 1
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should show nothing if no change' do
|
28
31
|
Yggdrasil.command %w{init --debug --server localhost:4000} +
|
29
32
|
%w{--username hoge --password foo},
|
30
33
|
"Y\nhoge\nfoo\n"
|
31
34
|
`rm -f /tmp/yggdrasil-test/.yggdrasil/checker/gem_list`
|
35
|
+
|
36
|
+
`echo hoge > /tmp/yggdrasil-test/A`
|
37
|
+
Yggdrasil.command %w{add /tmp/yggdrasil-test/A}
|
38
|
+
Yggdrasil.command %w{check}
|
39
|
+
Yggdrasil.command %w{commit -m '1st' --username hoge --password foo /},
|
40
|
+
"Y\n"
|
41
|
+
|
32
42
|
Yggdrasil.command %w{check}
|
33
43
|
sleep 1
|
44
|
+
out = catch_out do
|
45
|
+
Yggdrasil.command %w{results --limit 30}
|
46
|
+
end
|
47
|
+
out.should == ""
|
34
48
|
end
|
35
49
|
|
36
50
|
it 'should show results' do
|
37
51
|
puts '---- should show results'
|
38
52
|
|
53
|
+
`echo foo >> /tmp/yggdrasil-test/A`
|
54
|
+
Yggdrasil.command %w{check}
|
55
|
+
|
39
56
|
`echo hoge > /tmp/yggdrasil-test/.yggdrasil/results/hoge-old`
|
40
57
|
File.utime Time.local(2001, 5, 22, 23, 59, 59),
|
41
58
|
Time.local(2001, 5, 1, 0, 0, 0),
|
42
59
|
"/tmp/yggdrasil-test/.yggdrasil/results/hoge-old"
|
60
|
+
sleep 1
|
43
61
|
|
44
62
|
out = catch_out do
|
45
|
-
Yggdrasil.command
|
63
|
+
lambda{Yggdrasil.command(%w{results --limit 30})}.should raise_error(SystemExit)
|
46
64
|
end
|
47
65
|
|
48
66
|
out.should == <<"EOS"
|
49
|
-
######## hoge-old
|
67
|
+
######## hoge-old: last check is too old: 2001-05-01 00:00:00 +0900
|
50
68
|
######## centos6_127.0.0.1 Mismatch:
|
51
|
-
|
52
|
-
A 0 tmp/yggdrasil-test/.yggdrasil
|
53
|
-
A 0 tmp/yggdrasil-test/.yggdrasil/checker_result
|
54
|
-
A 0 tmp
|
69
|
+
M 2 tmp/yggdrasil-test/A
|
55
70
|
|
71
|
+
Index: tmp/yggdrasil-test/A
|
72
|
+
===================================================================
|
73
|
+
--- tmp/yggdrasil-test/A (revision 2)
|
74
|
+
+++ tmp/yggdrasil-test/A (working copy)
|
75
|
+
@@ -1 +1,2 @@
|
76
|
+
hoge
|
77
|
+
+foo
|
56
78
|
EOS
|
57
79
|
end
|
58
80
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yggdrasil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
110
|
version: '0'
|
111
111
|
segments:
|
112
112
|
- 0
|
113
|
-
hash:
|
113
|
+
hash: 1646321919012648459
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
none: false
|
116
116
|
requirements:
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
segments:
|
121
121
|
- 0
|
122
|
-
hash:
|
122
|
+
hash: 1646321919012648459
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
125
|
rubygems_version: 1.8.25
|