yggdrasil 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -5
- data/lib/yggdrasil/commit.rb +4 -0
- data/lib/yggdrasil/init.rb +6 -5
- data/lib/yggdrasil/revert.rb +4 -0
- data/lib/yggdrasil/update.rb +4 -0
- data/lib/yggdrasil/version.rb +1 -1
- data/lib/yggdrasil.rb +4 -7
- data/spec/init_spec.rb +8 -2
- data/spec/spec_helper.rb +7 -2
- metadata +4 -4
data/README.md
CHANGED
@@ -18,23 +18,29 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Install subversion:
|
22
|
+
|
22
23
|
$ sudo yum install subversion
|
23
24
|
|
24
|
-
|
25
|
+
Prepare subversion repository and init Yggdrasil:
|
26
|
+
|
25
27
|
$ svnadmin create ~/svn-repo
|
26
28
|
$ yggdrasil init --repo file://$HOME/svn-repo
|
29
|
+
|
27
30
|
You should use svn-server if you have.
|
28
31
|
In that case, the configuration files of
|
29
32
|
all the servers can be managed on the unification.
|
30
33
|
|
31
|
-
|
34
|
+
Add configuration files:
|
35
|
+
|
32
36
|
$ yggdrasil add ~/.bashrc ..etc
|
33
37
|
|
34
|
-
|
38
|
+
Check modify and/or delete:
|
39
|
+
|
35
40
|
$ yggdrasil status /
|
36
41
|
|
37
|
-
|
42
|
+
Refer Help:
|
43
|
+
|
38
44
|
$ yggdrasil help
|
39
45
|
|
40
46
|
## Environment
|
data/lib/yggdrasil/commit.rb
CHANGED
@@ -9,6 +9,10 @@ class Yggdrasil
|
|
9
9
|
|
10
10
|
updates = sync_mirror(options)
|
11
11
|
matched_updates = select_updates(updates, target_paths)
|
12
|
+
if matched_updates.size == 0
|
13
|
+
puts "\nno files."
|
14
|
+
return
|
15
|
+
end
|
12
16
|
|
13
17
|
confirmed_updates = confirm_updates(matched_updates,options) do |relative_path|
|
14
18
|
FileUtils.cd @mirror_dir do
|
data/lib/yggdrasil/init.rb
CHANGED
@@ -65,11 +65,12 @@ class Yggdrasil
|
|
65
65
|
end
|
66
66
|
|
67
67
|
Dir.mkdir config_dir, 0755
|
68
|
-
File.
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
File.open(config_dir+'/config', "w") do |f|
|
69
|
+
f.write "path=#{ENV['PATH']}\n"\
|
70
|
+
"svn=#{svn}\n"\
|
71
|
+
"svn_version=#{svn_version}\n"\
|
72
|
+
"repo=#{options[:repo]}\n"
|
73
|
+
end
|
73
74
|
|
74
75
|
ret = system3 "#{svn} checkout"\
|
75
76
|
" --no-auth-cache --non-interactive"\
|
data/lib/yggdrasil/revert.rb
CHANGED
@@ -9,6 +9,10 @@ class Yggdrasil
|
|
9
9
|
|
10
10
|
updates = sync_mirror(options)
|
11
11
|
matched_updates = select_updates(updates, target_paths)
|
12
|
+
if matched_updates.size == 0
|
13
|
+
puts "\nno files."
|
14
|
+
return
|
15
|
+
end
|
12
16
|
|
13
17
|
confirmed_updates = confirm_updates(matched_updates,options) do |relative_path|
|
14
18
|
FileUtils.cd @mirror_dir do
|
data/lib/yggdrasil/update.rb
CHANGED
@@ -19,6 +19,10 @@ class Yggdrasil
|
|
19
19
|
end
|
20
20
|
|
21
21
|
matched_updates = select_updates(updates, target_paths)
|
22
|
+
if matched_updates.size == 0
|
23
|
+
puts "\nno files."
|
24
|
+
return
|
25
|
+
end
|
22
26
|
|
23
27
|
confirmed_updates = confirm_updates(matched_updates,options) do |relative_path|
|
24
28
|
FileUtils.cd @mirror_dir do
|
data/lib/yggdrasil/version.rb
CHANGED
data/lib/yggdrasil.rb
CHANGED
@@ -54,13 +54,10 @@ class Yggdrasil
|
|
54
54
|
end
|
55
55
|
|
56
56
|
# @param [String] cmd
|
57
|
-
def Yggdrasil.system3(cmd, err_exit=true
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
out,stat = Open3.capture2e cmd, :stdin_data=>stdin
|
62
|
-
end
|
63
|
-
unless stat.success?
|
57
|
+
def Yggdrasil.system3(cmd, err_exit=true)
|
58
|
+
out = `#{cmd}`
|
59
|
+
|
60
|
+
unless $?.success?
|
64
61
|
return nil unless err_exit
|
65
62
|
$stderr.puts "#{CMD} error: command failure: #{cmd}"
|
66
63
|
$stderr.puts "command output:"
|
data/spec/init_spec.rb
CHANGED
@@ -55,13 +55,19 @@ describe Yggdrasil, "init" do
|
|
55
55
|
`rm -rf /tmp/yggdrasil-test/.yggdrasil`
|
56
56
|
`rm -rf /tmp/yggdrasil-test/svn-repo`
|
57
57
|
`svnadmin create /tmp/yggdrasil-test/svn-repo`
|
58
|
-
|
59
|
-
|
58
|
+
|
59
|
+
File.open("/tmp/yggdrasil-test/svn-repo/conf/passwd", "w") do |f|
|
60
|
+
f.write "[users]\nhoge = foo"
|
61
|
+
end
|
62
|
+
|
63
|
+
File.open("/tmp/yggdrasil-test/svn-repo/conf/svnserve.conf", "w") do |f|
|
64
|
+
f.write <<"EOS"
|
60
65
|
[general]
|
61
66
|
anon-access = none
|
62
67
|
auth-access = write
|
63
68
|
password-db = passwd
|
64
69
|
EOS
|
70
|
+
end
|
65
71
|
`svnserve -d`
|
66
72
|
|
67
73
|
out = catch_stdout do
|
data/spec/spec_helper.rb
CHANGED
@@ -12,13 +12,18 @@ def prepare_environment
|
|
12
12
|
`svnadmin create /tmp/yggdrasil-test/svn-repo`
|
13
13
|
|
14
14
|
puts '-- launch svnserve'
|
15
|
-
|
16
|
-
|
15
|
+
|
16
|
+
File.open("/tmp/yggdrasil-test/svn-repo/conf/passwd", "w") do |f|
|
17
|
+
f.write "[users]\nhoge = foo"
|
18
|
+
end
|
19
|
+
File.open("/tmp/yggdrasil-test/svn-repo/conf/svnserve.conf", "w") do |f|
|
20
|
+
f.write <<"EOS"
|
17
21
|
[general]
|
18
22
|
anon-access = none
|
19
23
|
auth-access = write
|
20
24
|
password-db = passwd
|
21
25
|
EOS
|
26
|
+
end
|
22
27
|
`svnserve -d`
|
23
28
|
end
|
24
29
|
|
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.2
|
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-01-
|
12
|
+
date: 2013-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
segments:
|
100
100
|
- 0
|
101
|
-
hash:
|
101
|
+
hash: 690263660522178421
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
103
|
none: false
|
104
104
|
requirements:
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
segments:
|
109
109
|
- 0
|
110
|
-
hash:
|
110
|
+
hash: 690263660522178421
|
111
111
|
requirements: []
|
112
112
|
rubyforge_project:
|
113
113
|
rubygems_version: 1.8.23
|