thor_subtree 0.0.1 → 0.0.2

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/bin/subtree ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "thor"
5
+
6
+
7
+ class Subtree < Thor
8
+ include Thor::Actions
9
+
10
+ # git remote add earbits_social git@github.com:earbits/earbits_social.git
11
+ # git fetch earbits_social
12
+ # git subtree add -P vendor/plugins/social --squash -m "adding vendor/plugins/social as subtree" earbits_social/master
13
+
14
+ desc "add REPO", "adds a repo to a sub module"
15
+ method_options :plugin => :string, :branch => :string
16
+ def add(repo)
17
+
18
+ branch_name = options[:branch] || parse_git(repo)
19
+ plugin_name = options[:plugin] || (branch_name =~ /^earbits_([a-zA-Z0-9_\-]+)/ && $1)
20
+
21
+
22
+ run "git remote add #{branch_name} #{repo}"
23
+ run "git fetch #{branch_name}"
24
+ run "git subtree add --squash --prefix=vendor/plugins/#{plugin_name} #{branch_name} master"
25
+ end
26
+
27
+
28
+ desc "pull BRANCH", "Updates a plugin sub module"
29
+ method_options :plugin => :string, :branch => :string
30
+ def pull(branch)
31
+ branch_name = options[:branch] || branch
32
+ plugin_name = options[:plugin] || (branch_name =~ /^earbits_([a-zA-Z0-9_\-]+)/ && $1)
33
+
34
+ run "git subtree pull --squash --prefix=vendor/plugins/#{plugin_name} #{branch_name} master"
35
+ end
36
+
37
+ desc "split BRANCH", "Splits changes to a plugin and pushes them to the upstream repo"
38
+ method_options :plugin => :string, :branch => :string, :since => :string
39
+ def split(branch)
40
+ branch_name = options[:branch] || branch
41
+ plugin_name = options[:plugin] || (branch_name =~ /^earbits_([a-zA-Z0-9_\-]+)/ && $1)
42
+ since_commit = options[:since] || ""
43
+
44
+
45
+ run "git subtree split --prefix=vendor/plugins/#{plugin_name} #{since_commit} --rejoin --branch #{branch_name}-master"
46
+ run "git push #{branch_name} #{branch_name}-master:master"
47
+ run "git branch -D #{branch_name}-master"
48
+
49
+ end
50
+
51
+ desc "extract BRANCH", "Extracts a plugin and pushes it to an upstream repo"
52
+ method_options :plugin => :string, :branch => :string, :since => :string
53
+ def extract(repo)
54
+ branch_name = options[:branch] || parse_git(repo)
55
+ plugin_name = options[:plugin] || (branch_name =~ /^earbits_([a-zA-Z0-9_\-]+)/ && $1)
56
+ since_commit = options[:since] || ""
57
+
58
+ run "git remote add #{branch_name} #{repo}"
59
+ run "git fetch #{branch_name}"
60
+
61
+ run "git subtree split --prefix=vendor/plugins/#{plugin_name} --branch #{branch_name}-master"
62
+ run "git push #{branch_name} #{branch_name}-master:master"
63
+ run "git branch -D #{branch_name}-master"
64
+
65
+ end
66
+
67
+
68
+
69
+
70
+ private
71
+
72
+ def parse_git(amazon_url)
73
+ if amazon_url =~ /git@github.com\:[a-zA-Z0-9_\-]*\/([a-zA-Z0-9_\-]+)\.git/
74
+ return $1
75
+ else
76
+ return nil
77
+ end
78
+ end
79
+ end
80
+
81
+ Subtree.start
data/thor_subtree.gemspec CHANGED
@@ -1,14 +1,16 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "thor_subtree/version"
4
2
 
5
3
  Gem::Specification.new do |s|
6
4
  s.name = "thor_subtree"
7
- s.version = ThorSubtree::VERSION
5
+ s.version = "0.0.2"
6
+
7
+
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Benjamin Bryant"]
10
10
  s.email = [""]
11
+ s.default_executable = %q{subtree}
11
12
  s.homepage = ""
13
+ s.executables = ["subtree"]
12
14
  s.summary = %q{thor scripts}
13
15
  s.description = %q{for managing git subtree}
14
16
 
@@ -17,7 +19,7 @@ Gem::Specification.new do |s|
17
19
  s.files = `git ls-files`.split("\n")
18
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
21
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
- s.require_paths = ["lib"]
22
+ s.require_paths = ["bin"]
21
23
 
22
24
  s.add_dependency("thor")
23
25
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thor_subtree
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benjamin Bryant
@@ -16,7 +16,7 @@ bindir: bin
16
16
  cert_chain: []
17
17
 
18
18
  date: 2011-02-22 00:00:00 -08:00
19
- default_executable:
19
+ default_executable: subtree
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: thor
@@ -35,8 +35,8 @@ dependencies:
35
35
  description: for managing git subtree
36
36
  email:
37
37
  - ""
38
- executables: []
39
-
38
+ executables:
39
+ - subtree
40
40
  extensions: []
41
41
 
42
42
  extra_rdoc_files: []
@@ -46,9 +46,7 @@ files:
46
46
  - Gemfile
47
47
  - Gemfile.lock
48
48
  - Rakefile
49
- - lib/task/app.rb
50
- - lib/thor_subtree.rb
51
- - lib/thor_subtree/version.rb
49
+ - bin/subtree
52
50
  - thor_subtree.gemspec
53
51
  has_rdoc: true
54
52
  homepage: ""
@@ -58,7 +56,7 @@ post_install_message:
58
56
  rdoc_options: []
59
57
 
60
58
  require_paths:
61
- - lib
59
+ - bin
62
60
  required_ruby_version: !ruby/object:Gem::Requirement
63
61
  none: false
64
62
  requirements:
data/lib/task/app.rb DELETED
@@ -1,6 +0,0 @@
1
- class App < Thor
2
- desc "test APP_NAME", "install one of the available apps"
3
- def test(name)
4
- puts name
5
- end
6
- end
@@ -1,3 +0,0 @@
1
- module ThorSubtree
2
- VERSION = "0.0.1"
3
- end
data/lib/thor_subtree.rb DELETED
@@ -1,3 +0,0 @@
1
- module ThorSubtree
2
- # Your code goes here...
3
- end