hull 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/hull CHANGED
@@ -9,4 +9,4 @@ $:.unshift File.expand_path("../../lib", bin_file)
9
9
 
10
10
  # start up the CLI
11
11
  require "hull"
12
- Hull::Hull.new(*ARGV).run
12
+ puts Hull::Hull.new(*ARGV).run
@@ -5,9 +5,6 @@ require 'json'
5
5
  require 'grit'
6
6
  require 'hull/command'
7
7
  require 'hull/hull'
8
- require 'hull/list'
9
- require 'hull/help'
10
- require 'hull/show'
11
8
 
12
9
  module Hull
13
10
  end
@@ -1,6 +1,12 @@
1
+ require 'hull/list'
2
+ require 'hull/help'
3
+ require 'hull/show'
4
+
1
5
  module Hull
2
6
  class Command
3
7
 
8
+ private
9
+
4
10
  BASH_COLORS = {
5
11
  :reset => "0",
6
12
  :red => "31",
@@ -95,6 +101,25 @@ module Hull
95
101
  config["remote.#{remote}.url"].match(/^git@github.com:/)
96
102
  end
97
103
 
104
+ def self.help_title(title)
105
+ write(title, :cyan)
106
+ end
107
+
108
+ def self.help_hull
109
+ write('hull', :yellow)
110
+ end
111
+
112
+ def self.help_command(command)
113
+ write(command, :pink)
114
+ end
115
+
116
+ def self.help_number(number)
117
+ write(number, :purple)
118
+ end
119
+
120
+ def self.help_red(red)
121
+ write(red, :red)
122
+ end
98
123
  end
99
124
 
100
125
  class InvalidRepository < RuntimeError; end
@@ -1,28 +1,8 @@
1
1
  module Hull
2
- class Help < Command
3
- def self.title(title)
4
- write(title, :cyan)
5
- end
6
-
7
- def self.hull
8
- write('hull', :yellow)
9
- end
10
-
11
- def self.command(command)
12
- write(command, :pink)
13
- end
14
-
15
- def self.number(number)
16
- write(number, :purple)
17
- end
18
-
19
- def self.red(red)
20
- write(red, :red)
21
- end
22
-
2
+ class Command
23
3
  def self.help
24
4
  <<HELP
25
- #{title('### Setup')}
5
+ #{help_title('### Setup')}
26
6
 
27
7
  Config Github user name:
28
8
 
@@ -32,33 +12,33 @@ Config GitHub API key (https://github.com/account/admin):
32
12
 
33
13
  $ git config github.token <api_token>
34
14
 
35
- #{title('### Usage')}
15
+ #{help_title('### Usage')}
36
16
 
37
17
  This help doc:
38
18
 
39
- $ #{hull} #{command('help')}
19
+ $ #{help_hull} #{help_command('help')}
40
20
 
41
21
  List all pull requests for this project:
42
22
 
43
- $ #{hull} #{command('list')}
23
+ $ #{help_hull} #{help_command('list')}
44
24
 
45
25
  Show details about pull request number <number>:
46
26
 
47
- $ #{hull} #{command('show')} <#{number('number')}>
27
+ $ #{help_hull} #{help_command('show')} <#{help_number('number')}>
48
28
 
49
- #{title('### Unimplemented Features')}
29
+ #{help_title('### Unimplemented Features')}
50
30
 
51
31
  Check out the contents of pull request number <number> and switch to that branch:
52
32
 
53
- $ #{hull} <#{command('checkout')}|#{command('co')}|#{command('pull')}> <#{number('number')}>
33
+ $ #{help_hull} <#{help_command('checkout')}|#{help_command('co')}|#{help_command('pull')}> <#{help_number('number')}>
54
34
 
55
35
  Remove contents of pull request <number> that has been checked out:
56
36
 
57
- $ #{hull} <#{command('rm')}|#{command('remove')}|#{command('delete')}> <#{number('number')}>
37
+ $ #{help_hull} <#{help_command('rm')}|#{help_command('remove')}|#{help_command('delete')}> <#{help_number('number')}>
58
38
 
59
- #{title('### Why Hull?')}
39
+ #{help_title('### Why Hull?')}
60
40
 
61
- Originally it was called puller, but @natekross pushed a gem with the same name to rubygems.org, literally the day I started working on Hull. #{red("\x28\xe2\x95\xaf\xc2\xb0\xe2\x96\xa1\xc2\xb0\xef\xbc\x89\xe2\x95\xaf")}\xef\xb8\xb5\x20\xe2\x94\xbb\xe2\x94\x81\xe2\x94\xbb
41
+ Originally it was called puller, but @natekross pushed a gem with the same name to rubygems.org, literally the day I started working on Hull. #{help_red("\x28\xe2\x95\xaf\xc2\xb0\xe2\x96\xa1\xc2\xb0\xef\xbc\x89\xe2\x95\xaf")}\xef\xb8\xb5\x20\xe2\x94\xbb\xe2\x94\x81\xe2\x94\xbb
62
42
  HELP
63
43
  end
64
44
  end
@@ -9,15 +9,15 @@ module Hull
9
9
  def run
10
10
  case command
11
11
  when 'list'
12
- puts List.run
12
+ Command.list
13
13
  when 'show'
14
- puts Show.run(number)
14
+ Command.show(number)
15
15
  when 'pull', 'checkout', 'co'
16
- Pull.new(number)
16
+ Command.pull(number)
17
17
  when 'rm', 'remove', 'delete'
18
- Remove.new(number)
18
+ Command.remove(number)
19
19
  else
20
- puts Help.help
20
+ Command.help
21
21
  end
22
22
  end
23
23
 
@@ -1,6 +1,6 @@
1
1
  module Hull
2
- class List < Command
3
- def self.run
2
+ class Command
3
+ def self.list
4
4
  validate_config
5
5
  json = get_json(github_url)
6
6
  if json['error'].to_s != ''
@@ -1,6 +1,6 @@
1
1
  module Hull
2
- class Show < Command
3
- def self.run(number)
2
+ class Command
3
+ def self.show(number)
4
4
  validate_config
5
5
 
6
6
  url = github_url(number)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hull
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-20 00:00:00.000000000Z
12
+ date: 2012-01-30 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70337977483900 !ruby/object:Gem::Requirement
16
+ requirement: &70356749681420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70337977483900
24
+ version_requirements: *70356749681420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: grit
27
- requirement: &70337977483460 !ruby/object:Gem::Requirement
27
+ requirement: &70356749680980 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70337977483460
35
+ version_requirements: *70356749680980
36
36
  description: Code Review helper using GitHub's Pull Requests
37
37
  email: hc5duke@gmail.com
38
38
  executables: