suse-git-pulls 0.3.5 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/git-pulls +2 -0
  2. data/lib/git-pulls.rb +20 -3
  3. metadata +3 -4
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+
2
4
  $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
3
5
 
4
6
  require 'git-pulls'
@@ -36,7 +36,7 @@ class GitPulls
36
36
 
37
37
  def help
38
38
  puts "No command: #{@command}"
39
- puts "Try: update, list, show, merge, browse"
39
+ puts "Try: update, list, show, merge, browse, create"
40
40
  puts "or call with '-h' for usage information"
41
41
  end
42
42
 
@@ -47,6 +47,7 @@ Usage: git pulls update
47
47
  or: git pulls show <number> [--full]
48
48
  or: git pulls browse <number>
49
49
  or: git pulls merge <number>
50
+ or: git pulls create
50
51
  USAGE
51
52
  end
52
53
 
@@ -153,6 +154,20 @@ Usage: git pulls update
153
154
  list
154
155
  end
155
156
 
157
+ def create
158
+ repo = "#{@user}/#{@repo}"
159
+ to_branch = 'master'
160
+ from_branch = get_from_branch_title
161
+ title = 'my title'
162
+ body = 'my body'
163
+
164
+ Octokit.create_pull_request(repo, to_branch, from_branch, title, body)
165
+ end
166
+
167
+ def get_from_branch_title
168
+ git('branch', false).match(/\*(.*)/)[0][2..-1]
169
+ end
170
+
156
171
  def fetch_stale_forks
157
172
  puts "Checking for forks in need of fetching"
158
173
  pulls = get_pull_info
@@ -300,7 +315,9 @@ Usage: git pulls update
300
315
  [user, proj]
301
316
  end
302
317
 
303
- def git(command)
304
- `git #{command}`.chomp
318
+ def git(command, chomp=true)
319
+ s = `git #{command}`
320
+ s.chomp! if chomp
321
+ s
305
322
  end
306
323
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suse-git-pulls
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 5
10
- version: 0.3.5
8
+ - 4
9
+ version: "0.4"
11
10
  platform: ruby
12
11
  authors:
13
12
  - Cristian Messel, Dominik Bamberger