dreamcat4-braid 0.531 → 0.533

Sign up to get free protection for your applications and to get access to all the features.
data/bin/braid CHANGED
@@ -75,11 +75,11 @@ Main {
75
75
  . braid update local/dir
76
76
  TXT
77
77
 
78
- mixin :optional_path, :option_revision, :option_head, :option_verbose
78
+ mixin :optional_path, :option_branch, :option_revision, :option_head, :option_verbose
79
79
 
80
80
  run {
81
81
  Braid.verbose = verbose
82
- Braid::Command.run(:update, path, { "revision" => revision, "head" => head })
82
+ Braid::Command.run(:update, path, { "branch" => branch, "revision" => revision, "head" => head })
83
83
  }
84
84
  }
85
85
 
data/braid.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{braid}
3
- s.version = "0.531"
3
+ s.version = "0.533"
4
4
 
5
5
  s.specification_version = 2 if s.respond_to? :specification_version=
6
6
 
data/lib/braid/command.rb CHANGED
@@ -23,7 +23,7 @@ module Braid
23
23
  end
24
24
 
25
25
  def self.msg(str)
26
- puts "Braid: #{str}"
26
+ puts "gitnest: #{str}"
27
27
  end
28
28
 
29
29
  def msg(str)
@@ -18,8 +18,8 @@ module Braid
18
18
 
19
19
  if mirror.type == "git-clone"
20
20
  gitclone.add_gitignore(mirror.path)
21
- mirror.rspec_git.update options["revision"]
22
- commit_message = "Added clone repository #{mirror.rspec_git.url} in #{mirror.path}"
21
+ mirror.rspec_git.update mirror.branch
22
+ commit_message = "added \'#{mirror.rspec_git.url}\' to path:\'#{mirror.path}\'"
23
23
  else
24
24
  mirror.fetch
25
25
 
@@ -25,7 +25,12 @@ module Braid
25
25
  msg "Updating mirror '#{mirror.path}'#{revision_message}."
26
26
 
27
27
  if mirror.type == "git-clone"
28
- mirror.rspec_git.update options["revision"]
28
+ mirror.branch = options["branch"] || mirror.branch
29
+ # config.update(mirror)
30
+ mirror.rspec_git.update mirror.branch
31
+ config.update(mirror)
32
+ add_config_file
33
+ commit_message = "Updated clone repository '#{mirror.path}' to #{mirror.branch}"
29
34
  else
30
35
 
31
36
  # check options for lock modification
@@ -88,10 +93,10 @@ module Braid
88
93
  File.open(".git/MERGE_MSG", 'w') { |f| f.puts(commit_message) }
89
94
  return
90
95
  end
91
-
92
- git.commit(commit_message)
93
- msg commit_message
94
96
  end
97
+
98
+ git.commit(commit_message)
99
+ msg commit_message
95
100
  end
96
101
 
97
102
  def generate_tree_hash(mirror, revision)
data/lib/braid/config.rb CHANGED
@@ -1,6 +1,20 @@
1
1
  require 'yaml'
2
2
  require 'yaml/store'
3
3
 
4
+ class Hash
5
+ # Replacing the to_yaml function so it'll serialize hashes sorted (by their keys)
6
+ # Original function is in /usr/lib/ruby/1.8/yaml/rubytypes.rb
7
+ def to_yaml( opts = {} )
8
+ YAML::quick_emit( object_id, opts ) do |out|
9
+ out.map( taguri, to_yaml_style ) do |map|
10
+ sort.each do |k, v| # <-- here's my addition (the 'sort')
11
+ map.add( k, v )
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+
4
18
  module Braid
5
19
  class Config
6
20
  class PathAlreadyInUse < BraidError
data/lib/braid/mirror.rb CHANGED
@@ -2,7 +2,7 @@ $:.unshift File.dirname(__FILE__)
2
2
  require 'rspec_git.rb'
3
3
 
4
4
  module Braid
5
- class Mirror
5
+ class Mirror
6
6
  TYPES = %w(git svn git-clone)
7
7
  ATTRIBUTES = %w(url remote type branch squashed revision lock)
8
8
 
@@ -37,11 +37,11 @@ module Braid
37
37
 
38
38
  branch = options["branch"] || "master"
39
39
 
40
- if type = options["type"] || extract_type_from_url(url)
41
- raise UnknownType, type unless TYPES.include?(type)
42
- else
43
- raise CannotGuessType, url
44
- end
40
+ # if type = options["type"] || extract_type_from_url(url)
41
+ # raise UnknownType, type unless TYPES.include?(type)
42
+ # else
43
+ # raise CannotGuessType, url
44
+ # end
45
45
 
46
46
  unless path = options["path"] || extract_path_from_url(url)
47
47
  raise PathRequired
@@ -55,33 +55,43 @@ module Braid
55
55
  path = "vendor/gems/#{path}"
56
56
  end
57
57
 
58
- if type != "git-clone"
59
- remote = "braid/#{path}".gsub("_", '-') # stupid git svn changes all _ to ., weird
60
- squashed = !options["full"]
61
- branch = nil if type == "svn"
62
- end
58
+ # if type != "git-clone"
59
+ # remote = "braid/#{path}".gsub("_", '-') # stupid git svn changes all _ to ., weird
60
+ # squashed = !options["full"]
61
+ # branch = nil if type == "svn"
62
+ # end
63
63
 
64
- attributes = { "url" => url, "remote" => remote, "type" => type, "branch" => branch, "squashed" => squashed }
64
+ # attributes = { "url" => url, "remote" => remote, "type" => type, "branch" => branch, "squashed" => squashed }
65
+ attributes = { "url" => url, "branch" => branch }
65
66
  self.new(path, attributes)
66
67
  end
67
-
68
+
68
69
  def ==(comparison)
69
70
  path == comparison.path && attributes == comparison.attributes
70
71
  end
71
72
 
72
73
  def type
73
74
  # override Object#type
74
- attributes["type"]
75
+ # attributes["type"]
76
+ return "git-clone"
75
77
  end
76
78
 
77
79
  def locked?
78
80
  !!lock
79
81
  end
80
82
 
83
+ # def squashed?
84
+ # !!squashed
85
+ # end
86
+
81
87
  def squashed?
82
- !!squashed
88
+ return true
83
89
  end
84
90
 
91
+ def remote
92
+ return "braid/#{path}"
93
+ end
94
+
85
95
  def merged?(commit)
86
96
  # tip from spearce in #git:
87
97
  # `test z$(git merge-base A B) = z$(git rev-parse --verify A)`
@@ -125,7 +125,7 @@ module Braid
125
125
  end
126
126
 
127
127
  def msg(str)
128
- puts "Braid: #{str}"
128
+ puts "gitnest: #{str}"
129
129
  end
130
130
 
131
131
  def log(cmd)
@@ -218,7 +218,7 @@ module Braid
218
218
  def commit(message, *args)
219
219
 
220
220
  commit_message_file = Tempfile.new("braid_commit", ".")
221
- commit_message_file.print("Braid: " + message)
221
+ commit_message_file.print("gitnest: " + message)
222
222
  commit_message_file.flush
223
223
  status, out, err = exec("git commit -F #{commit_message_file.path} --no-verify #{args.join(' ')}")
224
224
  commit_message_file.unlink
@@ -31,7 +31,10 @@ module RSpec
31
31
  end
32
32
  else
33
33
  msg "** Fetching #{r[:name]}"
34
- system "git clone #{r[:url]} #{r[:path]}"
34
+ unless system "git clone #{r[:url]} #{r[:path]}"
35
+ msg "Error cloning #{r[:url]}"
36
+ exit 1
37
+ end
35
38
  end
36
39
  end
37
40
  msg "*** all repos updated successfully ***"
data/lib/braid.rb CHANGED
@@ -3,7 +3,9 @@ $:.unshift File.dirname(__FILE__)
3
3
  module Braid
4
4
  VERSION = "0.5"
5
5
 
6
- CONFIG_FILE = ".braids"
6
+ # CONFIG_FILE = ".braids"
7
+ # CONFIG_FILE = "CONFIGFILE"
8
+ CONFIG_FILE = ".gitnest"
7
9
  REQUIRED_GIT_VERSION = "1.6"
8
10
 
9
11
  def self.verbose; @verbose || false; end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dreamcat4-braid
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.531"
4
+ version: "0.533"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristi Balan