pluto 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -14,7 +14,7 @@ lib/pluto/formatter.rb
14
14
  lib/pluto/installer.rb
15
15
  lib/pluto/lister.rb
16
16
  lib/pluto/manifest_helpers.rb
17
- lib/pluto/models/action.rb
17
+ lib/pluto/models/activity.rb
18
18
  lib/pluto/models/feed.rb
19
19
  lib/pluto/models/item.rb
20
20
  lib/pluto/models/site.rb
data/README.md CHANGED
@@ -14,12 +14,12 @@ from published web feeds.
14
14
  Use the `pluto` command line tool and pass in one or more planet configuration files.
15
15
  Example:
16
16
 
17
- pluto build ruby.yml or
17
+ pluto build ruby.ini or
18
18
  pluto b ruby
19
19
 
20
20
  This will
21
21
 
22
- 1) fetch all feeds listed in `ruby.yml` and
22
+ 1) fetch all feeds listed in `ruby.ini` and
23
23
 
24
24
  2) store all entries in a local database, that is, `ruby.db` in your working folder and
25
25
 
@@ -201,13 +201,13 @@ viennarb:
201
201
  feed: http://vienna-rb.at/atom.xml
202
202
  ```
203
203
 
204
- For more samples, see [`nytimes.yml`](https://github.com/feedreader/pluto.samples/blob/master/nytimes.yml),
205
- [`js.yml`](https://github.com/feedreader/pluto.samples/blob/master/js.yml),
206
- [`dart.yml`](https://github.com/feedreader/pluto.samples/blob/master/dart.yml),
207
- [`haskell.yml`](https://github.com/feedreader/pluto.samples/blob/master/haskell.yml),
208
- [`viennarb.yml`](https://github.com/feedreader/pluto.samples/blob/master/viennarb.yml),
209
- [`beer.yml`](https://github.com/feedreader/pluto.samples/blob/master/beer.yml),
210
- [`football.yml`](https://github.com/feedreader/pluto.samples/blob/master/football.yml).
204
+ For more samples, see [`nytimes.ini`](https://github.com/feedreader/pluto.samples/blob/master/nytimes.ini),
205
+ [`js.ini`](https://github.com/feedreader/pluto.samples/blob/master/js.ini),
206
+ [`dart.ini`](https://github.com/feedreader/pluto.samples/blob/master/dart.ini),
207
+ [`haskell.ini`](https://github.com/feedreader/pluto.samples/blob/master/haskell.ini),
208
+ [`viennarb.ini`](https://github.com/feedreader/pluto.samples/blob/master/viennarb.ini),
209
+ [`beer.ini`](https://github.com/feedreader/pluto.samples/blob/master/beer.ini),
210
+ [`football.ini`](https://github.com/feedreader/pluto.samples/blob/master/football.ini).
211
211
 
212
212
 
213
213
  ## Template Packs
data/Rakefile CHANGED
@@ -22,8 +22,9 @@ Hoe.spec 'pluto' do
22
22
  ['fetcher', '>= 0.4.1'], # use min. 0.4.1 - added cache/conditional GET support
23
23
  ['logutils', '>= 0.6'],
24
24
  ['feedutils', '>= 0.4.0'], # use min. 0.4.0 - added rss 2.0 - content:encoded; added fix for rss.item.guid missing; no more auto-summary in atom
25
- ['props', '>= 1.0.2'], # use min. 1.0.2 - added ini support
25
+ ['props', '>= 1.0.3'], # use min. 1.0.2 - added ini support
26
26
  ['textutils', '>= 0.7'], # use min. 0.7; moved hy/date helpers to gem; future: add some filters (for include/exclude)
27
+ ['activityutils', '>= 0.1.0' ],
27
28
  ['gli', '>= 2.5.6']
28
29
  ## ['activerecord', '~> 3.2'], # NB: soft dependency, will include activesupport,etc.
29
30
  ]
@@ -24,7 +24,7 @@ class Connecter
24
24
 
25
25
  def connect!( config = nil )
26
26
 
27
- if config.nil? # use DATABASE_URL
27
+ if config.nil? # use/try DATABASE_URL from environment
28
28
 
29
29
  logger.debug "ENV['DATBASE_URL'] - >#{ENV['DATABASE_URL']}<"
30
30
 
@@ -40,7 +40,7 @@ class Connecter
40
40
  database: db.path[1..-1],
41
41
  encoding: 'utf8'
42
42
  }
43
- else
43
+ else # assume sqlite3
44
44
  config = {
45
45
  adapter: db.scheme, # sqlite3
46
46
  database: db.path[1..-1] # pluto.db (NB: cut off leading /, thus 1..-1)
@@ -51,16 +51,42 @@ class Connecter
51
51
  puts 'db settings:'
52
52
  pp config
53
53
 
54
+ ### for dbbrowser and other tools add to ActiveRecord
55
+
56
+ if ActiveRecord::Base.configurations.nil? # todo/check: can this ever happen? remove?
57
+ puts "ActiveRecord configurations nil - set to empty hash"
58
+ ActiveRecord::Base.configurations = {} # make it an empty hash
59
+ end
60
+
61
+ if debug?
62
+ puts 'ar configurations (before):'
63
+ pp ActiveRecord::Base.configurations
64
+ end
65
+
66
+ # note: for now always use pluto key for config storage
67
+ ActiveRecord::Base.configurations['pluto'] = config
68
+
69
+ if debug?
70
+ puts 'ar configurations (after):'
71
+ pp ActiveRecord::Base.configurations
72
+ end
73
+
74
+
54
75
  # for debugging - disable for production use
55
76
  if debug?
56
77
  ActiveRecord::Base.logger = Logger.new( STDOUT )
57
78
  end
58
79
 
80
+
59
81
  ActiveRecord::Base.establish_connection( config )
60
-
82
+
61
83
  # first time? - auto-run db migratation, that is, create db tables
84
+ unless ActivityDb::Models::Activity.table_exists?
85
+ ActivityDb::CreateDb.new.up
86
+ end
87
+
62
88
  unless Models::Feed.table_exists?
63
- CreateDb.new.up
89
+ CreateDb.new.up
64
90
  end
65
91
  end # method connect!
66
92
 
@@ -1,12 +1,8 @@
1
1
  module Pluto
2
2
  module Models
3
3
 
4
-
5
- class Action < ActiveRecord::Base
6
- self.table_name = 'actions'
7
-
8
- end
9
-
4
+ # add shortcut/alias
5
+ Activity = ActivityDb::Models::Activity
10
6
 
11
7
  end # module Models
12
8
  end # module Pluto
@@ -21,8 +21,8 @@ class Refresher
21
21
  @worker.debug = true # also pass along worker debug flag if set
22
22
  end
23
23
 
24
- # -- log update action
25
- Action.create!( title: 'update feeds' )
24
+ # -- log update activity
25
+ Activity.create!( text: 'update feeds' )
26
26
 
27
27
  feeds_fetched = Time.now
28
28
 
@@ -45,8 +45,8 @@ class Refresher
45
45
  @worker.debug = true # also pass along worker debug flag if set
46
46
  end
47
47
 
48
- # -- log update action
49
- Action.create!( title: "update feeds >#{site_key}<" )
48
+ # -- log update activity
49
+ Activity.create!( text: "update feeds >#{site_key}<" )
50
50
 
51
51
  #####
52
52
  # -- update fetched timestamps for all sites
data/lib/pluto/schema.rb CHANGED
@@ -91,13 +91,6 @@ class CreateDb < ActiveRecord::Migration
91
91
  ## todo: add author/authors, category/categories
92
92
  end
93
93
 
94
- create_table :actions do |t|
95
- t.string :title # e.g. new site, new subscription, update feeds, etc.
96
- t.string :object # todo: find better names for action attribs ??
97
- t.string :object_type
98
- t.timestamps
99
- end
100
-
101
94
  end
102
95
 
103
96
  def down
@@ -21,7 +21,9 @@ class Subscriber
21
21
  site_attribs = {
22
22
  title: config['title'] || config['name'] # support either title or name
23
23
  }
24
-
24
+
25
+ logger.debug "site_attribs: #{site_attribs.inspect}"
26
+
25
27
  site_rec = Site.find_by_key( site_key )
26
28
  if site_rec.nil?
27
29
  site_rec = Site.new
@@ -29,12 +31,12 @@ class Subscriber
29
31
 
30
32
  ## use object_id: site.id and object_type: Site
31
33
  ## change - model/table/schema!!!
32
- Action.create!( title: "new site >#{site_key}<", object: site_attribs[ :title ] )
34
+ Activity.create!( text: "new site >#{site_key}< - #{site_attribs[ :title ]}" )
33
35
  end
34
36
  site_rec.update_attributes!( site_attribs )
35
37
 
36
- # -- log update action
37
- Action.create!( title: "update subscriptions >#{site_key}<" )
38
+ # -- log update activity
39
+ Activity.create!( text: "update subscriptions >#{site_key}<" )
38
40
 
39
41
  # clean out subscriptions and add again
40
42
  logger.debug "before site.subscriptions.delete_all - count: #{site_rec.subscriptions.count}"
@@ -81,7 +83,7 @@ class Subscriber
81
83
  ## use object_id: feed.id and object_type: Feed
82
84
  ## change - model/table/schema!!!
83
85
  ## todo: add parent_action_id - why? why not?
84
- Action.create!( title: "new feed >#{feed_key}<", object: feed_attribs[ :title ] )
86
+ Activity.create!( text: "new feed >#{feed_key}< - #{feed_attribs[ :title ]}" )
85
87
  end
86
88
 
87
89
  feed_rec.update_attributes!( feed_attribs )
data/lib/pluto/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Pluto
3
- VERSION = '0.9.0'
3
+ VERSION = '0.9.1'
4
4
  end
data/lib/pluto.rb CHANGED
@@ -27,6 +27,7 @@ require 'pakman' # template pack manager
27
27
  require 'feedutils'
28
28
  require 'textutils'
29
29
 
30
+ require 'activityutils'
30
31
 
31
32
  # our own code
32
33
 
@@ -34,7 +35,7 @@ require 'pluto/version' # let version always get first
34
35
  require 'pluto/schema'
35
36
  require 'pluto/activerecord'
36
37
 
37
- require 'pluto/models/action'
38
+ require 'pluto/models/activity'
38
39
  require 'pluto/models/feed'
39
40
  require 'pluto/models/item'
40
41
  require 'pluto/models/site'
@@ -54,10 +55,12 @@ require 'pluto/formatter'
54
55
 
55
56
  require 'pluto/cli/opts' ## fix: make sure fetcher/updater etc. do not depend on cli/opts
56
57
 
58
+
57
59
  module Pluto
58
60
 
59
61
  def self.banner
60
- "pluto #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
62
+ ### todo: add RUBY_PATCHLEVEL or RUBY_PATCH_LEVEL e.g. -p124
63
+ "pluto/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
61
64
  end
62
65
 
63
66
  def self.generator # convenience alias for banner (matches HTML generator meta tag)
@@ -133,5 +136,5 @@ end
133
136
  if __FILE__ == $0
134
137
  Pluto.main
135
138
  else
136
- puts Pluto.banner # say hello
139
+ puts Pluto.banner # say hello
137
140
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pluto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-11 00:00:00.000000000 Z
12
+ date: 2013-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pakman
16
- requirement: &85034260 !ruby/object:Gem::Requirement
16
+ requirement: &81472690 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *85034260
24
+ version_requirements: *81472690
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fetcher
27
- requirement: &85034020 !ruby/object:Gem::Requirement
27
+ requirement: &81472130 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.4.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *85034020
35
+ version_requirements: *81472130
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: logutils
38
- requirement: &85033740 !ruby/object:Gem::Requirement
38
+ requirement: &81494060 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.6'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *85033740
46
+ version_requirements: *81494060
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: feedutils
49
- requirement: &85033490 !ruby/object:Gem::Requirement
49
+ requirement: &81493690 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,21 +54,21 @@ dependencies:
54
54
  version: 0.4.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *85033490
57
+ version_requirements: *81493690
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: props
60
- requirement: &85033170 !ruby/object:Gem::Requirement
60
+ requirement: &81493150 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
64
64
  - !ruby/object:Gem::Version
65
- version: 1.0.2
65
+ version: 1.0.3
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *85033170
68
+ version_requirements: *81493150
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: textutils
71
- requirement: &85032890 !ruby/object:Gem::Requirement
71
+ requirement: &81492890 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,21 @@ dependencies:
76
76
  version: '0.7'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *85032890
79
+ version_requirements: *81492890
80
+ - !ruby/object:Gem::Dependency
81
+ name: activityutils
82
+ requirement: &81492660 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: 0.1.0
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: *81492660
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: gli
82
- requirement: &85032620 !ruby/object:Gem::Requirement
93
+ requirement: &81492380 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ! '>='
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: 2.5.6
88
99
  type: :runtime
89
100
  prerelease: false
90
- version_requirements: *85032620
101
+ version_requirements: *81492380
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: rdoc
93
- requirement: &85032330 !ruby/object:Gem::Requirement
104
+ requirement: &81492080 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ~>
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '3.10'
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *85032330
112
+ version_requirements: *81492080
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: hoe
104
- requirement: &85032040 !ruby/object:Gem::Requirement
115
+ requirement: &81491610 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ~>
@@ -109,7 +120,7 @@ dependencies:
109
120
  version: '3.3'
110
121
  type: :development
111
122
  prerelease: false
112
- version_requirements: *85032040
123
+ version_requirements: *81491610
113
124
  description: pluto - Another Planet Generator (Lets You Build Web Pages from Published
114
125
  Web Feeds)
115
126
  email: feedreader@googlegroups.com
@@ -135,7 +146,7 @@ files:
135
146
  - lib/pluto/installer.rb
136
147
  - lib/pluto/lister.rb
137
148
  - lib/pluto/manifest_helpers.rb
138
- - lib/pluto/models/action.rb
149
+ - lib/pluto/models/activity.rb
139
150
  - lib/pluto/models/feed.rb
140
151
  - lib/pluto/models/item.rb
141
152
  - lib/pluto/models/site.rb