misaka-braid 0.4.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Braid" do
4
+ it "puts the lotion in the basket" do
5
+ # dedicated to dblack
6
+ end
7
+ end
@@ -0,0 +1,117 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Braid::Config.options_to_mirror" do
4
+ before(:each) do
5
+ @config = Braid::Config
6
+ end
7
+
8
+ it "should default branch to master" do
9
+ name, params = @config.options_to_mirror("git://path")
10
+ params["branch"].should == "master"
11
+ end
12
+
13
+ it "should default type to git, from protocol" do
14
+ name, params = @config.options_to_mirror("git://path")
15
+ params["type"].should == "git"
16
+ end
17
+
18
+ it "should default type to git, if path ends in .git" do
19
+ name, params = @config.options_to_mirror("http://path.git")
20
+ params["type"].should == "git"
21
+ end
22
+
23
+ it "should default type to svn, from protocol" do
24
+ name, params = @config.options_to_mirror("svn://path")
25
+ params["type"].should == "svn"
26
+ end
27
+
28
+ it "should default type to svn, if path ends in /trunk" do
29
+ name, params = @config.options_to_mirror("http://path/trunk")
30
+ params["type"].should == "svn"
31
+ end
32
+
33
+ it "should raise if no type can be guessed" do
34
+ lambda { @config.options_to_mirror("http://path") }.should raise_error(Braid::Config::CannotGuessMirrorType)
35
+ end
36
+
37
+ it "should default mirror to previous to last path part, if last path part is /trunk" do
38
+ name, params = @config.options_to_mirror("http://path/trunk")
39
+ name.should == "path"
40
+ end
41
+
42
+ it "should default mirror to last path part, ignoring trailing .git" do
43
+ name, params = @config.options_to_mirror("http://path.git")
44
+ name.should == "path"
45
+ end
46
+ end
47
+
48
+ describe "Braid::Config, in general", :shared => true do
49
+ db = "tmp.yml"
50
+
51
+ before(:each) do
52
+ @config = Braid::Config.new(db)
53
+ end
54
+
55
+ after(:each) do
56
+ FileUtils.rm(db) rescue nil
57
+ end
58
+ end
59
+
60
+ describe "Braid::Config, when empty" do
61
+ it_should_behave_like "Braid::Config, in general"
62
+
63
+ it "should add a mirror and its params" do
64
+ @config.add("mirror", "remote" => "path")
65
+ @config.get("mirror").should == { "remote" => "path" }
66
+ end
67
+
68
+ it "should not get a mirror by name" do
69
+ @config.get("mirror").should be_nil
70
+ lambda { @config.get!("mirror") }.should raise_error(Braid::Config::MirrorDoesNotExist)
71
+ end
72
+ end
73
+
74
+ describe "Braid::Config, with one mirror" do
75
+ it_should_behave_like "Braid::Config, in general"
76
+
77
+ before(:each) do
78
+ @mirror = { "remote" => "path" }
79
+ @config.add("mirror", @mirror)
80
+ end
81
+
82
+ it "should get the mirror by name" do
83
+ @config.get("mirror").should == @mirror
84
+ @config.get!("mirror").should == @mirror
85
+ end
86
+
87
+ it "should get the mirror by remote" do
88
+ @config.get_by_remote("path").should == ["mirror", @mirror]
89
+ end
90
+
91
+ it "should raise when overwriting a mirror on add" do
92
+ lambda { @config.add "mirror", "remote" => "other" }.should raise_error(Braid::Config::MirrorNameAlreadyInUse)
93
+ end
94
+
95
+ it "should remove the mirror" do
96
+ @config.remove("mirror")
97
+ @config.get("mirror").should be_nil
98
+ end
99
+
100
+ it "should update the mirror with new params" do
101
+ @config.update("mirror", "branch" => "other")
102
+ @config.get("mirror").should == { "remote" => "path", "branch" => "other" }
103
+ end
104
+
105
+ it "should replace the mirror with the new params" do
106
+ @config.replace("mirror", "branch" => "other")
107
+ @config.get("mirror").should == { "branch" => "other" }
108
+ end
109
+
110
+ it "should raise when trying to update nonexistent mirror" do
111
+ lambda { @config.update "N/A", {} }.should raise_error(Braid::Config::MirrorDoesNotExist)
112
+ end
113
+
114
+ it "should raise when trying to replace nonexistent mirror" do
115
+ lambda { @config.replace "N/A", {} }.should raise_error(Braid::Config::MirrorDoesNotExist)
116
+ end
117
+ end
@@ -0,0 +1,52 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Braid::Operations::Mirror#find_remote" do
4
+ include Braid::Operations::Mirror
5
+
6
+ before(:each) do
7
+ File.should_receive(:readlines).and_return(["[remote \"braid/git/one\"]\n", "[svn-remote \"braid/git/two\"]\n"])
8
+ end
9
+
10
+ it "should return true for existing git remotes" do
11
+ find_remote("braid/git/one").should == true
12
+ end
13
+
14
+ it "should return true for existing svn remotes" do
15
+ find_remote("braid/git/two").should == true
16
+ end
17
+
18
+ it "should return false for nonexistent remotes" do
19
+ find_remote("N/A").should == false
20
+ end
21
+ end
22
+
23
+ describe Braid::Operations::Helpers, "extract_version" do
24
+ it "should extract from git --version output" do
25
+ self.stub!(:exec!).and_return([0, "git version 1.5.5.1.98.gf0ec4\n", ""])
26
+ extract_version("git").should == "1.5.5.1.98.gf0ec4"
27
+ end
28
+ it "should extract from git svn --version output" do
29
+ self.stub!(:exec!).and_return([0, "git-svn version 1.5.5.1.98.gf0ec4\n", ""])
30
+ extract_version("git svn").should == "1.5.5.1.98.gf0ec4"
31
+ end
32
+ end
33
+
34
+ describe Braid::Operations::Helpers, "verify_version against 1.5.4.5" do
35
+ required_version = "1.5.4.5"
36
+ should_pass = %w(1.5.4.6 1.5.5 1.6 1.5.4.5.2 1.5.5.1.98.gf0ec4)
37
+ should_not_pass = %w(1.5.4.4 1.5.4 1.5.3 1.4.5.6)
38
+
39
+ should_pass.each do |actual_version|
40
+ it "should be true for #{actual_version}" do
41
+ self.should_receive(:extract_version).with("some git executable").and_return(actual_version)
42
+ verify_version("some git executable", "1.5.4.5").should == true
43
+ end
44
+ end
45
+
46
+ should_not_pass.each do |actual_version|
47
+ it "should be false for #{actual_version}" do
48
+ self.should_receive(:extract_version).with("some git executable").and_return(actual_version)
49
+ verify_version("some git executable", "1.5.4.5").should == false
50
+ end
51
+ end
52
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,3 @@
1
+ --colour
2
+ --format specdoc
3
+ --loadby mtime
@@ -0,0 +1,11 @@
1
+ begin
2
+ require 'rubygems'
3
+ rescue LoadError
4
+ end
5
+ require 'spec'
6
+
7
+ dir = File.dirname(__FILE__)
8
+ lib_path = File.expand_path("#{dir}/../lib")
9
+ $LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
10
+
11
+ require 'braid'
@@ -0,0 +1,27 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'rubygems'
3
+ require 'spec'
4
+ rescue LoadError
5
+ puts <<-EOS
6
+ To run the specs you must install the rspec gem:
7
+ . gem install rspec
8
+ EOS
9
+ exit(0)
10
+ end
11
+
12
+ # all this just to change the default task
13
+ Rake::TaskManager.class_eval do
14
+ def remove_task(task_name)
15
+ @tasks.delete(task_name.to_s)
16
+ end
17
+ end
18
+
19
+ def remove_task(task_name)
20
+ Rake.application.remove_task(task_name)
21
+ end
22
+
23
+ require 'spec/rake/spectask'
24
+
25
+ desc "Run the specs."
26
+ Spec::Rake::SpecTask.new do |t|
27
+ t.spec_opts = ['--options', "spec/spec.opts"]
28
+ t.spec_files = FileList['spec/*_spec.rb']
29
+ end
30
+
31
+ remove_task :default
32
+ task :default => :spec
@@ -0,0 +1,9 @@
1
+ # stubs for the website generation
2
+ # To install the website framework:
3
+ # script/generate website
4
+
5
+ task :website_generate
6
+
7
+ task :website_upload
8
+
9
+ task :website => :publish_docs
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: misaka-braid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Cristi Balan
8
+ - Norbert Crombach
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2008-05-01 00:00:00 -07:00
14
+ default_executable: braid
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: main
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.8.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: open4
27
+ version_requirement:
28
+ version_requirements: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.9.6
33
+ version:
34
+ description: Braid is a simple tool to help track git and svn vendor branches in a git repository
35
+ email: evil@che.lu
36
+ executables:
37
+ - braid
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - History.txt
42
+ - License.txt
43
+ - Manifest.txt
44
+ - README.txt
45
+ files:
46
+ - History.txt
47
+ - License.txt
48
+ - Manifest.txt
49
+ - README.txt
50
+ - Rakefile
51
+ - bin/braid
52
+ - config/hoe.rb
53
+ - config/requirements.rb
54
+ - lib/braid.rb
55
+ - lib/braid/command.rb
56
+ - lib/braid/commands/add.rb
57
+ - lib/braid/commands/diff.rb
58
+ - lib/braid/commands/remove.rb
59
+ - lib/braid/commands/setup.rb
60
+ - lib/braid/commands/update.rb
61
+ - lib/braid/config.rb
62
+ - lib/braid/exceptions.rb
63
+ - lib/braid/operations.rb
64
+ - lib/braid/version.rb
65
+ - braid.gemspec
66
+ - script/destroy
67
+ - script/generate
68
+ - setup.rb
69
+ - spec/braid_spec.rb
70
+ - spec/config_spec.rb
71
+ - spec/operations_spec.rb
72
+ - spec/spec.opts
73
+ - spec/spec_helper.rb
74
+ - tasks/deployment.rake
75
+ - tasks/environment.rake
76
+ - tasks/rspec.rake
77
+ - tasks/website.rake
78
+ has_rdoc: true
79
+ homepage: http://evil.che.lu/projects/braid
80
+ post_install_message:
81
+ rdoc_options:
82
+ - --main
83
+ - README.txt
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ version:
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: "0"
97
+ version:
98
+ requirements: []
99
+
100
+ rubyforge_project: braid
101
+ rubygems_version: 1.2.0
102
+ signing_key:
103
+ specification_version: 2
104
+ summary: Braid is a simple tool to help track git and svn vendor branches in a git repository
105
+ test_files: []
106
+