gist_updater 0.3.1 → 0.4.2

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: f08ce131e4b5da439fd9dbec0b196211d65bdc3d
4
- data.tar.gz: c0ae0fddb076a17467d9bf7e795f6e60599a4459
3
+ metadata.gz: b3ed527300512428190170b5851a2ed073d94c19
4
+ data.tar.gz: 0fd1c1ce362b672e45a9127d0af132e1980e4425
5
5
  SHA512:
6
- metadata.gz: e8dee73553e37d1549b2267c97235a23a292b21cf723aa2bb82e9323abb1a2f8a979beb5c9b38f33c41d130e78837bf1dbbc748f8f5450b4730065363c75b59e
7
- data.tar.gz: dc6bddcafd3b4855787cdc6c661946c1b6414146ad2c0be0ab8c47b09a0a6935246a0dda6b6021bb7094d2d13e6e0eabf699ea01aff73a5bf86c24442fe43f4f
6
+ metadata.gz: 349c22ceb6c53151eef3a787f80af72b9e5486eb659cba479159f0657c06549ed255f98873d63dfad747e3cbc5d2e21652c9c902363f4834744ebc2a4fb17532
7
+ data.tar.gz: 0cecc509af86e5ae6b6db1f7c00bb8feb4682f22d5cb9bdc2c6607ea897e1b58407f728131370facb0eabeda5a7e209f300d8ed1bd54a1a3904df246e107c470
data/README.md CHANGED
@@ -59,7 +59,7 @@ GistUpdater::Updater.new(
59
59
  token: 'GitHub personal access token', # or $GISTUPDATER_ACCESS_TOKEN
60
60
  debug: 'true or false'
61
61
  ).update
62
- #=> update count
62
+ #=> Array<Sawyer::Resource>
63
63
  ```
64
64
 
65
65
  ## YAML format
@@ -22,13 +22,13 @@ module GistUpdater
22
22
  # @return [NilClass] isnot updated
23
23
  def update_if_need
24
24
  if need_to_update?
25
- result = update
26
- puts "Updated `#{file_path}` to #{result.html_url}"
25
+ resource = update
26
+ puts "Updated `#{file_path}` to #{resource.html_url}"
27
27
  elsif GistUpdater.debug
28
28
  puts "There is no update for `#{file_path}`."
29
29
  end
30
30
 
31
- result
31
+ pick_a_file(resource)
32
32
  end
33
33
 
34
34
  private
@@ -51,6 +51,10 @@ module GistUpdater
51
51
  @local ||= File.read(file_path)
52
52
  end
53
53
 
54
+ def pick_a_file(resource)
55
+ resource.files[file_name] if resource
56
+ end
57
+
54
58
  # Update a Gist file
55
59
  #
56
60
  # @return [Sawyer::Resource]
@@ -14,17 +14,17 @@ module GistUpdater
14
14
 
15
15
  # Update your Gist
16
16
  #
17
- # @return [Fixnum] Updated count
17
+ # @return [Array<Sawyer::Resource>] Updated resource(s)
18
18
  def update
19
- count = 0
19
+ updated = []
20
20
 
21
21
  config.each do |gist_id:, file_paths:|
22
22
  file_paths.each do |file_path|
23
- count += 1 if update_by_gist(gist_id, file_path)
23
+ updated << update_by_gist(gist_id, file_path)
24
24
  end
25
25
  end
26
26
 
27
- count
27
+ updated.compact
28
28
  end
29
29
 
30
30
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GistUpdater
4
- VERSION = '0.3.1'
4
+ VERSION = '0.4.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gist_updater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Masuda