pluto-tasks 1.1.0 → 1.2.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: fb84bb53573bcc450ab3b5b2224cd05adcc0ad39
4
- data.tar.gz: 571764b7b5352531055601ed8ccf2cf819104206
3
+ metadata.gz: 059a295456b18d6271c84dc93ba338592df9f6b2
4
+ data.tar.gz: 30c0be966e25c2581a267ea0af2249ca7ae17d9f
5
5
  SHA512:
6
- metadata.gz: 71cecfcfa4fa750a4a1bea97c4d3c74d4b5351e132e6c6e751ddae5c510762680c58b7664f634632f6a30c11520e3d84d752e1e95ed58e58c92c6c15db7d3e6f
7
- data.tar.gz: 4a5e7123715b423f584a844fda57ddd687ebf0ccbf917975e82877fcecc284bed4767601573175204f98e7292ad2219663023c88e6686a9ae4093b474b53947d
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.2.2'],
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
 
@@ -12,7 +12,7 @@ end
12
12
 
13
13
  desc 'pluto - debug site setup'
14
14
  task :site => :env do
15
- site = Pluto::Models::Site.first # FIX: for now assume one planet per DB (fix later; allow planet key or similar)
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
@@ -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' ) || File.exists?( './pluto.yml' ) # check if pluto.yml exists, if yes add/use it
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' ) || File.exists?( './planet.yml' ) # check if planet.yml exists, if yes add/use it
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 '*** note: no arg passed in; no pluto.ini|yml or planet.ini|yml found in working folder'
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 ## assume .yml
28
- config_path = "./#{key}.yml"
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 >#{config_path}<:"
32
+ puts "dump planet setup settings:"
34
33
  pp config
35
34
 
36
35
  # note: allow multiple planets (sites) for a single install
@@ -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::Models::Feed.count}"
7
- puts " Items: #{Pluto::Models::Item.count}"
8
- puts " Sites: #{Pluto::Models::Site.count}"
9
- puts " Subscriptions: #{Pluto::Models::Subscription.count}"
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
+
@@ -3,7 +3,7 @@
3
3
  module PlutoTasks
4
4
 
5
5
  MAJOR = 1
6
- MINOR = 1
6
+ MINOR = 2
7
7
  PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
@@ -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.1.0
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-13 00:00:00.000000000 Z
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.2.2
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.2.2
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