yggdrasil 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -18,23 +18,29 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- * Install subversion
21
+ Install subversion:
22
+
22
23
  $ sudo yum install subversion
23
24
 
24
- * Prepare subversion repository and init Yggdrasil.
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
- * Add configuration files
34
+ Add configuration files:
35
+
32
36
  $ yggdrasil add ~/.bashrc ..etc
33
37
 
34
- * Check modify and/or delete
38
+ Check modify and/or delete:
39
+
35
40
  $ yggdrasil status /
36
41
 
37
- * Refer Help
42
+ Refer Help:
43
+
38
44
  $ yggdrasil help
39
45
 
40
46
  ## Environment
@@ -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
@@ -65,11 +65,12 @@ class Yggdrasil
65
65
  end
66
66
 
67
67
  Dir.mkdir config_dir, 0755
68
- File.write config_dir+'/config',
69
- "path=#{ENV['PATH']}\n"\
70
- "svn=#{svn}\n"\
71
- "svn_version=#{svn_version}\n"\
72
- "repo=#{options[:repo]}\n"
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"\
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  class Yggdrasil
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  CMD = File::basename($0)
4
4
 
5
5
  def Yggdrasil.version
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, stdin=nil)
58
- if stdin.nil?
59
- out,stat = Open3.capture2e cmd
60
- else
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
- Yggdrasil.system3 'cat > /tmp/yggdrasil-test/svn-repo/conf/passwd', true, "[users]\nhoge = foo"
59
- Yggdrasil.system3 'cat > /tmp/yggdrasil-test/svn-repo/conf/svnserve.conf', true, <<"EOS"
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
- Yggdrasil.system3 'cat > /tmp/yggdrasil-test/svn-repo/conf/passwd', true, "[users]\nhoge = foo"
16
- Yggdrasil.system3 'cat > /tmp/yggdrasil-test/svn-repo/conf/svnserve.conf', true, <<"EOS"
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.1
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-14 00:00:00.000000000 Z
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: 3458326500549019830
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: 3458326500549019830
110
+ hash: 690263660522178421
111
111
  requirements: []
112
112
  rubyforge_project:
113
113
  rubygems_version: 1.8.23