drumknott 0.2.0 → 0.3.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: d8212f93f568255ff2ecd7e0f72b52682ad63c28
4
- data.tar.gz: 8e3435731be5c384b1bd9c62516909e38a2f428d
3
+ metadata.gz: 9339ecbc7b7de3bd690f0dea5bbe9d8121c16356
4
+ data.tar.gz: 0c960ae61a94806b72be20e57a73a95b9e820f7b
5
5
  SHA512:
6
- metadata.gz: 41e3d9bacfdee43bc3c3c17c02b4eb6eecc4f08ccd3efe7c8ab55a6ae7770fe97d10e27a79696c5a3fbabf874a48ca0886974ddddb4990f5c17e920561af1899
7
- data.tar.gz: b838d47ff33dd8af2111c4b0db26825a2316202a68da5adb4a184d675c838d7b86acdf959900825ecf1b373cc42fd0fe733e63b3588e122c6a031fdb2099e656
6
+ metadata.gz: 1e275414f772076a8c6fb694992fd87ab9f01768175ab30eb078d4ca44f1246effb1e063eb187a6e86eae0bf7c1c06caed9e1636beaae53b96c8726f4369ee61
7
+ data.tar.gz: 1b44931fc983e83dcb0ce25220ea7d79022a1cff341b42a0e3284711dfd24ad0157c90d506b16773cfc9a014e87b7c57de292368d4c9d016094f5a2ade068df5
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.2.2
4
+ script: bundle exec rspec
5
+ sudo: false
data/README.md CHANGED
@@ -17,6 +17,8 @@ The `keys` command will save your credentials to a `.drumknott` file in your sit
17
17
 
18
18
  By default, both posts and normal pages will be uploaded to Drumknott. If you only wish to include posts, the INCLUDE_PAGES argument in the `keys` command should be `'no'`. This can also be managed via the `DRUMKNOTT_PAGES` environment variable.
19
19
 
20
+ You can have visual output of the refresh if you also include the `ruby-progressbar` gem in your Gemfile (or, if you're not using a Gemfile, just have that gem installed). However, if you prefer quiet even though the gem's installed, set the `DRUMKNOTT_SILENT` environment variable to be `'true'`.
21
+
20
22
  ## Development
21
23
 
22
24
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "drumknott"
4
- spec.version = "0.2.0"
4
+ spec.version = "0.3.0"
5
5
  spec.authors = ["Pat Allan"]
6
6
  spec.email = ["pat@freelancing-gods.com"]
7
7
 
@@ -9,4 +9,5 @@ end
9
9
  require 'drumknott/cli'
10
10
  require 'drumknott/include_pages'
11
11
  require 'drumknott/keys'
12
+ require 'drumknott/outputs'
12
13
  require 'drumknott/refresh'
@@ -0,0 +1,6 @@
1
+ module Drumknott::Outputs
2
+ #
3
+ end
4
+
5
+ require 'drumknott/outputs/silent'
6
+ require 'drumknott/outputs/progress_bar'
@@ -0,0 +1,10 @@
1
+ class Drumknott::Outputs::ProgressBar < Drumknott::Outputs::Silent
2
+ def call(label, collection)
3
+ bar = ::ProgressBar.create :title => label, :total => collection.length
4
+
5
+ collection.each do |item|
6
+ block.call item
7
+ bar.increment
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ class Drumknott::Outputs::Silent
2
+ def self.call(&block)
3
+ new(&block).call
4
+ end
5
+
6
+ def initialize(&block)
7
+ @block = block
8
+ end
9
+
10
+ def call(label, collection)
11
+ collection.each { |item| block.call item }
12
+ end
13
+
14
+ private
15
+
16
+ attr_reader :block
17
+ end
@@ -38,13 +38,26 @@ class Drumknott::Refresh
38
38
  @include_pages
39
39
  end
40
40
 
41
+ def output
42
+ @output ||= output_class.new { |document| update_document document }
43
+ end
44
+
45
+ def output_class
46
+ return Drumknott::Outputs::Silent if ENV['DRUMKNOTT_SILENT']
47
+
48
+ require 'ruby-progressbar'
49
+ Drumknott::Outputs::ProgressBar
50
+ rescue LoadError
51
+ Drumknott::Outputs::Silent
52
+ end
53
+
41
54
  def site
42
55
  @site ||= Jekyll::Site.new Jekyll.configuration
43
56
  end
44
57
 
45
58
  def update
46
- site.posts.docs.each { |document| update_document document }
47
- site.pages.each { |page| update_document page } if include_pages?
59
+ output.call "Posts", site.posts.docs
60
+ output.call "Pages", site.pages if include_pages?
48
61
  end
49
62
 
50
63
  def update_document(document)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drumknott
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
  - Pat Allan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-14 00:00:00.000000000 Z
11
+ date: 2016-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -103,6 +103,9 @@ files:
103
103
  - lib/drumknott/cli.rb
104
104
  - lib/drumknott/include_pages.rb
105
105
  - lib/drumknott/keys.rb
106
+ - lib/drumknott/outputs.rb
107
+ - lib/drumknott/outputs/progress_bar.rb
108
+ - lib/drumknott/outputs/silent.rb
106
109
  - lib/drumknott/refresh.rb
107
110
  homepage: https://github.com/pat/drumknott
108
111
  licenses:
@@ -124,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
127
  version: '0'
125
128
  requirements: []
126
129
  rubyforge_project:
127
- rubygems_version: 2.4.8
130
+ rubygems_version: 2.5.1
128
131
  signing_key:
129
132
  specification_version: 4
130
133
  summary: Jekyll content uploader for Drumknott's search service.