gist_updater 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3ed527300512428190170b5851a2ed073d94c19
4
- data.tar.gz: 0fd1c1ce362b672e45a9127d0af132e1980e4425
3
+ metadata.gz: cf608c9e5b957a646b9169b87db0716a4ffa57ab
4
+ data.tar.gz: dc1eb9253fd32f87751a673f184836736eeea99e
5
5
  SHA512:
6
- metadata.gz: 349c22ceb6c53151eef3a787f80af72b9e5486eb659cba479159f0657c06549ed255f98873d63dfad747e3cbc5d2e21652c9c902363f4834744ebc2a4fb17532
7
- data.tar.gz: 0cecc509af86e5ae6b6db1f7c00bb8feb4682f22d5cb9bdc2c6607ea897e1b58407f728131370facb0eabeda5a7e209f300d8ed1bd54a1a3904df246e107c470
6
+ metadata.gz: 66af51b11688aed690c3e1a887a2143e3d36aa06372520d7a3502a3eff2d83e2a339030c150d239e4ecc8e622f0ab4d5bbe25740123d13123a9255c3c192f78f
7
+ data.tar.gz: 7634a9be5d0465562ad3e38eb44dca722526fa89162faa984f9deb8c2a83415890351573d6fea98749e1105114c2703291dd919bccdcc6b52c61226fe48a8f14
data/gist_updater.gemspec CHANGED
@@ -33,4 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'rspec', '~> 3.0'
34
34
  spec.add_development_dependency 'rubocop', '~> 0.43.0'
35
35
  spec.add_development_dependency 'yard', '~> 0.9.5'
36
+ spec.add_development_dependency 'webmock', '~> 2.1'
36
37
  end
@@ -4,7 +4,7 @@ module GistUpdater
4
4
  # Updates according to user configuration
5
5
  class Updater
6
6
  # @param options [Hash] options generated by Thor
7
- # @param config_class [Class] a Class which has configuration duty
7
+ # @param config_class [Class] A Class which has configuration duty
8
8
  def initialize(options, config_class = Config)
9
9
  @user = options[:user] || ENV['GISTUPDATER_USER']
10
10
  @access_token = options[:token] || ENV['GISTUPDATER_ACCESS_TOKEN']
@@ -14,13 +14,14 @@ module GistUpdater
14
14
 
15
15
  # Update your Gist
16
16
  #
17
+ # @param content_class [Class] A Class which has content duty
17
18
  # @return [Array<Sawyer::Resource>] Updated resource(s)
18
- def update
19
+ def update(content_class = Content)
19
20
  updated = []
20
21
 
21
22
  config.each do |gist_id:, file_paths:|
22
23
  file_paths.each do |file_path|
23
- updated << update_by_gist(gist_id, file_path)
24
+ updated << update_by_gist(gist_id, file_path, content_class)
24
25
  end
25
26
  end
26
27
 
@@ -33,9 +34,12 @@ module GistUpdater
33
34
 
34
35
  # Update a Gist file
35
36
  #
37
+ # @param id [String] A gist id
38
+ # @param file_path [String] A relative file path
39
+ # @param content_class [Class] A Class which has content duty
36
40
  # @return (see GistUpdater::Content#update_if_need)
37
- def update_by_gist(id, file_path)
38
- Content.new(
41
+ def update_by_gist(id, file_path, content_class)
42
+ content_class.new(
39
43
  user: user,
40
44
  access_token: access_token,
41
45
  gist_id: id,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GistUpdater
4
- VERSION = '0.4.2'
4
+ VERSION = '0.4.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gist_updater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Masuda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-02 00:00:00.000000000 Z
11
+ date: 2016-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.9.5
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.1'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.1'
111
125
  description: |
112
126
  Updates your Gist files defined in YAML.
113
127
  For example, it's useful for syncing GitHub and Gist in CI.