gist-sweep 0.1.0 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc4719ba80930b3a5d29f9c6ae0bc3441787d43a
4
- data.tar.gz: 828b607b3abd3f798db75cf1bf5c70b8d4f5d0ee
3
+ metadata.gz: f734ee0e99a58ca4cfbd714ef5a88d675b4eff41
4
+ data.tar.gz: a712070e3fbbe9c6e09a801bd07f47aaa5898073
5
5
  SHA512:
6
- metadata.gz: 8745a4d298f2308a8141e820ead462c3c826d569c2cd0abaac6e815b98de9f97443013a76e00179f6916e90303e9f72eb9e3b0e35035c8998bdac8ddee69cadc
7
- data.tar.gz: 95dbf67c4d0d8d3553d9c64b42ec636fa10a7fad5e085b267815bc440c089fefa873ec7320716075ba96df56030ff3baf7911763086aa8ca396fef7f6f6ef7d3
6
+ metadata.gz: 5ef81643175e884abc6f3cc7fc5e57225b630c8eb427aab83b6fa45680e022c63196740256ad008e8e8c355161fb1e9fc91834edc574c75eb3ae2d6747a542b1
7
+ data.tar.gz: d28bf330fd60e0c7436456f24e08726256dc1029926c8d828a81870b0c4bf47a37d7c4e91e3660e72c5ae6d9c9ab072c7e6919a9c63290af03b96212b943404f
@@ -0,0 +1,28 @@
1
+ ## 0.2.0 (Unreleased)
2
+
3
+ - Switch underlying libraries over to [octokit](https://github.com/octokit/octokit.rb/)
4
+
5
+ ## 0.1.0 (2016-12-27)
6
+
7
+ - Upgrade `json` gem to `~> 2.0`
8
+
9
+ ## 0.0.5 (2016-03-10)
10
+
11
+ - Show the last updated at on each gist
12
+ - Doc improvements
13
+
14
+ ## 0.0.4 (2015-05-16)
15
+
16
+ - Fixing bug where gists weren't properly removed
17
+
18
+ ## 0.0.3 (2015-05-11)
19
+
20
+ - Adding an optional pattern for sweeping gists
21
+
22
+ ## 0.0.2 (2015-05-04)
23
+
24
+ - Visual improvements
25
+
26
+ ## 0.0.1 (2015-01-15)
27
+
28
+ - Initial release
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in gist-sweep.gemspec
4
4
  gemspec
5
- gem 'json', '> 2.0.0'
6
- gem "github_api"
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.licenses = ["MIT"]
20
20
 
21
21
  s.add_runtime_dependency "json", "~> 2.0"
22
- s.add_runtime_dependency "github_api", "~> 0.14"
22
+ s.add_runtime_dependency "octokit", "~> 4.0"
23
23
 
24
24
  s.add_development_dependency "bundler", "~> 1.13"
25
25
  s.add_development_dependency "rake", "~> 12.0"
@@ -1,7 +1,7 @@
1
1
  require "gist/sweep/version"
2
2
  require 'date'
3
3
  require 'json'
4
- require 'github_api'
4
+ require 'octokit'
5
5
  require 'optparse'
6
6
 
7
7
  module GistSweep
@@ -68,20 +68,20 @@ module GistSweep
68
68
 
69
69
  def load_github_api(config, file_path)
70
70
  if config["oauth_token"] and !config["oauth_token"].empty?
71
- Github.new(:oauth_token => config["oauth_token"], :auto_pagination => true)
71
+ Octokit::Client.new(:access_token => config["oauth_token"])
72
72
  else
73
73
  puts "You need to setup a 'Personal Access Token' to use with gist-sweep"
74
74
  puts "I'll wait for you to paste one in: "
75
75
  code = STDIN.gets.strip
76
76
  write_config_file(code, file_path)
77
- Github.new(:oauth_token => code, :auto_pagination => true)
77
+ Octokit::Client.new(:access_token => code)
78
78
  end
79
79
  end
80
80
 
81
81
  def promot_to_remove_gists(gists)
82
- gists.each { |g|
83
- puts "#{g["updated_at"]} (#{g["id"]}) -- #{g["description"]}"
84
- }
82
+ gists.each do |g|
83
+ puts "#{g[:updated_at]} (#{g[:id]}) -- #{g[:description]}"
84
+ end
85
85
  print "Remove #{gists.size} gists? (y/n) "
86
86
  line = STDIN.gets.strip
87
87
  if line == 'y'
@@ -111,23 +111,23 @@ module GistSweep
111
111
 
112
112
  pattern_matcher = Regexp.new(pattern || "")
113
113
 
114
- gists_to_remove = github.gists.list(args[:username]).body.select{ |g|
115
- remove_already = (!g["public"] or args[:public]) && (DateTime.parse(g["updated_at"]) < min_age)
114
+ gists_to_remove = github.gists(args[:username]).select do |g|
115
+ remove_already = (!g[:public] or args[:public]) && (g[:updated_at].to_datetime < min_age)
116
116
  if pattern
117
- remove_already && pattern_matcher.match(g["description"])
117
+ remove_already && pattern_matcher.match(g[:description])
118
118
  else
119
119
  remove_already
120
120
  end
121
- }
121
+ end
122
122
 
123
123
  if gists_to_remove.empty?
124
124
  puts "No gists to remove"
125
125
  else
126
126
  if promot_to_remove_gists(gists_to_remove)
127
- gists_to_remove.each { |g|
128
- verbose_log(args, "Deleting gist #{g["id"]}")
129
- github.gists.delete(g["id"])
130
- }
127
+ gists_to_remove.each do |g|
128
+ verbose_log(args, "Deleting gist #{g[:id]}")
129
+ github.delete_gist(g[:id])
130
+ end
131
131
  puts "Swept gists."
132
132
  end
133
133
  end
@@ -1,5 +1,5 @@
1
1
  module Gist
2
2
  module Sweep
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gist-sweep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Shannon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-27 00:00:00.000000000 Z
11
+ date: 2016-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: github_api
28
+ name: octokit
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.14'
33
+ version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.14'
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -75,6 +75,7 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
+ - CHANGELOG.md
78
79
  - Gemfile
79
80
  - LICENSE.txt
80
81
  - README.md