swdyh-gisty 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/bin/gisty +7 -1
  2. data/lib/gisty.rb +6 -3
  3. data/test/gisty_test.rb +1 -1
  4. metadata +2 -2
data/bin/gisty CHANGED
@@ -33,7 +33,13 @@ commands:
33
33
  end
34
34
 
35
35
  cmd :list do
36
- @g.list.each do |i|
36
+ list = @g.list
37
+ puts '- public gist -'
38
+ list[:public].each do |i|
39
+ puts "#{i[0]}: #{i[1].join(' ')}"
40
+ end
41
+ puts '- private gist -'
42
+ list[:private].each do |i|
37
43
  puts "#{i[0]}: #{i[1].join(' ')}"
38
44
  end
39
45
  end
data/lib/gisty.rb CHANGED
@@ -5,7 +5,7 @@ require 'rubygems'
5
5
  require 'nokogiri'
6
6
 
7
7
  class Gisty
8
- VERSION = '0.0.10'
8
+ VERSION = '0.0.11'
9
9
  GIST_URL = 'http://gist.github.com/'
10
10
  GISTY_URL = 'http://github.com/swdyh/gisty/tree/master'
11
11
 
@@ -70,11 +70,14 @@ class Gisty
70
70
  end
71
71
 
72
72
  def list
73
- dirs = Pathname.glob(@dir.to_s + '/*')
74
- dirs.map do |i|
73
+ dirs = Pathname.glob(@dir.to_s + '/*').map do |i|
75
74
  [i.basename.to_s,
76
75
  Pathname.glob(i.to_s + '/*').map { |i| i.basename.to_s }]
77
76
  end
77
+ re_pub = /^\d+$/
78
+ pub = dirs.select { |i| re_pub.match(i.first) }.sort_by { |i| i.first.to_i }.reverse
79
+ pri = dirs.select { |i| !re_pub.match(i.first) }.sort_by { |i| i.first }
80
+ { :public => pub, :private => pri }
78
81
  end
79
82
 
80
83
  def local_ids
data/test/gisty_test.rb CHANGED
@@ -99,7 +99,7 @@ class GistyTest < Test::Unit::TestCase
99
99
  ids = @gisty.remote_ids
100
100
  @gisty.clone ids[0]
101
101
  @gisty.clone ids[1]
102
- list = @gisty.list.map { |i| i.first }
102
+ list = @gisty.list[:public].map { |i| i.first }
103
103
  assert list.include?(ids[0])
104
104
  assert list.include?(ids[1])
105
105
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swdyh-gisty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - swdyh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-03 00:00:00 -08:00
12
+ date: 2009-01-16 00:00:00 -08:00
13
13
  default_executable: gisty
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency