braid 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/braid.gemspec CHANGED
@@ -1,17 +1,17 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{braid}
3
- s.version = "0.6.1"
3
+ s.version = "0.6.2"
4
4
 
5
5
  s.specification_version = 2 if s.respond_to? :specification_version=
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Cristi Balan", "Norbert Crombach"]
9
- s.date = %q{2008-10-29}
9
+ s.date = %q{2010-07-19}
10
10
  s.default_executable = %q{braid}
11
11
  s.description = %q{A simple tool for tracking vendor branches in git.}
12
12
  s.email = %q{evil@che.lu}
13
13
  s.executables = ["braid"]
14
- s.files = ["bin/braid", "braid.gemspec", "lib/braid/command.rb", "lib/braid/commands/add.rb", "lib/braid/commands/diff.rb", "lib/braid/commands/remove.rb", "lib/braid/commands/setup.rb", "lib/braid/commands/update.rb", "lib/braid/config.rb", "lib/braid/mirror.rb", "lib/braid/operations.rb", "lib/braid.rb", "lib/core_ext.rb", "LICENSE", "Rakefile", "README.textile", "test/braid_test.rb", "test/config_test.rb", "test/fixtures/shiny/README", "test/fixtures/skit1/layouts/layout.liquid", "test/fixtures/skit1/preview.png", "test/fixtures/skit1.1/layouts/layout.liquid", "test/fixtures/skit1.2/layouts/layout.liquid", "test/integration/adding_test.rb", "test/integration/updating_test.rb", "test/integration_helper.rb", "test/mirror_test.rb", "test/operations_test.rb", "test/test_helper.rb"]
14
+ s.files = ["bin/braid", "braid.gemspec", "lib/braid/command.rb", "lib/braid/commands/add.rb", "lib/braid/commands/diff.rb", "lib/braid/commands/push.rb", "lib/braid/commands/remove.rb", "lib/braid/commands/setup.rb", "lib/braid/commands/update.rb", "lib/braid/config.rb", "lib/braid/mirror.rb", "lib/braid/operations.rb", "lib/braid.rb", "lib/core_ext.rb", "LICENSE", "Rakefile", "README.textile", "test/braid_test.rb", "test/config_test.rb", "test/fixtures/shiny/README", "test/fixtures/skit1/layouts/layout.liquid", "test/fixtures/skit1/preview.png", "test/fixtures/skit1.1/layouts/layout.liquid", "test/fixtures/skit1.2/layouts/layout.liquid", "test/integration/adding_test.rb", "test/integration/updating_test.rb", "test/integration_helper.rb", "test/mirror_test.rb", "test/operations_test.rb", "test/test_helper.rb"]
15
15
  s.has_rdoc = false
16
16
  s.homepage = %q{http://evil.che.lu/projects/braid}
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "braid", "--main"]
@@ -20,6 +20,6 @@ Gem::Specification.new do |s|
20
20
  s.rubygems_version = %q{1.1.0}
21
21
  s.summary = %q{A simple tool for tracking vendor branches in git.}
22
22
 
23
- s.add_dependency(%q<main>, [">= 3.0.0"])
24
- s.add_dependency(%q<open4>, [">= 0.9.6"])
23
+ s.add_dependency(%q<main>, [">= 4.2.0"])
24
+ s.add_dependency(%q<open4>, [">= 1.0.1"])
25
25
  end
data/lib/braid.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  $:.unshift dirname = File.dirname(__FILE__)
2
2
 
3
3
  module Braid
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
 
6
6
  CONFIG_FILE = ".braids"
7
7
  REQUIRED_GIT_VERSION = "1.6"
@@ -0,0 +1,48 @@
1
+ require 'fileutils'
2
+ require 'tmpdir'
3
+
4
+ module Braid
5
+ module Commands
6
+ class Push < Command
7
+ def run(path, options = {})
8
+ mirror = config.get!(path)
9
+
10
+ #mirror.fetch
11
+
12
+ base_revision = git.rev_parse(mirror.remote)
13
+ unless mirror.merged?(base_revision)
14
+ msg "Mirror is not up to date. Stopping."
15
+ return
16
+ end
17
+
18
+ diff = mirror.diff
19
+ if diff.empty?
20
+ msg "No local changes found. Stopping."
21
+ return
22
+ end
23
+
24
+ clone_dir = Dir.tmpdir + "/braid_push.#{$$}"
25
+ Dir.mkdir(clone_dir)
26
+ source_dir = Dir.pwd
27
+ remote_url = git.remote_url(mirror.remote)
28
+ if remote_url == mirror.cached_url
29
+ remote_url = mirror.url
30
+ elsif File.directory?(remote_url)
31
+ remote_url = File.expand_path(remote_url)
32
+ end
33
+ Dir.chdir(clone_dir) do
34
+ msg "Cloning mirror with local changes."
35
+ git.init
36
+ git.fetch(source_dir)
37
+ git.fetch(remote_url)
38
+ git.checkout(base_revision)
39
+ git.apply(diff)
40
+ system("git commit -v")
41
+ msg "Pushing changes to remote."
42
+ git.push(remote_url, "HEAD:#{mirror.branch}")
43
+ end
44
+ FileUtils.rm_r(clone_dir)
45
+ end
46
+ end
47
+ end
48
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braid
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 3
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 6
8
- - 1
9
- version: 0.6.1
9
+ - 2
10
+ version: 0.6.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Cristi Balan
@@ -15,35 +16,39 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2008-10-29 00:00:00 +01:00
19
+ date: 2010-07-19 00:00:00 +02:00
19
20
  default_executable: braid
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
23
  name: main
23
24
  prerelease: false
24
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
25
27
  requirements:
26
28
  - - ">="
27
29
  - !ruby/object:Gem::Version
30
+ hash: 55
28
31
  segments:
29
- - 3
32
+ - 4
33
+ - 2
30
34
  - 0
31
- - 0
32
- version: 3.0.0
35
+ version: 4.2.0
33
36
  type: :runtime
34
37
  version_requirements: *id001
35
38
  - !ruby/object:Gem::Dependency
36
39
  name: open4
37
40
  prerelease: false
38
41
  requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
39
43
  requirements:
40
44
  - - ">="
41
45
  - !ruby/object:Gem::Version
46
+ hash: 21
42
47
  segments:
48
+ - 1
43
49
  - 0
44
- - 9
45
- - 6
46
- version: 0.9.6
50
+ - 1
51
+ version: 1.0.1
47
52
  type: :runtime
48
53
  version_requirements: *id002
49
54
  description: A simple tool for tracking vendor branches in git.
@@ -60,6 +65,7 @@ files:
60
65
  - lib/braid/command.rb
61
66
  - lib/braid/commands/add.rb
62
67
  - lib/braid/commands/diff.rb
68
+ - lib/braid/commands/push.rb
63
69
  - lib/braid/commands/remove.rb
64
70
  - lib/braid/commands/setup.rb
65
71
  - lib/braid/commands/update.rb
@@ -98,23 +104,27 @@ rdoc_options:
98
104
  require_paths:
99
105
  - lib
100
106
  required_ruby_version: !ruby/object:Gem::Requirement
107
+ none: false
101
108
  requirements:
102
109
  - - ">="
103
110
  - !ruby/object:Gem::Version
111
+ hash: 3
104
112
  segments:
105
113
  - 0
106
114
  version: "0"
107
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
+ none: false
108
117
  requirements:
109
118
  - - ">="
110
119
  - !ruby/object:Gem::Version
120
+ hash: 3
111
121
  segments:
112
122
  - 0
113
123
  version: "0"
114
124
  requirements: []
115
125
 
116
126
  rubyforge_project: braid
117
- rubygems_version: 1.3.6
127
+ rubygems_version: 1.3.7
118
128
  signing_key:
119
129
  specification_version: 2
120
130
  summary: A simple tool for tracking vendor branches in git.