swdyh-gisty 0.0.5 → 0.0.6

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.
Files changed (4) hide show
  1. data/README.rdoc +3 -2
  2. data/bin/gisty +10 -3
  3. data/lib/gisty.rb +18 -4
  4. metadata +1 -1
data/README.rdoc CHANGED
@@ -38,9 +38,10 @@ use API token with HTTP. at your own risk.
38
38
  gisty list show local list.
39
39
  gisty post file1 file2 ... post new gist.
40
40
  gisty private_post file1 file2 ... post new private gist.
41
- gisty sync sync remote gist.
41
+ gisty sync sync remote gist. (clone all remote gist)
42
42
  gisty sync_delete sync remote gist. delete local gist if remote gist was deleted.
43
- gisty about show about gisty
43
+ gisty pull_all pull all gist.
44
+ gisty about show about gisty
44
45
  gisty help show help
45
46
 
46
47
  == Copyright
data/bin/gisty CHANGED
@@ -9,7 +9,7 @@ def cmd name
9
9
  @cmds[name.to_s] = Proc.new { |i| yield i }
10
10
  end
11
11
 
12
- cmd :aboutt do
12
+ cmd :about do
13
13
  puts Gisty::AA
14
14
  puts
15
15
  puts 'version: ' + Gisty::VERSION
@@ -24,8 +24,9 @@ commands:
24
24
  gisty list show local list.
25
25
  gisty post file1 file2 ... post new gist.
26
26
  gisty private_post file1 file2 ... post new private gist.
27
- gisty sync sync remote gist.
27
+ gisty sync sync remote gist. (clone all remote gist)
28
28
  gisty sync_delete sync remote gist. delete local gist if remote gist was deleted.
29
+ gisty pull_all pull all gist.
29
30
  gisty about show about gisty
30
31
  gisty help show help
31
32
  EOS
@@ -49,6 +50,12 @@ cmd :sync_delete do
49
50
  puts 'sync finished.'
50
51
  end
51
52
 
53
+ cmd :pull_all do
54
+ @g.pull_all
55
+ puts '---'
56
+ puts 'pull_all finished.'
57
+ end
58
+
52
59
  cmd :post do |fs|
53
60
  if fs.size > 0
54
61
  begin
@@ -100,7 +107,7 @@ else
100
107
  if c
101
108
  c.call ARGV.last(ARGV.size - 1)
102
109
  else
103
- puts '...'
110
+ puts 'unknown commands.'
104
111
  end
105
112
  end
106
113
 
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.5'
8
+ VERSION = '0.0.6'
9
9
  GIST_URL = 'http://gist.github.com/'
10
10
  GISTY_URL = 'http://github.com/swdyh/gisty/tree/master'
11
11
 
@@ -97,6 +97,23 @@ class Gisty
97
97
  ids = (remote + local).uniq
98
98
  end
99
99
 
100
+ FileUtils.cd @dir do
101
+ ids.each do |id|
102
+ if File.exist? id
103
+ # FileUtils.cd id do
104
+ # c = "git pull"
105
+ # Kernel.system c
106
+ # end
107
+ else
108
+ c = "git clone git@gist.github.com:#{id}.git"
109
+ Kernel.system c
110
+ end
111
+ end
112
+ end
113
+ end
114
+
115
+ def pull_all
116
+ ids = local_ids
100
117
  FileUtils.cd @dir do
101
118
  ids.each do |id|
102
119
  if File.exist? id
@@ -104,9 +121,6 @@ class Gisty
104
121
  c = "git pull"
105
122
  Kernel.system c
106
123
  end
107
- else
108
- c = "git clone git@gist.github.com:#{id}.git"
109
- Kernel.system c
110
124
  end
111
125
  end
112
126
  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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - swdyh