braid 0.7.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -1
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +7 -0
  5. data/CONTRIBUTING.md +26 -0
  6. data/Gemfile +1 -2
  7. data/LICENSE +3 -1
  8. data/README.md +90 -51
  9. data/Rakefile +6 -14
  10. data/bin/braid +9 -37
  11. data/braid.gemspec +11 -11
  12. data/lib/braid.rb +13 -12
  13. data/lib/braid/command.rb +9 -42
  14. data/lib/braid/commands/add.rb +6 -8
  15. data/lib/braid/commands/list.rb +11 -6
  16. data/lib/braid/commands/push.rb +5 -5
  17. data/lib/braid/commands/remove.rb +1 -3
  18. data/lib/braid/commands/setup.rb +4 -8
  19. data/lib/braid/commands/update.rb +12 -14
  20. data/lib/braid/config.rb +38 -43
  21. data/lib/braid/mirror.rb +19 -63
  22. data/lib/braid/operations.rb +51 -90
  23. data/lib/braid/version.rb +1 -1
  24. data/{test/config_test.rb → spec/config_spec.rb} +14 -17
  25. data/{test → spec}/fixtures/shiny/README +0 -0
  26. data/{test → spec}/fixtures/skit1.1/layouts/layout.liquid +0 -0
  27. data/{test → spec}/fixtures/skit1.2/layouts/layout.liquid +0 -0
  28. data/{test → spec}/fixtures/skit1/layouts/layout.liquid +0 -0
  29. data/{test → spec}/fixtures/skit1/preview.png +0 -0
  30. data/spec/integration/adding_spec.rb +43 -0
  31. data/{test/integration/updating_test.rb → spec/integration/updating_spec.rb} +2 -41
  32. data/spec/integration_helper.rb +47 -0
  33. data/{test/mirror_test.rb → spec/mirror_spec.rb} +6 -33
  34. data/{test/operations_test.rb → spec/operations_spec.rb} +2 -2
  35. data/{test → spec}/test_helper.rb +6 -2
  36. metadata +86 -123
  37. data/lib/core_ext.rb +0 -13
  38. data/test/braid_test.rb +0 -7
  39. data/test/integration/adding_test.rb +0 -80
  40. data/test/integration_helper.rb +0 -70
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7df51db130d90c8981f291576c229352aa01ab7f
4
+ data.tar.gz: 1306a0ac5f768a442cce4c6d3ed21b64f1994f28
5
+ SHA512:
6
+ metadata.gz: 8a15d53e0873009b3c70b0d553d1e8d9f76887ad01a0b66062af19e6223f7ba7e704b07c3d1ed9a22277197f8a39e88a53d9054419751804affef1a8631aaf9d
7
+ data.tar.gz: 89750c09fe1a371e247fcf24fb9ecaa245e8d4ab28ad3e4e040d29e67c892114476045aa3c2898afcbee36df0f11a6d126930e1cdc4abe7a6810e51c0d00c87b
data/.gitignore CHANGED
@@ -4,9 +4,12 @@
4
4
  .DS_Store
5
5
  .bundle
6
6
  .idea
7
- Gemfile.lock
8
7
  coverage
9
8
  nbproject
10
9
  pkg
11
10
  pkg/*
12
11
  rdoc
12
+ /*.iml
13
+ /*.ipr
14
+ /*.iws
15
+ /Gemfile.lock
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.3
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - jruby-19mode
5
+ - jruby-18mode
6
+ git:
7
+ depth: 10
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,26 @@
1
+ # How to Contribute
2
+
3
+ Pull requests are greatly appreciated and are what makes opensource great. Here's a quick guide:
4
+
5
+ * Fork it
6
+ * Create your feature branch (`git checkout -b my-new-feature`)
7
+ * Commit your changes (`git commit -am 'Add some feature'`)
8
+ * Push to the branch (`git push origin my-new-feature`)
9
+ * Create new Pull Request
10
+
11
+ Pester us if we don't get your Pull Requests merged in a timely fashion. :)
12
+
13
+ ## How to speed the merging of pull requests
14
+
15
+ * Describe your changes in the CHANGELOG.
16
+ * Give yourself some credit in the appropriate place (usually the CHANGELOG).
17
+ * Make commits of logical units.
18
+ * Ensure your commit messages help others understand what you are doing and why.
19
+ * Check for unnecessary whitespace with `git diff --check` before committing.
20
+ * Maintain the same code style.
21
+ * Maintain the same level of test coverage or improve it.
22
+
23
+ ## Additional Resources
24
+
25
+ * [General GitHub documentation](http://help.github.com/)
26
+ * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
data/Gemfile CHANGED
@@ -1,6 +1,5 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
5
  gem 'rake'
6
-
data/LICENSE CHANGED
@@ -1,4 +1,6 @@
1
- Copyright (c) 2007-2010 Cristi Balan, Norbert Crombach
1
+ Copyright (c) 2007-2008 Cristi Balan
2
+ Copyright (c) 2008-2015 Norbert Crombach
3
+ Copyright (c) 2013-2015 Peter Donald
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,32 +1,59 @@
1
1
  # Braid
2
2
 
3
- Braid is a simple tool to help track git and svn vendor branches in a git repository.
3
+ Braid is a simple tool to help track vendor branches in a
4
+ [Git](http://git-scm.com/) repository.
4
5
 
5
- The project homepage is [here](http://github.com/evilchelu/braid/wikis/home).
6
+ ## Motivation
6
7
 
7
- ## Requirements
8
+ Vendoring allows you take the source code of an external library and ensure it's
9
+ version controlled along with the main project. This is in contrast to including
10
+ a reference to a packaged version of an external library that is available in a
11
+ binary artifact repository such as Maven Central, RubyGems or NPM.
8
12
 
9
- * git 1.6+ (and git-svn if you want to mirror svn repositories)
10
- * main >= 4.2.0
11
- * open4 >= 1.0.1 (unless using jruby)
13
+ Vendoring is useful when you need to patch or customize the external libraries
14
+ or the external library is expected to co-evolve with the main project. The
15
+ developer can make changes to the main project and patch the library in a single
16
+ commit.
12
17
 
13
- ## Installing using rubygems - official releases
18
+ The problem arises when the external library makes changes that you want to
19
+ integrate into your local vendored version or the developer makes changes to the
20
+ local version that they want integrated into the external library.
14
21
 
15
- gem install braid
22
+ A typical "implementation" of vendoring is to simply download or checkout the
23
+ source for the external library, remove the `.git` or `.svn` directories and
24
+ commit it to the main source tree. However this approach makes it very difficult
25
+ to update the library. When you want to update the library do you re-apply your
26
+ local changes onto a new copy of the vendored library or do you re-apply the
27
+ changes from the external library to local version? Both cases involve manual
28
+ generation and application of patch files to source trees.
29
+
30
+ This is where Braid comes into play. Braid makes it easy to vendor in remote git
31
+ repositories and use an automated mechanism for updating the external library
32
+ and generating patches to upgrade the external library.
33
+
34
+ Braid creates a file `.braids` in the root of your repository that contains
35
+ references to external libraries or mirrors. There are two types of mirrors in
36
+ Braid: squashed and full. Mirrors are squashed by default, which is what you'll
37
+ generally want because they're faster and don't pollute your history with
38
+ commits from the mirrors.
16
39
 
17
- ## Installing from source
40
+ Full mirrors are useful when you want to view imported history in your own
41
+ project. You usually want this if the mirror is also a repository you have
42
+ access to, for example, when using shared code across projects.
18
43
 
19
- git clone git://github.com/evilchelu/braid.git
20
- cd braid
21
- bundle install
22
- rake install # possibly requiring sudo
44
+ Please note that you cannot change between mirror types after the initial add.
45
+ You'll have to remove the mirror and add it again.
46
+
47
+ ## Installation
48
+
49
+ gem install braid
23
50
 
24
51
  ## Quick usage - ruby project
25
52
 
26
- Let's assume we're writing something like gitnub that needs grit in lib/grit. Initialize the repo (nothing braid related here):
53
+ Let's assume we're writing the project `myproject` that needs grit in lib/grit. Initialize the repo (nothing braid related here):
27
54
 
28
- git init gritty
29
- cd gritty
55
+ git init myproject
56
+ cd myproject
30
57
  touch README
31
58
  git add README
32
59
  git commit -m "initial commit"
@@ -37,71 +64,83 @@ Now let's vendor grit:
37
64
 
38
65
  And you're done! Braid vendored grit into lib/grit. Feel free to inspect the changes with git log or git show.
39
66
 
40
- If further down the line, you want to bring new changes from grit in your repository, just update the mirror:
67
+ If further down the line, you want to bring new changes from grit into your repository, just update the mirror:
41
68
 
42
69
  braid update lib/grit
43
70
 
44
- ## Quick usage - rails project
71
+ If you make changes to the grit library and want to generate a patch file so that you can submit the patch file
72
+ to the grit project:
45
73
 
46
- Let's assume you want to start a new rails app called shiny. Initialize the repo (nothing braid related here):
74
+ braid diff lib/grit > grit.patch
47
75
 
48
- git init shiny
49
- cd shiny
50
- touch README
51
- git add README
52
- git commit -m "initial commit"
76
+ Once those changes have been applied to grit you probably want to update your local version of grit again.
53
77
 
54
- Vendor rails (this might take a while because the rails repo is huge!):
78
+ braid update lib/grit
55
79
 
56
- braid add git://github.com/rails/rails.git vendor/rails
80
+ ## More usage
57
81
 
58
- Create your new rails app (nothing braid related here):
82
+ Use the built in help system to find out about all commands and options:
83
+
84
+ braid help
85
+ braid help add # or braid add --help
86
+
87
+ ### Examples
59
88
 
60
- ruby vendor/rails/railties/bin/rails .
61
- git add .
62
- git commit -m "rails ."
89
+ #### Adding a mirror
63
90
 
64
- Add any plugins you might need:
91
+ braid add git://github.com/rails/rails.git vendor/rails
65
92
 
66
- braid add git://github.com/thoughtbot/shoulda.git -p
67
- braid add git://github.com/thoughtbot/factory_girl.git -p
68
- braid add git://github.com/mbleigh/subdomain-fu.git -p
93
+ #### Adding mirrors with revisions
69
94
 
70
- And you're done! Braid vendored rails and your plugins. Feel free to inspect the changes with git log or git show.
95
+ braid add --revision bf1b1e0 git://github.com/rails/rails.git vendor/rails
71
96
 
72
- If further down the line, you want to bring new changes from rails in your repository, just update the mirror:
97
+ #### Adding mirrors with full history
73
98
 
74
- braid update vendor/rails
99
+ braid add --full git://github.com/mislav/will_paginate.git vendor/plugins/will_paginate
75
100
 
76
- Or, if you want all mirrors updated:
101
+ #### Updating mirrors
77
102
 
103
+ # Update a specific mirror
104
+ braid update vendor/plugins/cache_fu
105
+ # Update all mirrors
78
106
  braid update
79
107
 
80
- ## More usage
108
+ #### Updating mirrors with conflicts
81
109
 
82
- Use the built in help system to find out about all commands and options:
110
+ If a braid update creates a conflict, braid will stop execution and leave the partially committed
111
+ files in your working copy, just like a normal git merge conflict would.
83
112
 
84
- braid help
85
- braid help add # or braid add --help
113
+ You will then have to resolve all conflicts and manually run `git commit`. The commit message is
114
+ already prepared.
115
+
116
+ If you want to cancel the braid update and the merge, you'll have to reset your working copy and
117
+ index with `git reset --hard`.
118
+
119
+ #### Locking and unlocking mirrors
86
120
 
87
- You may also want to read [Usage and examples](http://github.com/evilchelu/braid/wikis/usage-and-examples).
121
+ braid update --revision 6c1c16b vendor/rails
122
+ braid update --head vendor/rails
88
123
 
89
- ## Troubleshooting
124
+ #### Showing local changes made to mirrors
90
125
 
91
- Check [Troubleshooting](http://github.com/evilchelu/braid/wikis/troubleshooting) if you're having issues.
126
+ braid diff vendor/rails
92
127
 
93
128
  ## Contributing
94
129
 
95
- We appreciate any patches, error reports and usage ideas you may have. Please submit a lighthouse ticket or start a thread on the mailing list.
130
+ We appreciate any patches, error reports and usage ideas you may have. Please
131
+ submit an issue or pull request on GitHub.
96
132
 
97
- Bugs and feature requests: [braid project on lighthouse](http://evilchelu.lighthouseapp.com/projects/10600-braid)
133
+ ### Subversion
98
134
 
99
- Discussions and community support: [braid-gem google group](http://groups.google.com/group/braid-gem)
135
+ While preparing to release Braid v1.0 the support for subversion repositories was removed as
136
+ there was no active maintainers and inadequate test coverage. If there is anyone motivated to
137
+ re-add and maintain the Subversion support, please contact the authors.
100
138
 
101
- ## Authors
139
+ # Authors
102
140
 
103
- * Cristi Balan (evilchelu)
104
- * Norbert Crombach (norbert)
141
+ * Cristi Balan
142
+ * Norbert Crombach
143
+ * Peter Donald
105
144
 
106
145
  ## Contributors (alphabetically)
107
146
 
data/Rakefile CHANGED
@@ -2,19 +2,11 @@ require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
4
  require 'rake'
5
- require 'rake/testtask'
6
-
7
- task :default => :test
8
-
9
- def test_task(name, pattern)
10
- Rake::TestTask.new(name) do |t|
11
- ENV['TESTOPTS'] = '--runner=s'
12
-
13
- t.libs << 'lib'
14
- t.pattern = pattern
15
- t.verbose = true
16
- end
5
+ require 'rspec/core/rake_task'
6
+ desc 'Run all specs'
7
+ RSpec::Core::RakeTask.new :spec do |task|
8
+ task.rspec_opts = %w{--backtrace}
17
9
  end
18
10
 
19
- test_task(:test, "test/*_test.rb")
20
- namespace(:test) { test_task(:integration, "test/integration/*_test.rb") }
11
+ desc "Test and package the gem"
12
+ task :default => [:spec, :build]
data/bin/braid CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
3
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
4
4
  require 'braid'
5
5
 
6
6
  require 'rubygems'
@@ -12,7 +12,7 @@ Home = File.expand_path(ENV['HOME'] || '~')
12
12
  # main kicks ass!
13
13
  Main {
14
14
  description <<-TXT
15
- braid is a simple tool to help track git or svn repositories inside a git repository.
15
+ braid is a simple tool to help track git repositories inside a git repository.
16
16
 
17
17
  Run 'braid commandname help' for more details.
18
18
 
@@ -25,16 +25,9 @@ Main {
25
25
  Add a new mirror to be tracked.
26
26
 
27
27
  * adds metadata about the mirror to .braids
28
- * adds the git or git svn remotes to .git/config
28
+ * adds the git remotes to .git/config
29
29
  * fetches and merges remote code into given directory
30
30
 
31
- --type defaults:
32
-
33
- * svn://path # => svn
34
- * git://path # => git
35
- * http://path/trunk # => svn
36
- * http://path.git # => git
37
-
38
31
  Name defaults:
39
32
 
40
33
  * remote/path # => path
@@ -43,19 +36,15 @@ Main {
43
36
  TXT
44
37
 
45
38
  examples <<-TXT
46
- . braid add svn://remote/path
47
- . braid add svn://remote/path local/dir
48
- . braid add git://remote/path local/dir
49
39
  . braid add http://remote/path.git local/dir
50
- . braid add http://remote/path --type git local/dir
51
- . braid add svn://remote/path --branch notmaster
40
+ . braid add http://remote/path local/dir
52
41
  TXT
53
42
 
54
- mixin :argument_url, :option_type, :optional_path, :option_branch, :option_rails_plugin, :option_revision, :option_full, :option_verbose
43
+ mixin :argument_url, :optional_path, :option_branch, :option_revision, :option_full, :option_verbose
55
44
 
56
45
  run {
57
46
  Braid.verbose = verbose
58
- Braid::Command.run(:add, url, {"type" => type, "path" => path, "branch" => branch, "rails_plugin" => rails_plugin, "revision" => revision, "full" => full})
47
+ Braid::Command.run(:add, url, {'path' => path, 'branch' => branch, 'revision' => revision, 'full' => full})
59
48
  }
60
49
  }
61
50
 
@@ -79,7 +68,7 @@ Main {
79
68
 
80
69
  run {
81
70
  Braid.verbose = verbose
82
- Braid::Command.run(:update, path, {"revision" => revision, "head" => head})
71
+ Braid::Command.run(:update, path, {'revision' => revision, 'head' => head})
83
72
  }
84
73
  }
85
74
 
@@ -89,7 +78,7 @@ Main {
89
78
 
90
79
  * removes metadata from .braids
91
80
  * removes the local directory and commits the removal
92
- * removes the git remote by default, --keep can be used to supress that
81
+ * removes the git remote by default, --keep can be used to suppress that
93
82
  TXT
94
83
 
95
84
  examples <<-TXT
@@ -134,7 +123,7 @@ Main {
134
123
 
135
124
  mode(:setup) {
136
125
  description <<-TXT
137
- Set up git and git-svn remotes.
126
+ Set up git remotes.
138
127
  TXT
139
128
 
140
129
  mixin :optional_path, :option_verbose, :option_force
@@ -184,15 +173,6 @@ Main {
184
173
  }
185
174
  }
186
175
 
187
- mixin(:option_type) {
188
- option(:type, :t) {
189
- optional
190
- argument :required
191
- desc 'mirror type'
192
- attr
193
- }
194
- }
195
-
196
176
  mixin(:option_branch) {
197
177
  option(:branch, :b) {
198
178
  optional
@@ -202,14 +182,6 @@ Main {
202
182
  }
203
183
  }
204
184
 
205
- mixin(:option_rails_plugin) {
206
- option(:rails_plugin, :p) {
207
- optional
208
- desc 'added mirror is a Rails plugin'
209
- attr
210
- }
211
- }
212
-
213
185
  mixin(:option_revision) {
214
186
  option(:revision, :r) {
215
187
  optional
data/braid.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
2
+ $:.push File.expand_path('../lib', __FILE__)
3
3
  require 'braid/version'
4
4
 
5
5
  Gem::Specification.new do |s|
@@ -7,27 +7,27 @@ Gem::Specification.new do |s|
7
7
  s.version = Braid::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
9
 
10
- s.authors = ["Cristi Balan", "Norbert Crombach"]
11
- s.email = %q{evil@che.lu}
10
+ s.authors = ['Cristi Balan', 'Norbert Crombach', 'Peter Donald']
11
+ s.email = %q{evil@che.lu norbert.crombach@primetheory.org peter@realityforge.org}
12
12
 
13
- s.homepage = %q{http://evil.che.lu/projects/braid}
13
+ s.homepage = %q{https://github.com/cristibalan/braid}
14
14
  s.summary = %q{A simple tool for tracking vendor branches in git.}
15
15
  s.description = %q{A simple tool for tracking vendor branches in git.}
16
16
 
17
17
  s.rubyforge_project = %q{braid}
18
18
 
19
19
  s.files = `git ls-files`.split("\n")
20
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.test_files = `git ls-files -- {spec}/*`.split("\n")
21
21
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
22
22
  s.default_executable = %q{braid}
23
- s.require_paths = ["lib"]
23
+ s.require_paths = %w(lib)
24
24
 
25
25
  s.has_rdoc = false
26
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "braid", "--main"]
26
+ s.rdoc_options = %w(--line-numbers --inline-source --title braid --main)
27
27
 
28
- s.add_dependency(%q<main>, [">= 4.7.3"])
29
- s.add_dependency(%q<open4>, [">= 1.0.1"]) unless defined?(JRUBY_VERSION)
28
+ s.add_dependency(%q<main>, ['>= 4.7.3'])
29
+ s.add_dependency(%q<open4>, ['>= 1.0.1']) unless defined?(JRUBY_VERSION)
30
30
 
31
- s.add_development_dependency(%q<test-spec>, [">= 0.10.0"])
32
- s.add_development_dependency(%q<mocha>, [">= 0.9.11"])
31
+ s.add_development_dependency(%q<rspec>, ['= 2.12.0'])
32
+ s.add_development_dependency(%q<mocha>, ['>= 0.9.11'])
33
33
  end