diff --git a/README.rdoc b/README.rdoc index 3b50b6d..fcb2698 100644 --- a/README.rdoc +++ b/README.rdoc @@ -60,6 +60,7 @@ commands gisty sync sync remote gist. (clone all remote gist) gisty sync_delete sync remote gist. delete local gist if remote gist was deleted. gisty pull_all pull all gist. + gisty delete_local_all delete all local gist. gisty about show about gisty gisty help show help diff --git a/gisty.gemspec b/gisty.gemspec index 5ab2ba5..e35e51c 100644 --- a/gisty.gemspec +++ b/gisty.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.email = "http://mailhide.recaptcha.net/d?k=01AhB7crgrlHptVaYRD0oPwA==&c=L_iqOZrGmo6hcGpPTFg1QYnjr-WpAStyQ4Y8ShfgOHs=" s.executables = ["gisty"] s.extra_rdoc_files = ["README.rdoc"] - s.files = ["README.rdoc", "Rakefile", "bin/gisty", "test/fixtures", "test/fixtures/bar.user.js", "test/fixtures/foo.user.js", "test/fixtures/gists_1", "test/fixtures/gists_2", "test/fixtures/gists_3", "test/fixtures/gists_post", "test/gisty_test.rb", "test/test_helper.rb", "lib/commands", "lib/commands/about.rb", "lib/commands/gyast.rb", "lib/commands/help.rb", "lib/commands/list.rb", "lib/commands/post.rb", "lib/commands/private_post.rb", "lib/commands/pull_all.rb", "lib/commands/sync.rb", "lib/commands/sync_delete.rb", "lib/gisty.rb"] + s.files = ["README.rdoc", "Rakefile", "bin/gisty", "test/fixtures", "test/fixtures/bar.user.js", "test/fixtures/foo.user.js", "test/fixtures/gists_1", "test/fixtures/gists_2", "test/fixtures/gists_3", "test/fixtures/gists_post", "test/gisty_test.rb", "test/test_helper.rb", "lib/commands", "lib/commands/about.rb", "lib/commands/delete_local_all.rb", "lib/commands/gyast.rb", "lib/commands/help.rb", "lib/commands/list.rb", "lib/commands/post.rb", "lib/commands/private_post.rb", "lib/commands/pull_all.rb", "lib/commands/sync.rb", "lib/commands/sync_delete.rb", "lib/gisty.rb"] s.homepage = "http://github.com/swdyh/gisty/tree/master" s.rdoc_options = ["--title", "gisty documentation", "--charset", "utf-8", "--line-numbers", "--main", "README.rdoc", "--inline-source", "--exclude", "^(examples|extras)/"] s.require_paths = ["lib"] diff --git a/lib/commands/delete_local_all.rb b/lib/commands/delete_local_all.rb new file mode 100644 index 0000000..2407ef6 --- /dev/null +++ b/lib/commands/delete_local_all.rb @@ -0,0 +1,5 @@ +cmd :delete_local_all, '', 'delete all local gist' do + @g.delete_local_all + puts '---' + puts 'delete_local_all finished.' +end diff --git a/lib/gisty.rb b/lib/gisty.rb index 84ff1eb..0b8c7e6 100644 --- a/lib/gisty.rb +++ b/lib/gisty.rb @@ -129,6 +129,18 @@ def delete id FileUtils.rm_rf @dir.join(id) if @dir.join(id).exist? end + def delete_local_all + local = local_ids + FileUtils.cd @dir do + if local.size > 0 + local.each do |id| + puts "delete #{id}" + delete id + end + end + end + end + def sync delete = false local = local_ids FileUtils.cd @dir do