socialcast-git-extensions 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,52 +1,51 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'socialcast-git-extensions')
|
1
2
|
require 'grit'
|
2
3
|
|
3
4
|
module Socialcast
|
4
5
|
module Git
|
5
6
|
include Socialcast::Gitx
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
branches << branch unless reserved_branches.include?(branch)
|
23
|
-
end
|
24
|
-
branches
|
25
|
-
end
|
26
|
-
def reset_branch(branch, head_branch = 'master')
|
27
|
-
return if branch == head_branch
|
28
|
-
run_cmd "git checkout #{head_branch}"
|
29
|
-
run_cmd "git pull"
|
30
|
-
run_cmd "git branch -D #{branch}" rescue nil
|
31
|
-
run_cmd "git push origin :#{branch}" rescue nil
|
32
|
-
run_cmd "git checkout -b #{branch}"
|
33
|
-
run_cmd "grb publish #{branch}"
|
34
|
-
run_cmd "git checkout #{head_branch}"
|
8
|
+
def current_branch
|
9
|
+
repo = Grit::Repo.new(Dir.pwd)
|
10
|
+
Grit::Head.current(repo).name
|
11
|
+
end
|
12
|
+
def branches(options = {})
|
13
|
+
branches = []
|
14
|
+
reserved_branches = %w{ HEAD master last_known_good_master staging last_known_good_staging next_release last_known_good_next_release }
|
15
|
+
args = []
|
16
|
+
args << '-r' if options[:remote]
|
17
|
+
args << '--merged' if options[:merged]
|
18
|
+
output = `git branch #{args.join(' ')}`.split("\n")
|
19
|
+
output.each do |branch|
|
20
|
+
branch = branch.gsub(/\*/, '').strip.split(' ').first
|
21
|
+
branch = branch.split('/').last if options[:remote]
|
22
|
+
branches << branch unless reserved_branches.include?(branch)
|
35
23
|
end
|
24
|
+
branches
|
25
|
+
end
|
26
|
+
def reset_branch(branch, head_branch = 'master')
|
27
|
+
return if branch == head_branch
|
28
|
+
run_cmd "git checkout #{head_branch}"
|
29
|
+
run_cmd "git pull"
|
30
|
+
run_cmd "git branch -D #{branch}" rescue nil
|
31
|
+
run_cmd "git push origin :#{branch}" rescue nil
|
32
|
+
run_cmd "git checkout -b #{branch}"
|
33
|
+
run_cmd "grb publish #{branch}"
|
34
|
+
run_cmd "git checkout #{head_branch}"
|
35
|
+
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
44
|
-
run_cmd "git checkout #{destination_branch}"
|
45
|
-
run_cmd "git pull . #{branch}"
|
46
|
-
run_cmd "git push origin HEAD"
|
47
|
-
|
48
|
-
run_cmd "git checkout #{branch}"
|
37
|
+
def integrate(branch, destination_branch = 'staging')
|
38
|
+
HighLine.say "integrating <%= color('#{branch}', :green) %> into <%= color('#{destination_branch}', :green) %>"
|
39
|
+
run_cmd "git remote prune origin"
|
40
|
+
unless destination_branch == 'master'
|
41
|
+
run_cmd "git branch -D #{destination_branch}" rescue nil
|
42
|
+
run_cmd "grb track #{destination_branch}"
|
49
43
|
end
|
44
|
+
run_cmd "git checkout #{destination_branch}"
|
45
|
+
run_cmd "git pull . #{branch}"
|
46
|
+
run_cmd "git push origin HEAD"
|
47
|
+
|
48
|
+
run_cmd "git checkout #{branch}"
|
50
49
|
end
|
51
50
|
end
|
52
51
|
end
|
@@ -3,12 +3,10 @@ require 'json'
|
|
3
3
|
|
4
4
|
module Socialcast
|
5
5
|
module Github
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
url = data['html_url']
|
11
|
-
end
|
6
|
+
def create_pull_request(username, password, branch)
|
7
|
+
response = RestClient.post "https://#{username}:#{password}@api.github.com/repos/socialcast/socialcast/pulls", {:title => branch, :base => 'master', :head => branch}.to_json, :accept => :json, :content_type => :json
|
8
|
+
data = JSON.parse response.body
|
9
|
+
url = data['html_url']
|
12
10
|
end
|
13
11
|
end
|
14
12
|
end
|
@@ -4,17 +4,15 @@ require 'socialcast-git-extensions/github'
|
|
4
4
|
|
5
5
|
module Socialcast
|
6
6
|
module Gitx
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
run_cmd cmd
|
17
|
-
end
|
7
|
+
def run_cmd(cmd)
|
8
|
+
HighLine.say "\n> <%= color('#{cmd.gsub("'", '')}', :red) %>"
|
9
|
+
raise "#{cmd} failed" unless system cmd
|
10
|
+
end
|
11
|
+
def share(message, url = nil)
|
12
|
+
return if ARGV.delete("--quiet") || ARGV.delete("-q")
|
13
|
+
cmd = "socialcast share '#{message}'"
|
14
|
+
cmd += " --url #{url}" if url
|
15
|
+
run_cmd cmd
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socialcast-git-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 2.2.
|
9
|
+
- 3
|
10
|
+
version: 2.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Sonnek
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: grit
|
22
22
|
prerelease: false
|
23
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
@@ -29,12 +29,12 @@ dependencies:
|
|
29
29
|
segments:
|
30
30
|
- 0
|
31
31
|
version: "0"
|
32
|
-
requirement: *id001
|
33
32
|
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: git_remote_branch
|
36
36
|
prerelease: false
|
37
|
-
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
38
|
none: false
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
@@ -43,12 +43,12 @@ dependencies:
|
|
43
43
|
segments:
|
44
44
|
- 0
|
45
45
|
version: "0"
|
46
|
-
requirement: *id002
|
47
46
|
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: highline
|
50
50
|
prerelease: false
|
51
|
-
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ">="
|
@@ -57,12 +57,12 @@ dependencies:
|
|
57
57
|
segments:
|
58
58
|
- 0
|
59
59
|
version: "0"
|
60
|
-
requirement: *id003
|
61
60
|
type: :runtime
|
61
|
+
version_requirements: *id003
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: socialcast
|
64
64
|
prerelease: false
|
65
|
-
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
68
68
|
- - ">="
|
@@ -73,12 +73,12 @@ dependencies:
|
|
73
73
|
- 3
|
74
74
|
- 4
|
75
75
|
version: 0.3.4
|
76
|
-
requirement: *id004
|
77
76
|
type: :runtime
|
77
|
+
version_requirements: *id004
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: rest-client
|
80
80
|
prerelease: false
|
81
|
-
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
82
|
none: false
|
83
83
|
requirements:
|
84
84
|
- - ">="
|
@@ -89,12 +89,12 @@ dependencies:
|
|
89
89
|
- 4
|
90
90
|
- 0
|
91
91
|
version: 1.4.0
|
92
|
-
requirement: *id005
|
93
92
|
type: :runtime
|
93
|
+
version_requirements: *id005
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: json_pure
|
96
96
|
prerelease: false
|
97
|
-
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
99
99
|
requirements:
|
100
100
|
- - ">="
|
@@ -103,12 +103,12 @@ dependencies:
|
|
103
103
|
segments:
|
104
104
|
- 0
|
105
105
|
version: "0"
|
106
|
-
requirement: *id006
|
107
106
|
type: :runtime
|
107
|
+
version_requirements: *id006
|
108
108
|
- !ruby/object:Gem::Dependency
|
109
109
|
name: rake
|
110
110
|
prerelease: false
|
111
|
-
|
111
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
112
112
|
none: false
|
113
113
|
requirements:
|
114
114
|
- - "="
|
@@ -119,8 +119,8 @@ dependencies:
|
|
119
119
|
- 9
|
120
120
|
- 2
|
121
121
|
version: 0.9.2
|
122
|
-
requirement: *id007
|
123
122
|
type: :development
|
123
|
+
version_requirements: *id007
|
124
124
|
description: GIT it done!
|
125
125
|
email:
|
126
126
|
- ryan@socialcast.com
|
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
requirements: []
|
197
197
|
|
198
198
|
rubyforge_project: socialcast-git-extensions
|
199
|
-
rubygems_version: 1.8.
|
199
|
+
rubygems_version: 1.8.10
|
200
200
|
signing_key:
|
201
201
|
specification_version: 3
|
202
202
|
summary: git extension scripts for socialcast workflow
|