evilchelu-braid 0.4.0 → 0.4.10

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.
Files changed (47) hide show
  1. data/{License.txt → LICENSE} +1 -1
  2. data/README.rdoc +27 -0
  3. data/Rakefile +17 -4
  4. data/bin/braid +29 -24
  5. data/braid.gemspec +7 -7
  6. data/lib/braid.rb +15 -18
  7. data/lib/braid/command.rb +94 -44
  8. data/lib/braid/commands/add.rb +20 -31
  9. data/lib/braid/commands/diff.rb +4 -3
  10. data/lib/braid/commands/remove.rb +8 -12
  11. data/lib/braid/commands/setup.rb +13 -18
  12. data/lib/braid/commands/update.rb +47 -48
  13. data/lib/braid/config.rb +54 -101
  14. data/lib/braid/mirror.rb +181 -0
  15. data/lib/braid/operations.rb +229 -204
  16. data/{spec/braid_spec.rb → test/braid_test.rb} +1 -1
  17. data/test/config_test.rb +62 -0
  18. data/test/fixtures/shiny/README +3 -0
  19. data/test/fixtures/skit1.1/layouts/layout.liquid +219 -0
  20. data/test/fixtures/skit1.2/layouts/layout.liquid +221 -0
  21. data/test/fixtures/skit1/layouts/layout.liquid +219 -0
  22. data/test/fixtures/skit1/preview.png +0 -0
  23. data/test/integration/adding_test.rb +80 -0
  24. data/test/integration/updating_test.rb +87 -0
  25. data/test/integration_helper.rb +69 -0
  26. data/test/mirror_test.rb +118 -0
  27. data/test/operations_test.rb +74 -0
  28. data/test/test_helper.rb +15 -0
  29. metadata +30 -33
  30. data/History.txt +0 -4
  31. data/Manifest.txt +0 -32
  32. data/README.txt +0 -53
  33. data/config/hoe.rb +0 -68
  34. data/config/requirements.rb +0 -17
  35. data/lib/braid/exceptions.rb +0 -33
  36. data/lib/braid/version.rb +0 -9
  37. data/script/destroy +0 -14
  38. data/script/generate +0 -14
  39. data/setup.rb +0 -1585
  40. data/spec/config_spec.rb +0 -117
  41. data/spec/operations_spec.rb +0 -48
  42. data/spec/spec.opts +0 -3
  43. data/spec/spec_helper.rb +0 -11
  44. data/tasks/deployment.rake +0 -27
  45. data/tasks/environment.rake +0 -7
  46. data/tasks/rspec.rake +0 -32
  47. data/tasks/website.rake +0 -9
@@ -1,117 +0,0 @@
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
@@ -1,48 +0,0 @@
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_git_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_git_version.should == "1.5.5.1.98.gf0ec4"
27
- end
28
- end
29
-
30
- describe Braid::Operations::Helpers, "verify_git_version against 1.5.4.5" do
31
- required_version = "1.5.4.5"
32
- should_pass = %w(1.5.4.6 1.5.5 1.6 1.5.4.5.2 1.5.5.1.98.gf0ec4)
33
- should_not_pass = %w(1.5.4.4 1.5.4 1.5.3 1.4.5.6)
34
-
35
- should_pass.each do |actual_version|
36
- it "should be true for #{actual_version}" do
37
- self.stub!(:extract_git_version).and_return(actual_version)
38
- verify_git_version("1.5.4.5").should == true
39
- end
40
- end
41
-
42
- should_not_pass.each do |actual_version|
43
- it "should be false for #{actual_version}" do
44
- self.stub!(:extract_git_version).and_return(actual_version)
45
- verify_git_version("1.5.4.5").should == false
46
- end
47
- end
48
- end
@@ -1,3 +0,0 @@
1
- --colour
2
- --format specdoc
3
- --loadby mtime
@@ -1,11 +0,0 @@
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'
@@ -1,27 +0,0 @@
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
@@ -1,7 +0,0 @@
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
@@ -1,32 +0,0 @@
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
@@ -1,9 +0,0 @@
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