yggdrasil 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,59 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe Yggdrasil, "status" do
4
+ it '-------- status' do
5
+ puts '-------- status'
6
+ prepare_environment
7
+ init_yggdrasil
8
+
9
+ # modify and not commit yet
10
+ `echo HOGE >> /tmp/yggdrasil-test/A`
11
+ `rm -f /tmp/yggdrasil-test/B`
12
+ `mkdir /tmp/yggdrasil-test/c`
13
+ `echo bar > /tmp/yggdrasil-test/c/C`
14
+ Yggdrasil.command %w{add /tmp/yggdrasil-test/c/C}
15
+ end
16
+
17
+ it 'should show status(absolute and relative)' do
18
+ puts "---- should show status(absolute and relative)"
19
+ out = catch_stdout do
20
+ FileUtils.cd "/tmp/yggdrasil-test" do
21
+ Yggdrasil.command %w{status /tmp/yggdrasil-test/A B --username hoge --password foo}
22
+ end
23
+ end
24
+ out.should == <<"EOS"
25
+ M 3 tmp/yggdrasil-test/A
26
+ D 3 tmp/yggdrasil-test/B
27
+ EOS
28
+ end
29
+
30
+ it 'should show status(/)' do
31
+ puts "---- should show status(/)"
32
+ out = catch_stdout do
33
+ FileUtils.cd "/tmp/yggdrasil-test" do
34
+ Yggdrasil.command %w{status / --username hoge --password foo}
35
+ end
36
+ end
37
+ out.should == <<"EOS"
38
+ M 3 tmp/yggdrasil-test/A
39
+ D 3 tmp/yggdrasil-test/B
40
+ A 0 tmp/yggdrasil-test/c/C
41
+ A 0 tmp/yggdrasil-test/c
42
+ EOS
43
+ end
44
+
45
+ it 'should show status (no path)' do
46
+ puts "---- should show status (no path)"
47
+ out = catch_stdout do
48
+ FileUtils.cd "/tmp/yggdrasil-test" do
49
+ Yggdrasil.command %w{status --username hoge --password foo}
50
+ end
51
+ end
52
+ out.should == <<"EOS"
53
+ M 3 tmp/yggdrasil-test/A
54
+ D 3 tmp/yggdrasil-test/B
55
+ A 0 tmp/yggdrasil-test/c/C
56
+ A 0 tmp/yggdrasil-test/c
57
+ EOS
58
+ end
59
+ end
@@ -0,0 +1,72 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe Yggdrasil, "update" do
4
+ it '-------- update' do
5
+ puts '-------- update'
6
+ prepare_environment
7
+ init_yggdrasil
8
+
9
+ puts '-- make another working copy'
10
+ puts `svn co file:///tmp/yggdrasil-test/svn-repo/mng-repo/host-name /tmp/yggdrasil-test/svn-work`
11
+ end
12
+
13
+ it 'should success update (related/absolute path)' do
14
+ puts '---- should success update (related/absolute path)'
15
+ puts '-- commit on another working copy'
16
+ `echo A:related/absolute path > /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test/A`
17
+ `echo B:related/absolute path > /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test/B`
18
+ `svn commit -m 'another commit' /tmp/yggdrasil-test/svn-work/`
19
+
20
+ FileUtils.cd '/tmp/yggdrasil-test' do
21
+ Yggdrasil.command %w{update A /tmp/yggdrasil-test/B} +
22
+ %w{--username hoge --password foo},
23
+ "0\nY\n"
24
+ end
25
+ `cat /tmp/yggdrasil-test/A`.should == "A:related/absolute path\n"
26
+ `cat /tmp/yggdrasil-test/B`.should == "B:related/absolute path\n"
27
+ end
28
+
29
+ it 'should success update (only one file)' do
30
+ puts '---- should success update (only one file)'
31
+
32
+ puts '-- commit on another working copy'
33
+ `echo A:only one file > /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test/A`
34
+ `echo B:only one file > /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test/B`
35
+ `svn commit -m 'another commit' /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test`
36
+
37
+ Yggdrasil.command %w{update /tmp/yggdrasil-test/A} +
38
+ %w{--username hoge --password foo --non-interactive}
39
+
40
+ `cat /tmp/yggdrasil-test/A`.should == "A:only one file\n"
41
+ `cat /tmp/yggdrasil-test/B`.should == "B:related/absolute path\n"
42
+ end
43
+
44
+ it 'should success update (parent path)' do
45
+ puts '---- should success update (parent path)'
46
+ puts '-- commit on another working copy'
47
+ `echo A:parent path > /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test/A`
48
+ `echo B:parent path > /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test/B`
49
+ `svn commit -m 'another commit' /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test`
50
+
51
+ Yggdrasil.command %w{update /tmp} +
52
+ %w{--username hoge --password foo},
53
+ "1\nY\n"
54
+ `cat /tmp/yggdrasil-test/A`.should == "A:parent path\n"
55
+ `cat /tmp/yggdrasil-test/B`.should == "B:parent path\n"
56
+ end
57
+
58
+ it 'should success update (no path)' do
59
+ puts '---- should success update (no path)'
60
+ puts '-- commit on another working copy'
61
+ `echo A:no path > /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test/A`
62
+ `echo B:no path > /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test/B`
63
+ `svn commit -m 'another commit' /tmp/yggdrasil-test/svn-work/tmp/yggdrasil-test`
64
+
65
+ FileUtils.cd '/tmp' do
66
+ Yggdrasil.command %w{update} +
67
+ %w{--username hoge --password foo --non-interactive}
68
+ end
69
+ `cat /tmp/yggdrasil-test/A`.should == "A:no path\n"
70
+ `cat /tmp/yggdrasil-test/B`.should == "B:no path\n"
71
+ end
72
+ end
@@ -0,0 +1,24 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe Yggdrasil, "version" do
4
+
5
+ show_version = <<"EOS"
6
+ #{File.basename($0)}, version #{Yggdrasil::VERSION}
7
+
8
+ Copyright (C) 2012-2013 Tomohisa Kusukawa.
9
+ Yggdrasil is open source software, see https://github.com/tkusukawa/yggdrasil/
10
+
11
+ EOS
12
+
13
+ it 'should show version on "version"' do
14
+ puts '---- should show version on "version"'
15
+ out = catch_stdout{Yggdrasil.command %w{version}}
16
+ out.should == show_version
17
+ end
18
+
19
+ it 'should show version on "--version"' do
20
+ puts '---- should show version on "--version"'
21
+ out = catch_stdout{Yggdrasil.command %w{--version}}
22
+ out.should == show_version
23
+ end
24
+ end
data/yggdrasil.gemspec CHANGED
@@ -2,16 +2,19 @@
2
2
  require File.expand_path('../lib/yggdrasil/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["tkusukawa"]
6
- gem.email = ["t.kusukawa@gmail.com"]
7
- gem.description = %q{ruby script to manage server configurations by subversion.}
8
- gem.summary = %q{ruby script to manage server configurations by subversion.}
5
+ gem.authors = ["Tomohisa Kusukawa"]
6
+ gem.email = %w{t.kusukawa@gmail.com}
7
+ gem.description = %q{Yggdrasil is a subversion wrapper to manage configuration files.}
8
+ gem.summary = "Type 'yggdrasil help' for usage."
9
9
  gem.homepage = "https://github.com/tkusukawa/yggdrasil"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
14
  gem.name = "yggdrasil"
15
- gem.require_paths = ["lib"]
15
+ gem.require_paths = %w{lib}
16
16
  gem.version = Yggdrasil::VERSION
17
+
18
+ gem.add_development_dependency "rspec"
19
+ gem.add_development_dependency "simplecov"
17
20
  end
metadata CHANGED
@@ -1,17 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yggdrasil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - tkusukawa
8
+ - Tomohisa Kusukawa
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-16 00:00:00.000000000 Z
13
- dependencies: []
14
- description: ruby script to manage server configurations by subversion.
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: simplecov
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Yggdrasil is a subversion wrapper to manage configuration files.
15
47
  email:
16
48
  - t.kusukawa@gmail.com
17
49
  executables:
@@ -26,7 +58,31 @@ files:
26
58
  - Rakefile
27
59
  - bin/yggdrasil
28
60
  - lib/yggdrasil.rb
61
+ - lib/yggdrasil/add.rb
62
+ - lib/yggdrasil/cleanup.rb
63
+ - lib/yggdrasil/commit.rb
64
+ - lib/yggdrasil/diff.rb
65
+ - lib/yggdrasil/help.rb
66
+ - lib/yggdrasil/init.rb
67
+ - lib/yggdrasil/list.rb
68
+ - lib/yggdrasil/log.rb
69
+ - lib/yggdrasil/revert.rb
70
+ - lib/yggdrasil/status.rb
71
+ - lib/yggdrasil/update.rb
29
72
  - lib/yggdrasil/version.rb
73
+ - spec/add_spec.rb
74
+ - spec/cleanup_spec.rb
75
+ - spec/commit_spec.rb
76
+ - spec/diff_spec.rb
77
+ - spec/help_spec.rb
78
+ - spec/init_spec.rb
79
+ - spec/list_spec.rb
80
+ - spec/log_spec.rb
81
+ - spec/revert_spec.rb
82
+ - spec/spec_helper.rb
83
+ - spec/status_spec.rb
84
+ - spec/update_spec.rb
85
+ - spec/version_spec.rb
30
86
  - yggdrasil.gemspec
31
87
  homepage: https://github.com/tkusukawa/yggdrasil
32
88
  licenses: []
@@ -40,16 +96,35 @@ required_ruby_version: !ruby/object:Gem::Requirement
40
96
  - - ! '>='
41
97
  - !ruby/object:Gem::Version
42
98
  version: '0'
99
+ segments:
100
+ - 0
101
+ hash: 3458326500549019830
43
102
  required_rubygems_version: !ruby/object:Gem::Requirement
44
103
  none: false
45
104
  requirements:
46
105
  - - ! '>='
47
106
  - !ruby/object:Gem::Version
48
107
  version: '0'
108
+ segments:
109
+ - 0
110
+ hash: 3458326500549019830
49
111
  requirements: []
50
112
  rubyforge_project:
51
113
  rubygems_version: 1.8.23
52
114
  signing_key:
53
115
  specification_version: 3
54
- summary: ruby script to manage server configurations by subversion.
55
- test_files: []
116
+ summary: Type 'yggdrasil help' for usage.
117
+ test_files:
118
+ - spec/add_spec.rb
119
+ - spec/cleanup_spec.rb
120
+ - spec/commit_spec.rb
121
+ - spec/diff_spec.rb
122
+ - spec/help_spec.rb
123
+ - spec/init_spec.rb
124
+ - spec/list_spec.rb
125
+ - spec/log_spec.rb
126
+ - spec/revert_spec.rb
127
+ - spec/spec_helper.rb
128
+ - spec/status_spec.rb
129
+ - spec/update_spec.rb
130
+ - spec/version_spec.rb