pulley 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +1 -0
  2. data/bin/pulley +9 -2
  3. data/lib/pulley.rb +17 -0
  4. data/pulley.gemspec +2 -2
  5. metadata +4 -4
data/README.md CHANGED
@@ -14,6 +14,7 @@ the current directory, or the file `~/.pulley.yml` in the current user's home
14
14
  directory.
15
15
 
16
16
  An example ~/.pulley.yml:
17
+
17
18
  ---
18
19
  :username: xtoddx
19
20
  :password: topsecret
data/bin/pulley CHANGED
@@ -6,7 +6,14 @@ credentials = Pulley::Credentials.load
6
6
  if credentials.empty?
7
7
  abort "Set your credentials. See README at https://github.com/xtoddx/pulley"
8
8
  end
9
-
10
9
  client = Pulley::Github.new(credentials[:username], credentials[:password],
11
10
  credentials[:repository])
12
- Pulley::CLI.display_pull_requests(client.pull_requests)
11
+
12
+ if ARGV.delete('--publish')
13
+ require 'json'
14
+ text = STDIN.read
15
+ requests = JSON.parse(text)
16
+ Pulley::Publisher.new(client).publish_updates(requests)
17
+ else
18
+ Pulley::CLI.display_pull_requests(client.pull_requests)
19
+ end
@@ -45,6 +45,10 @@ module Pulley
45
45
  def pull_requests
46
46
  @connection.pull_requests(@repo)
47
47
  end
48
+
49
+ def update_pull_request number, title, body
50
+ @connection.update_pull_request(@repo, number, title, body)
51
+ end
48
52
  end
49
53
 
50
54
  class CLI
@@ -69,4 +73,17 @@ module Pulley
69
73
  end
70
74
  end
71
75
 
76
+ class Publisher
77
+ def initialize client
78
+ @client = client
79
+ end
80
+
81
+ def publish_updates reqs
82
+ reqs.each do |req|
83
+ next unless req['modified']
84
+ @client.update_pull_request(req['number'], req['title'], req['body'])
85
+ end
86
+ end
87
+ end
88
+
72
89
  end
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'pulley'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.date = '2012-12-11'
5
5
 
6
6
  s.summary = 'A CLI tool for working with Github Pull Requests'
7
- s.description = 'Pulley will turn pull requests into a json stream on STDOUT for piping through other programs, it can be piped back in with the --update flag to persist changes to github.'
7
+ s.description = 'Pulley will turn pull requests into a json stream on STDOUT for piping through other programs, it can be piped back in with the --publish flag to persist changes to github.'
8
8
 
9
9
  s.authors = ['Todd Willey (xtoddx)']
10
10
  s.email = 'xtoddx@gmail.com'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pulley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: octokit
16
- requirement: &70158929321820 !ruby/object:Gem::Requirement
16
+ requirement: &70215689950920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,9 +21,9 @@ dependencies:
21
21
  version: 1.19.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70158929321820
24
+ version_requirements: *70215689950920
25
25
  description: Pulley will turn pull requests into a json stream on STDOUT for piping
26
- through other programs, it can be piped back in with the --update flag to persist
26
+ through other programs, it can be piped back in with the --publish flag to persist
27
27
  changes to github.
28
28
  email: xtoddx@gmail.com
29
29
  executables: