yggdrasil 0.0.2 → 0.0.3

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
@@ -4,25 +4,15 @@ Yggdrasil is a subversion wrapper to manage configuration files.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'yggdrasil'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
7
  $ gem install yggdrasil
18
8
 
19
- ## Usage
9
+ And you have to install subversion:
20
10
 
21
- Install subversion:
11
+ (e.g.)$ sudo yum install subversion
22
12
 
23
- $ sudo yum install subversion
13
+ ## Usage
24
14
 
25
- Prepare subversion repository and init Yggdrasil:
15
+ Prepare subversion repository and initialize Yggdrasil:
26
16
 
27
17
  $ svnadmin create ~/svn-repo
28
18
  $ yggdrasil init --repo file://$HOME/svn-repo
data/lib/yggdrasil/add.rb CHANGED
@@ -2,7 +2,6 @@ class Yggdrasil
2
2
 
3
3
  # @param [Array] args
4
4
  def add(args)
5
- add_relatives = Array.new
6
5
  while (arg = args.shift)
7
6
  file_path = `readlink -f #{arg}`.chomp
8
7
  exit $?.exitstatus unless $?.success?
@@ -10,15 +9,16 @@ class Yggdrasil
10
9
  puts "no such file: #{file_path}"
11
10
  next
12
11
  end
13
- mirror_path = @mirror_dir + file_path
14
- mirror_dir = File.dirname(mirror_path)
15
- FileUtils.mkdir_p(mirror_dir) unless File.exist?(mirror_dir)
16
- FileUtils.copy file_path, mirror_path
17
- add_relatives << file_path.sub(%r{^/}, '')
18
- end
19
- if add_relatives.size != 0
20
- FileUtils.cd @mirror_dir do
21
- puts system3("#@svn add --no-auth-cache --non-interactive --parents #{add_relatives.join(' ')}")
12
+ mirror_path = @mirror_dir
13
+ file_path.split('/')[1..-1].each do |part|
14
+ mirror_path += '/'+part
15
+ next if File.exist?(mirror_path)
16
+ if mirror_path == @mirror_dir+file_path
17
+ FileUtils.copy file_path, mirror_path
18
+ else
19
+ Dir.mkdir mirror_path
20
+ end
21
+ puts system3("#@svn add --no-auth-cache --non-interactive #{mirror_path}")
22
22
  end
23
23
  end
24
24
  end
@@ -1,5 +1,5 @@
1
1
  class Yggdrasil
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  CMD = File::basename($0)
4
4
 
5
5
  def Yggdrasil.version
data/spec/add_spec.rb CHANGED
@@ -16,10 +16,12 @@ describe Yggdrasil, "add" do
16
16
  out.should == "no such file: /etc/hoge\n"
17
17
  end
18
18
 
19
- it 'should success: add exist files' do
19
+ it 'should success: add exist files (relative)' do
20
20
  puts '---- should success: add exist files'
21
- Yggdrasil.command %w{add Gemfile /etc/fstab /etc/fstab}
21
+ Yggdrasil.command %w{add Gemfile /etc/fstab}
22
22
  File.exist?("/tmp/yggdrasil-test/.yggdrasil/mirror#{`readlink -f Gemfile`.chomp}").should be_true
23
+ end
24
+ it 'should success: add exist files (absolute)' do
23
25
  File.exist?("/tmp/yggdrasil-test/.yggdrasil/mirror#{`readlink -f /etc/fstab`.chomp}").should be_true
24
26
  end
25
27
  end
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.2
4
+ version: 0.0.3
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-15 00:00:00.000000000 Z
12
+ date: 2013-01-16 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: 690263660522178421
101
+ hash: 1446740146431344687
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: 690263660522178421
110
+ hash: 1446740146431344687
111
111
  requirements: []
112
112
  rubyforge_project:
113
113
  rubygems_version: 1.8.23