planet 0.5.2 → 0.5.3

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: a452a7fa90ffe5f8068a88ac07983ee2ce13a3b5
4
- data.tar.gz: db39ed053a48787f6057462204c267778d32f1b2
3
+ metadata.gz: fc9853812a11a4693abf7bd40cb460904efb136c
4
+ data.tar.gz: c85ae576b4f93b369a5f85fb4c2daa77c231e4ac
5
5
  SHA512:
6
- metadata.gz: 49068d50bc0f7afdb365d42a5f273aa35efcce2e6476b2f35596ef5f6adcbb19357aeb75a9bb05d13c222d8b5403e1b7c572c65eda2d3e33d156a38502ad8ede
7
- data.tar.gz: d10d441aadc823b766e1d295f6ae68b0caf78dd134fd4c6a45ade0ce86da08e7e954ebc226943eb00cba3a57b6c3903b8a869a60946bb58a5ec92575768ce470
6
+ metadata.gz: e657ce7a41137f5d88aac9c72ed02b6a037dfa1bb4d93f108e33f8e91f7a48ee09aab6695d304511693f1fd634d14822a1a2663b31cc39d2f5976e8c8c759736
7
+ data.tar.gz: 9d918de83e623d4f60ff086660c2c16ea9844c36968e44a1aa86c952f36dce04b4d6b97b975c6ae8ec3877b68b0debb97aa99b1bf70e3f91208ba7bbe950c583
data/bin/planet CHANGED
@@ -10,6 +10,8 @@ include GLI::App
10
10
 
11
11
  program_desc 'Planet.rb is an awesome feed-aggregator gem that consumes RSS/Atom feeds and outputs them in a format suitable to use with Octopress or Jekyll'
12
12
 
13
+ flag [:c,:config], :default_value => 'planet.yml', :desc => "Planet configuration file"
14
+
13
15
  desc 'Parses planet.yml file for blogs and generates their posts in Jekyll compliant format under the _posts directory'
14
16
  command :generate do |c|
15
17
 
@@ -21,7 +23,7 @@ due to spacing issues possible with markdown.
21
23
  }
22
24
  c.action do |global_options,options,args|
23
25
 
24
- Planet::Importer.import('planet.yml') do |planet|
26
+ Planet::Importer.import(global_options[:config]) do |planet|
25
27
 
26
28
  post_extension = options[:extension] || 'markdown'
27
29
  post_extension = '.' + post_extension unless post_extension[0] == '.'
@@ -43,18 +45,17 @@ end
43
45
  desc 'Creates basic planet.yml config file'
44
46
  command :init do |c|
45
47
  c.action do |global_options,options,args|
46
- abort 'There is already a planet.yml file present' if File.exist? 'planet.yml'
47
-
48
- File.open('planet.yml', 'w') { |f| f.write(Box::FILES['planet']) }
49
-
50
- puts '=> Created default planet.yml'
48
+ abort 'There is already a planet.yml file present' if File.exist?(global_options[:config])
49
+ File.open(global_options[:config], 'w') { |f| f.write(Box::FILES['planet']) }
50
+ puts "=> Created default #{global_options[:config]}"
51
51
  end
52
52
  end
53
53
 
54
- desc 'Creates basic templates on the templates_directory specified in planet.yml'
54
+ desc "Creates basic templates on the templates_directory specified in configuration file"
55
55
  command :create_templates do |c|
56
56
  c.action do |global_options,options,args|
57
- conf = YAML.load_file('planet.yml')
57
+ STDERR.puts "DEBUG: #{caller.first} global_options[:config]=#{global_options[:config].inspect}"
58
+ conf = YAML.load_file(global_options[:config])
58
59
 
59
60
  templates_dir = conf.fetch('planet').fetch('templates_directory', 'source/_layouts/')
60
61
 
@@ -86,25 +87,24 @@ end
86
87
  desc 'Delete existing templates and recreate them'
87
88
  command :update_templates do |c|
88
89
  c.action do |global_options,options,args|
89
- conf = YAML.load_file('planet.yml')
90
+ conf = YAML.load_file(global_options[:config])
90
91
 
91
92
  templates_dir = conf.fetch('planet').fetch('templates_directory', 'source/_layouts/')
92
93
 
93
94
  author = templates_dir + 'author.html'
94
95
  header = templates_dir + 'header.md'
95
96
 
96
-
97
97
  File.delete(author) if File.exists?(author)
98
98
  File.delete(header) if File.exists?(header)
99
99
 
100
- response = `#{ $0 } create_templates`
100
+ response = `#{$0} -d #{global_options[:config]} create_templates`
101
101
  puts response
102
102
  end
103
103
  end
104
104
 
105
105
  pre do |global,command,options,args|
106
106
  if command.name == :generate
107
- conf = YAML.load_file('planet.yml')
107
+ conf = YAML.load_file(global[:config])
108
108
 
109
109
  templates_dir = conf.fetch('planet').fetch('templates_directory', 'source/_layouts')
110
110
  FileUtils.mkdir_p(templates_dir)
@@ -114,7 +114,9 @@ pre do |global,command,options,args|
114
114
  files.each do |name, path|
115
115
  if !File.exists?(path)
116
116
  puts "=> You are missing some files in your templates directory, planet.rb will create them for you - make sure to review them on #{ templates_dir }!"
117
- response = `#{$0} create_templates`
117
+
118
+ response = `#{$0} -c #{global[:config]} create_templates`
119
+
118
120
  puts response
119
121
  elsif Box::FILES[name] != File.read(path)
120
122
  puts "!! WARNING: your planet.rb template files are different from the default, if you haven't made specific changes to them yourself then planet.rb default templates might have changed.Run 'planet update_templates' to override your current files with the newest default file available."
@@ -130,6 +132,8 @@ post do |global,command,options,args|
130
132
  end
131
133
 
132
134
  on_error do |exception|
135
+ STDERR.puts "Error: #{exception} (#{exception.class})"
136
+ STDERR.puts exception.backtrace.join("\n")
133
137
  true
134
138
  end
135
139
 
@@ -1,4 +1,4 @@
1
- require 'feedzirra'
1
+ require 'feedjira'
2
2
  require 'set'
3
3
 
4
4
  # Parsers class - manager for the feed parsers
@@ -44,7 +44,7 @@ class Planet::Parsers
44
44
  end
45
45
 
46
46
  # returns any parser that can handle this feeds' domain,
47
- # defaults to Feedzirra if none available.
47
+ # defaults to Feedjira if none available.
48
48
  def get_parser_for(feed)
49
49
  feed_domain = URI(feed).host
50
50
 
@@ -52,7 +52,7 @@ class Planet::Parsers
52
52
  return parser if feed_domain.end_with? domain
53
53
  end
54
54
 
55
- return Feedzirra::Feed # default generic parser
55
+ return Feedjira::Feed # default generic parser
56
56
  end
57
57
  end
58
58
 
@@ -1,3 +1,4 @@
1
+ require 'stringex_lite'
1
2
  require 'mustache'
2
3
 
3
4
  class Planet::Post
@@ -26,6 +27,7 @@ class Planet::Post
26
27
  author: self.blog.author,
27
28
  blog_url: self.blog.url,
28
29
  blog_name: self.blog.name,
30
+ blog_slug: self.blog.name.to_url(:limit => 50, :truncate_words => true),
29
31
  post_url: self.url,
30
32
  twitter: self.blog.twitter,
31
33
  twitter_url: "http://twitter.com/#{ self.blog.twitter }",
@@ -55,7 +57,7 @@ class Planet::Post
55
57
  name_date = date ? date.strftime('%Y-%m-%d') : nil
56
58
  name_title = title.downcase.scan(/\w+/).join('-')
57
59
 
58
- [name_date, name_title].join('-')
60
+ [name_date, name_title].join('-')[0..59] # can return a file name that is too long, so truncate here to 60 chars
59
61
  end
60
62
 
61
63
  end
@@ -2,7 +2,7 @@ class Planet
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 5
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  def self.to_s
8
8
  [MAJOR, MINOR, PATCH].join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: planet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - PoTe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-08 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: feedzirra
28
+ name: feedjira
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '>='
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: stringex
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description:
70
84
  email: pote@tardis.com.uy
71
85
  executables: