gist_updater 0.2.0 → 0.3.0

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: 859a672a39a6718364468dcfc00bc952ca1b66e8
4
- data.tar.gz: 964adf30b91cb82e39b2477a4835df45a38a86b4
3
+ metadata.gz: e8dc664768fabfe6e4e086ab381b3b58f08274ba
4
+ data.tar.gz: 9b74e345d7683da1a001f56fa832c2f9a0fafd5a
5
5
  SHA512:
6
- metadata.gz: 80a86501c6e476f35082c3e8f287be1769d80875326755c9d28b10e156776ad8be785ef4fdc9815a65c3b0b4f355d4e7d783e74ce0e2109609902dbd17dbe8e4
7
- data.tar.gz: a117929285e50fddc3ac71bbf6f7b94c160bc39b567746736999e515a12c2ecf4b310f30a3b6668d82e5e0c6f4122c1e75075cf8f3a99c8f8886210e80a8a19f
6
+ metadata.gz: 830f3f9d40f2c3b3067a18c86b59edd11ec7e9cc754213327abb2e346c26bff3ae5ad88d6ffa5ee563d49a4be6d9cbc2771811c7f035ef94ac9958479259291f
7
+ data.tar.gz: 23fcdd22918ccce311d79e96569d80c4a41d750b6c8de825a508318950506c1c3e831fd9295d7d1c8d8bd76439296ba4bc5ea187270c094b7f596d2b4fee7b4c
data/README.md CHANGED
@@ -52,10 +52,10 @@ Options:
52
52
  require 'gist_updater'
53
53
 
54
54
  GistUpdater::Updater.new(
55
- yaml: <User definition YAML file>,
56
- user: <GitHub usename>, # or $GISTUPDATER_USER
57
- token: <GitHub personal access token>, # or $GISTUPDATER_ACCESS_TOKEN
58
- debug: <true or false>
55
+ yaml: 'User definition YAML file',
56
+ user: 'GitHub usename', # or $GISTUPDATER_USER
57
+ token: 'GitHub personal access token', # or $GISTUPDATER_ACCESS_TOKEN
58
+ debug: 'true or false'
59
59
  ).update
60
60
  #=> update count
61
61
  ```
@@ -64,11 +64,12 @@ GistUpdater::Updater.new(
64
64
 
65
65
  ```yaml
66
66
  -
67
- - <gist_id1>
68
- - <path to file1>
67
+ - 'gist_id_1'
68
+ - 'path to file_1'
69
69
  -
70
- - <gist_id2>
71
- - <path to file2>
70
+ - 'gist_id_2'
71
+ - 'path to file_2a'
72
+ - 'path to file_2b'
72
73
  ```
73
74
 
74
75
  For example,
@@ -79,9 +80,10 @@ For example,
79
80
  - 8177244
80
81
  - .emacs.d/init.el
81
82
  -
82
- # https://gist.github.com/masutaka/9642146
83
- - 9642146
84
- - bin/my-brew-bundle
83
+ # https://gist.github.com/masutaka/f7ce8b3c71e995c20e48
84
+ - f7ce8b3c71e995c20e48
85
+ - circle.yml
86
+ - tasks/pushover.rake
85
87
  ```
86
88
 
87
89
  ## Development
@@ -11,8 +11,8 @@ module GistUpdater
11
11
  def each
12
12
  return enum_for(:each) unless block_given?
13
13
 
14
- config.each do |gist_id, file_path|
15
- yield(gist_id, file_path)
14
+ config.each do |c|
15
+ yield(gist_id: c.first, file_paths: c.drop(1))
16
16
  end
17
17
  end
18
18
 
@@ -16,7 +16,7 @@ module GistUpdater
16
16
  result = update
17
17
  puts "Updated `#{file_path}` to #{result.html_url}"
18
18
  elsif GistUpdater.debug
19
- puts "There was no need to update `#{file_path}`."
19
+ puts "There is no update for `#{file_path}`."
20
20
  end
21
21
 
22
22
  result
@@ -12,8 +12,10 @@ module GistUpdater
12
12
  def update
13
13
  count = 0
14
14
 
15
- config.each do |gist_id, file_path|
16
- count += 1 if update_1(gist_id, file_path)
15
+ config.each do |gist_id:, file_paths:|
16
+ file_paths.each do |file_path|
17
+ count += 1 if update_by_gist(gist_id, file_path)
18
+ end
17
19
  end
18
20
 
19
21
  count
@@ -23,11 +25,11 @@ module GistUpdater
23
25
 
24
26
  attr_reader :user, :access_token, :config
25
27
 
26
- def update_1(gist_id, file_path)
28
+ def update_by_gist(id, file_path)
27
29
  Content.new(
28
30
  user: user,
29
31
  access_token: access_token,
30
- gist_id: gist_id,
32
+ gist_id: id,
31
33
  file_path: file_path
32
34
  ).update_if_need
33
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GistUpdater
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
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.2.0
4
+ version: 0.3.0
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-09-26 00:00:00.000000000 Z
11
+ date: 2016-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit