hubmaster 0.0.05 → 0.0.06

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.
@@ -1,5 +1,6 @@
1
1
  module Github
2
2
  def self.connect
3
+ run_pager
3
4
  if File.exists? "#{Dir.home}/.hubmaster"
4
5
  content = []
5
6
  File.open("#{Dir.home}/.hubmaster", "rb") do |fileC|
@@ -11,7 +11,7 @@ module Github
11
11
 
12
12
  if response.kind_of?(Array)
13
13
  response.each do |repo|
14
- puts "#{repo['name']} (#{repo['url']})"
14
+ puts "#{repo['name']} (#{repo['ssh_url']})"
15
15
  puts " - Description: #{repo['description']}"
16
16
  puts " - Owner: #{repo['owner']['login']}"
17
17
  puts " - Language: #{repo['language']}"
@@ -48,7 +48,7 @@ module Github
48
48
  response = JSON.parse(request)
49
49
 
50
50
  if response["errors"].nil? && response["message"].nil?
51
- puts "Repository \"#{name}\" succesfully created! Hosted at: #{JSON.parse(request)["url"]}"
51
+ puts "Repository \"#{name}\" succesfully created! Hosted at: #{JSON.parse(request)["ssh_url"]}"
52
52
  elsif !response["errors"].nil?
53
53
  puts "ERROR: #{response['errors'][0]['message']}"
54
54
  elsif !response["message"].nil?
@@ -77,7 +77,7 @@ module Github
77
77
  response = JSON.parse(request)
78
78
 
79
79
  if response["errors"].nil? && response["message"].nil?
80
- puts "Repository \"#{name}\" succesfully edited! See updates at: #{JSON.parse(request)["url"]}"
80
+ puts "Repository \"#{name}\" succesfully edited! See updates at: #{JSON.parse(request)["html_url"]}"
81
81
  elsif !response["errors"].nil?
82
82
  puts "ERROR: #{response['errors'][0]['message']}"
83
83
  elsif !response["message"].nil?
@@ -128,7 +128,7 @@ module Github
128
128
  response = JSON.parse(request)
129
129
 
130
130
  if response["errors"].nil? && response["message"].nil?
131
- puts "#{response['name']} (#{response['url']})"
131
+ puts "#{response['name']} (#{response['ssh_url']})"
132
132
  puts " - Owner: #{response['owner']['login']}"
133
133
  puts " - Description: #{response['description']}"
134
134
  puts " - Private: #{response['private']}"
data/lib/hubmaster.rb CHANGED
@@ -10,3 +10,28 @@ require File.expand_path(File.join(File.dirname(__FILE__), "hubmaster", "base.rb
10
10
  require File.expand_path(File.join(File.dirname(__FILE__), "hubmaster", "repo.rb"))
11
11
  require File.expand_path(File.join(File.dirname(__FILE__), "hubmaster", "cipher.rb"))
12
12
 
13
+ def run_pager
14
+ return if RUBY_PLATFORM =~ /win32/
15
+ return unless STDOUT.tty?
16
+
17
+ read, write = IO.pipe
18
+
19
+ unless Kernel.fork # Child process
20
+ STDOUT.reopen(write)
21
+ STDERR.reopen(write) if STDERR.tty?
22
+ read.close
23
+ write.close
24
+ return
25
+ end
26
+
27
+ STDIN.reopen(read)
28
+ read.close
29
+ write.close
30
+
31
+ ENV['LESS'] = 'FSRX' # Don't page if the input is short enough
32
+
33
+ Kernel.select [STDIN] # Wait until we have input before we start the pager
34
+ pager = ENV['PAGER'] || 'less'
35
+ exec pager rescue exec "/bin/sh", "-c", pager
36
+ end
37
+
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Github
2
- VERSION = "0.0.05"
2
+ VERSION = "0.0.06"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubmaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.05
4
+ version: 0.0.06
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-08 00:00:00.000000000 Z
12
+ date: 2012-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline