realityforge-braid 0.8.0 → 0.9.0
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/.ruby-version +1 -1
- data/.travis.yml +16 -0
- data/README.md +3 -1
- data/Rakefile +3 -0
- data/lib/braid/command.rb +1 -12
- data/lib/braid/config.rb +28 -42
- data/lib/braid/version.rb +1 -1
- data/spec/integration_helper.rb +7 -10
- data/spec/operations_spec.rb +1 -1
- data/spec/test_helper.rb +4 -0
- metadata +70 -88
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.9.3-p362
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Braid
|
2
2
|
|
3
|
+
[](http://travis-ci.org/realityforge/braid)
|
4
|
+
|
3
5
|
Braid is a simple tool to help track git vendor branches in a git repository.
|
4
6
|
|
5
|
-
The project homepage is [here](http://github.com/
|
7
|
+
The project homepage is [here](http://github.com/realityforge/braid/wikis/home).
|
6
8
|
|
7
9
|
## Requirements
|
8
10
|
|
data/Rakefile
CHANGED
data/lib/braid/command.rb
CHANGED
@@ -31,7 +31,7 @@ module Braid
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def config
|
34
|
-
@config ||=
|
34
|
+
@config ||= Config.new
|
35
35
|
end
|
36
36
|
|
37
37
|
def verbose?
|
@@ -72,17 +72,6 @@ module Braid
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
def load_and_migrate_config
|
76
|
-
config = Config.new
|
77
|
-
unless config.valid?
|
78
|
-
msg "Configuration is outdated. Migrating."
|
79
|
-
bail_on_local_changes!
|
80
|
-
config.migrate!
|
81
|
-
git.commit("Upgrade .braids", "-- .braids")
|
82
|
-
end
|
83
|
-
config
|
84
|
-
end
|
85
|
-
|
86
75
|
def add_config_file
|
87
76
|
git.add(CONFIG_FILE)
|
88
77
|
end
|
data/lib/braid/config.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'json'
|
2
3
|
require 'yaml/store'
|
3
4
|
|
4
5
|
module Braid
|
@@ -15,7 +16,18 @@ module Braid
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def initialize(config_file = CONFIG_FILE)
|
18
|
-
@
|
19
|
+
@config_file = config_file
|
20
|
+
begin
|
21
|
+
store = YAML::Store.new(@config_file)
|
22
|
+
@db = {}
|
23
|
+
store.transaction(true) do
|
24
|
+
store.roots.each do |path|
|
25
|
+
@db[path] = store[path]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
rescue
|
29
|
+
@db = JSON.parse(@config_file)
|
30
|
+
end
|
19
31
|
end
|
20
32
|
|
21
33
|
def add_from_options(url, options)
|
@@ -26,17 +38,13 @@ module Braid
|
|
26
38
|
end
|
27
39
|
|
28
40
|
def mirrors
|
29
|
-
@db.
|
30
|
-
@db.roots
|
31
|
-
end
|
41
|
+
@db.keys
|
32
42
|
end
|
33
43
|
|
34
44
|
def get(path)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
45
|
+
key = path.to_s.sub(/\/$/, '')
|
46
|
+
attributes = @db[key]
|
47
|
+
return attributes ? Mirror.new(path, attributes) : nil
|
40
48
|
end
|
41
49
|
|
42
50
|
def get!(path)
|
@@ -46,50 +54,28 @@ module Braid
|
|
46
54
|
end
|
47
55
|
|
48
56
|
def add(mirror)
|
49
|
-
|
50
|
-
|
51
|
-
write_mirror(mirror)
|
52
|
-
end
|
57
|
+
raise PathAlreadyInUse, mirror.path if get(mirror.path)
|
58
|
+
write_mirror(mirror)
|
53
59
|
end
|
54
60
|
|
55
61
|
def remove(mirror)
|
56
|
-
@db.
|
57
|
-
@db.delete(mirror.path)
|
58
|
-
end
|
62
|
+
@db.delete(mirror.path)
|
59
63
|
end
|
60
64
|
|
61
65
|
def update(mirror)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
write_mirror(mirror)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def valid?
|
70
|
-
@db.transaction(true) do
|
71
|
-
!@db.roots.any? {|path| @db[path]["url"].nil?}
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def migrate!
|
76
|
-
@db.transaction do
|
77
|
-
@db.roots.each do |path|
|
78
|
-
attributes = @db[path]
|
79
|
-
if attributes["local_branch"]
|
80
|
-
attributes["url"] = attributes.delete("remote")
|
81
|
-
attributes["remote"] = attributes.delete("local_branch")
|
82
|
-
attributes["squashed"] = attributes.delete("squash")
|
83
|
-
attributes["lock"] = attributes["revision"] # so far this has always been true
|
84
|
-
end
|
85
|
-
@db[path] = clean_attributes(attributes)
|
86
|
-
end
|
87
|
-
end
|
66
|
+
raise MirrorDoesNotExist, mirror.path unless get(mirror.path)
|
67
|
+
@db.delete(mirror.path)
|
68
|
+
write_mirror(mirror)
|
88
69
|
end
|
89
70
|
|
90
71
|
private
|
91
72
|
def write_mirror(mirror)
|
92
73
|
@db[mirror.path] = clean_attributes(mirror.attributes)
|
74
|
+
new_db = {}
|
75
|
+
@db.keys.sort.each do |key|
|
76
|
+
new_db[key] = @db[key]
|
77
|
+
end
|
78
|
+
File.open(@config_file, "wb") { |f| f.write JSON.pretty_generate(new_db) }
|
93
79
|
end
|
94
80
|
|
95
81
|
def clean_attributes(hash)
|
data/lib/braid/version.rb
CHANGED
data/spec/integration_helper.rb
CHANGED
@@ -18,11 +18,10 @@ def in_dir(dir = TMP_PATH)
|
|
18
18
|
yield
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
21
|
+
def run_command(command)
|
22
|
+
output = `#{command}`
|
23
|
+
raise "Error executing command: #{command}\nOutput: #{output}" unless $?.success?
|
24
|
+
output
|
26
25
|
end
|
27
26
|
|
28
27
|
def update_dir_from_fixture(dir, fixture = dir)
|
@@ -36,11 +35,9 @@ def create_git_repo_from_fixture(fixture_name)
|
|
36
35
|
update_dir_from_fixture(fixture_name)
|
37
36
|
|
38
37
|
in_dir(git_repo) do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
git commit -m "initial commit of #{fixture_name}"
|
43
|
-
EOD
|
38
|
+
run_command('git init')
|
39
|
+
run_command('git add *')
|
40
|
+
run_command("git commit -m \"initial commit of #{fixture_name}\"")
|
44
41
|
end
|
45
42
|
|
46
43
|
git_repo
|
data/spec/operations_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
3
3
|
describe "Braid::Operations::Git#remote_url" do
|
4
4
|
it "should use git config" do
|
5
5
|
# FIXME weak test
|
6
|
-
git.
|
6
|
+
git.stubs(:invoke).with(:config, 'remote.braid/git/one.url').returns("git://path")
|
7
7
|
git.remote_url("braid/git/one").should == "git://path"
|
8
8
|
end
|
9
9
|
end
|
data/spec/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,99 +1,91 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: realityforge-braid
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 8
|
9
|
-
- 0
|
10
|
-
version: 0.8.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Cristi Balan
|
14
9
|
- Norbert Crombach
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
23
16
|
name: main
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
26
18
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 37
|
31
|
-
segments:
|
32
|
-
- 4
|
33
|
-
- 7
|
34
|
-
- 3
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
35
22
|
version: 4.7.3
|
36
23
|
type: :runtime
|
37
|
-
version_requirements: *id001
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: open4
|
40
24
|
prerelease: false
|
41
|
-
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 4.7.3
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: open4
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
42
34
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
hash: 21
|
47
|
-
segments:
|
48
|
-
- 1
|
49
|
-
- 0
|
50
|
-
- 1
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
51
38
|
version: 1.0.1
|
52
39
|
type: :runtime
|
53
|
-
version_requirements: *id002
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: rspec
|
56
40
|
prerelease: false
|
57
|
-
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.0.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
58
50
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
hash: 63
|
63
|
-
segments:
|
64
|
-
- 2
|
65
|
-
- 12
|
66
|
-
- 0
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
67
54
|
version: 2.12.0
|
68
55
|
type: :development
|
69
|
-
version_requirements: *id003
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: mocha
|
72
56
|
prerelease: false
|
73
|
-
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - '='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.12.0
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: mocha
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
74
66
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
hash: 45
|
79
|
-
segments:
|
80
|
-
- 0
|
81
|
-
- 9
|
82
|
-
- 11
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
83
70
|
version: 0.9.11
|
84
71
|
type: :development
|
85
|
-
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 0.9.11
|
86
79
|
description: A simple tool for tracking vendor branches in git.
|
87
80
|
email: evil@che.lu
|
88
|
-
executables:
|
81
|
+
executables:
|
89
82
|
- braid
|
90
83
|
extensions: []
|
91
|
-
|
92
84
|
extra_rdoc_files: []
|
93
|
-
|
94
|
-
files:
|
85
|
+
files:
|
95
86
|
- .gitignore
|
96
87
|
- .ruby-version
|
88
|
+
- .travis.yml
|
97
89
|
- Gemfile
|
98
90
|
- LICENSE
|
99
91
|
- README.md
|
@@ -125,43 +117,33 @@ files:
|
|
125
117
|
- spec/mirror_spec.rb
|
126
118
|
- spec/operations_spec.rb
|
127
119
|
- spec/test_helper.rb
|
128
|
-
has_rdoc: true
|
129
120
|
homepage: http://evil.che.lu/projects/braid
|
130
121
|
licenses: []
|
131
|
-
|
132
122
|
post_install_message:
|
133
|
-
rdoc_options:
|
123
|
+
rdoc_options:
|
134
124
|
- --line-numbers
|
135
125
|
- --inline-source
|
136
126
|
- --title
|
137
127
|
- braid
|
138
128
|
- --main
|
139
|
-
require_paths:
|
129
|
+
require_paths:
|
140
130
|
- lib
|
141
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
142
132
|
none: false
|
143
|
-
requirements:
|
144
|
-
- -
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
|
147
|
-
|
148
|
-
- 0
|
149
|
-
version: "0"
|
150
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
138
|
none: false
|
152
|
-
requirements:
|
153
|
-
- -
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
|
156
|
-
segments:
|
157
|
-
- 0
|
158
|
-
version: "0"
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
159
143
|
requirements: []
|
160
|
-
|
161
144
|
rubyforge_project: braid
|
162
|
-
rubygems_version: 1.
|
145
|
+
rubygems_version: 1.8.23
|
163
146
|
signing_key:
|
164
147
|
specification_version: 3
|
165
148
|
summary: A simple tool for tracking vendor branches in git.
|
166
149
|
test_files: []
|
167
|
-
|