pluto-tasks 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemtest +0 -0
- data/README.md +16 -0
- data/Rakefile +1 -2
- data/lib/pluto/tasks.rb +49 -2
- data/lib/pluto/tasks/env.rake +1 -1
- data/lib/pluto/tasks/setup.rake +7 -8
- data/lib/pluto/tasks/stats.rake +5 -4
- data/lib/pluto/tasks/version.rb +1 -1
- data/test/test_fetch.rb +21 -0
- metadata +8 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 059a295456b18d6271c84dc93ba338592df9f6b2
|
4
|
+
data.tar.gz: 30c0be966e25c2581a267ea0af2249ca7ae17d9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fea778a60a8f1e97528c5eacd8778d9f094d65185fc92a11d2135c243ffaf8946112d6cdfae3888ecfb57d8d6e758aa3a3b6d411e5e55dd6cc204696531aca8e
|
7
|
+
data.tar.gz: 6ac7aa1a7cad2b317d535d273da432fba198f269b638091863cd9d060330986dc025cbeb5f8a0a93f8b4deaf6dc120258bbcea39078c3fd0b2865c2c6cf4f415
|
data/.gemtest
ADDED
File without changes
|
data/README.md
CHANGED
@@ -10,6 +10,22 @@
|
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
13
|
+
### Tasks
|
14
|
+
|
15
|
+
Setup • Update • Stats
|
16
|
+
|
17
|
+
|
18
|
+
#### Setup Task
|
19
|
+
|
20
|
+
Setup the database and planet feed subscriptions:
|
21
|
+
|
22
|
+
$ rake setup PLANET=ruby
|
23
|
+
|
24
|
+
#### Update Task
|
25
|
+
|
26
|
+
Update your planet feeds:
|
27
|
+
|
28
|
+
$ rake update
|
13
29
|
|
14
30
|
|
15
31
|
## License
|
data/Rakefile
CHANGED
@@ -18,9 +18,8 @@ Hoe.spec 'pluto-tasks' do
|
|
18
18
|
self.history_file = 'HISTORY.md'
|
19
19
|
|
20
20
|
self.extra_deps = [
|
21
|
-
['pluto-models', '>= 1.
|
21
|
+
['pluto-models', '>= 1.3.1'],
|
22
22
|
['pluto-update'],
|
23
|
-
['pluto-merge'], ## todo/check: add merge - why? why not?
|
24
23
|
]
|
25
24
|
|
26
25
|
self.licenses = ['Public Domain']
|
data/lib/pluto/tasks.rb
CHANGED
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
require 'pluto/models'
|
5
|
-
|
6
5
|
require 'pluto/update'
|
7
|
-
require 'pluto/merge' ## todo/check: add merge - really used- why? why not?
|
8
6
|
|
9
7
|
|
10
8
|
# our own code
|
@@ -22,6 +20,55 @@ module Pluto
|
|
22
20
|
load 'pluto/tasks/update.rake'
|
23
21
|
end
|
24
22
|
|
23
|
+
|
24
|
+
def self.fetch_config_for( key )
|
25
|
+
###
|
26
|
+
## todo:
|
27
|
+
## move into a method for (re)use
|
28
|
+
puts "trying to fetch pluto.index.ini shortcut planet registry..."
|
29
|
+
|
30
|
+
## Note: Pluto includes its own Fetcher, thus, use ::Fetcher!!
|
31
|
+
worker = ::Fetcher::Worker.new
|
32
|
+
res = worker.get_response( 'https://raw.githubusercontent.com/feedreader/planets/master/pluto.index.ini' )
|
33
|
+
if res.code != '200'
|
34
|
+
puts "sorry; failed to fetch pluto.index - HTTP #{res.code} - #{res.message}"
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
###
|
39
|
+
# Note: Net::HTTP will NOT set encoding UTF-8 etc.
|
40
|
+
# will be set to ASCII-8BIT == BINARY == Encoding Unknown; Raw Bytes Here
|
41
|
+
# thus, set/force encoding to utf-8
|
42
|
+
index_txt = res.body.dup.to_s
|
43
|
+
index_txt = index_txt.force_encoding( Encoding::UTF_8 )
|
44
|
+
|
45
|
+
shortcuts = INI.load( index_txt )
|
46
|
+
pp shortcuts
|
47
|
+
|
48
|
+
shortcut = shortcuts[key]
|
49
|
+
if shortcut.nil?
|
50
|
+
puts "sorry; no planet shortcut found for key >#{key}<"
|
51
|
+
exit 1
|
52
|
+
end
|
53
|
+
|
54
|
+
res = worker.get_response( shortcut['source'] )
|
55
|
+
if res.code != '200'
|
56
|
+
puts "sorry; failed to fetch planet config for >#{key}< - HTTP #{res.code} - #{res.message}"
|
57
|
+
exit 1
|
58
|
+
end
|
59
|
+
|
60
|
+
###
|
61
|
+
# Note: Net::HTTP will NOT set encoding UTF-8 etc.
|
62
|
+
# will be set to ASCII-8BIT == BINARY == Encoding Unknown; Raw Bytes Here
|
63
|
+
# thus, set/force encoding to utf-8
|
64
|
+
config_txt = res.body.dup.to_s
|
65
|
+
config_txt = config_txt.force_encoding( Encoding::UTF_8 )
|
66
|
+
|
67
|
+
config = INI.load( config_txt )
|
68
|
+
config
|
69
|
+
end # method fetch_config_for
|
70
|
+
|
71
|
+
|
25
72
|
end # module Pluto
|
26
73
|
|
27
74
|
|
data/lib/pluto/tasks/env.rake
CHANGED
@@ -12,7 +12,7 @@ end
|
|
12
12
|
|
13
13
|
desc 'pluto - debug site setup'
|
14
14
|
task :site => :env do
|
15
|
-
site = Pluto::
|
15
|
+
site = Pluto::Model::Site.first # FIX: for now assume one planet per DB (fix later; allow planet key or similar)
|
16
16
|
if site.present?
|
17
17
|
puts "site found:"
|
18
18
|
pp site
|
data/lib/pluto/tasks/setup.rake
CHANGED
@@ -11,12 +11,13 @@ task :setup => :env do
|
|
11
11
|
puts 'no PLANET=key passed along; try defaults'
|
12
12
|
# try pluto.yml or planet.yml if exist
|
13
13
|
|
14
|
-
if File.exists?( './pluto.ini' )
|
14
|
+
if File.exists?( './pluto.ini' ) # check if pluto.ini exists, if yes add/use it
|
15
15
|
key ='pluto'
|
16
|
-
elsif File.exists?( './planet.ini' )
|
16
|
+
elsif File.exists?( './planet.ini' ) # check if planet.ini exists, if yes add/use it
|
17
17
|
key = 'planet'
|
18
18
|
else
|
19
|
-
puts '***
|
19
|
+
puts '*** error: no arg passed in; no pluto.ini or planet.ini found in working folder'
|
20
|
+
exit 1
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
@@ -24,13 +25,11 @@ task :setup => :env do
|
|
24
25
|
config_path = "./#{key}.ini"
|
25
26
|
if File.exists?( config_path )
|
26
27
|
config = INI.load_file( config_path )
|
27
|
-
else ##
|
28
|
-
|
29
|
-
config = YAML.load_file( config_path )
|
28
|
+
else ## try download shortcut index list and fetch planet config
|
29
|
+
config = Pluto.fetch_config_for( key )
|
30
30
|
end
|
31
|
-
|
32
31
|
|
33
|
-
puts "dump planet setup settings
|
32
|
+
puts "dump planet setup settings:"
|
34
33
|
pp config
|
35
34
|
|
36
35
|
# note: allow multiple planets (sites) for a single install
|
data/lib/pluto/tasks/stats.rake
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
desc 'pluto - show planet (feed) stats'
|
4
4
|
task :stats => :env do
|
5
5
|
puts "stats:"
|
6
|
-
puts " Feeds: #{Pluto::
|
7
|
-
puts " Items: #{Pluto::
|
8
|
-
puts " Sites: #{Pluto::
|
9
|
-
puts " Subscriptions: #{Pluto::
|
6
|
+
puts " Feeds: #{Pluto::Model::Feed.count}"
|
7
|
+
puts " Items: #{Pluto::Model::Item.count}"
|
8
|
+
puts " Sites: #{Pluto::Model::Site.count}"
|
9
|
+
puts " Subscriptions: #{Pluto::Model::Subscription.count}"
|
10
10
|
end
|
11
|
+
|
data/lib/pluto/tasks/version.rb
CHANGED
data/test/test_fetch.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_fetch.rb
|
6
|
+
# or better
|
7
|
+
# rake test
|
8
|
+
|
9
|
+
require 'helper'
|
10
|
+
|
11
|
+
|
12
|
+
class TestFetch < MiniTest::Test
|
13
|
+
|
14
|
+
def test_ruby
|
15
|
+
config = Pluto.fetch_config_for( 'ruby')
|
16
|
+
pp config
|
17
|
+
|
18
|
+
assert true ## if we get here it should work
|
19
|
+
end
|
20
|
+
|
21
|
+
end # class TestFetch
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluto-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pluto-models
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.3.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.3.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pluto-update
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: pluto-merge
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rdoc
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,6 +75,7 @@ extra_rdoc_files:
|
|
89
75
|
- Manifest.txt
|
90
76
|
- README.md
|
91
77
|
files:
|
78
|
+
- ".gemtest"
|
92
79
|
- HISTORY.md
|
93
80
|
- Manifest.txt
|
94
81
|
- README.md
|
@@ -99,6 +86,7 @@ files:
|
|
99
86
|
- lib/pluto/tasks/stats.rake
|
100
87
|
- lib/pluto/tasks/update.rake
|
101
88
|
- lib/pluto/tasks/version.rb
|
89
|
+
- test/test_fetch.rb
|
102
90
|
homepage: https://github.com/feedreader/pluto-tasks
|
103
91
|
licenses:
|
104
92
|
- Public Domain
|
@@ -125,4 +113,5 @@ rubygems_version: 2.4.2
|
|
125
113
|
signing_key:
|
126
114
|
specification_version: 4
|
127
115
|
summary: pluto-tasks - planet rake tasks (setup, update, stats, etc.)
|
128
|
-
test_files:
|
116
|
+
test_files:
|
117
|
+
- test/test_fetch.rb
|