planet 0.3.7 → 0.3.8

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.
Files changed (3) hide show
  1. data/bin/planet +42 -46
  2. data/lib/planet/version.rb +1 -1
  3. metadata +1 -17
data/bin/planet CHANGED
@@ -1,11 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'gli'
4
- require 'box'
5
4
  require 'planet'
6
5
 
7
6
  include GLI
8
- include Box
9
7
 
10
8
  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'
11
9
 
@@ -40,7 +38,27 @@ command :init do |c|
40
38
  c.action do |global_options,options,args|
41
39
  abort 'There is already a planet.yml file present' if File.exist? 'planet.yml'
42
40
 
43
- File.open('planet.yml', 'w') { |f| f.write(Box::FILES['planet.yml']) }
41
+ default = '## Planet.rb default config file, modify it and spawn awesomeness!
42
+
43
+ planet:
44
+ posts_directory: source/_posts/
45
+ templates_directory: source/_layouts/
46
+
47
+ blogs:
48
+ # Bare minimum to get it working
49
+ - author: "Cubox"
50
+ feed: "http://blog.cuboxlabs.com/atom.xml"
51
+ image: "http://cuboxlabs.com/img/cubox-humans/could-be-you.png"
52
+
53
+ - author: "Pablo Astigarraga"
54
+ feed: "http://blog.poteland.com/atom.xml"
55
+ image: "http://poteland.com/images/avatars/red_mage.png"
56
+ # Other fields:
57
+ twitter: "poteland"
58
+ url: "http://blog.poteland.com" # => only required for people that don\'t have a \'url\' field on their RSS/Atom field'
59
+
60
+
61
+ File.open('planet.yml', 'w') { |f| f.write(default) }
44
62
 
45
63
  puts '=> Created default planet.yml'
46
64
  end
@@ -51,19 +69,35 @@ command :create_templates do |c|
51
69
  c.action do |global_options,options,args|
52
70
  conf = YAML.load_file('planet.yml')
53
71
 
54
- templates_dir = conf.fetch('planet').fetch('templates_directory', 'source/_layouts/')
72
+ templates_dir = conf.fetch('planet').fetch('templates_directory', '_layouts/')
55
73
 
56
74
  FileUtils.mkdir_p(templates_dir)
57
75
 
76
+ author = '
77
+ <div class="author">
78
+ <img src="{{ image_url }}" style="width: 96px; height: 96;">
79
+ <span style="position: absolute; padding: 32px 15px;">
80
+ <i>Original post by <a href="{{ twitter_url }}">{{ author }}</a> - check out <a href="{{ blog_url }}">{{ blog_name }}</a></i>
81
+ </span>
82
+ </div>
83
+ '
58
84
  if !File.exists?(templates_dir + 'author.html')
59
- File.open(templates_dir + 'author.html', 'w') { |f| f.write(Box::FILES['author.html']) }
85
+ File.open(templates_dir + 'author.html', 'w') { |f| f.write(author) }
60
86
  puts "=> Created default #{ templates_dir }author.html"
61
87
  else
62
88
  puts "=> Template #{ templates_dir }author.html already exists, skipping"
63
89
  end
64
90
 
91
+ header ='---
92
+ title: "{{ post_title }}"
93
+ kind: article
94
+ created_at: {{ post_date }}
95
+ author: {{ author }}
96
+ layout: post
97
+ ---
98
+ '
65
99
  if !File.exists?(templates_dir + 'header.md')
66
- File.open(templates_dir + 'header.md', 'w') { |f| f.write(Box::FILES['header.md']) }
100
+ File.open(templates_dir + 'header.md', 'w') { |f| f.write(header) }
67
101
  puts "=> Created default #{ templates_dir }header.md"
68
102
  else
69
103
  puts "=> Template #{ templates_dir }header.md already exists, skipping"
@@ -75,10 +109,10 @@ pre do |global,command,options,args|
75
109
  if command.name == :generate
76
110
  conf = YAML.load_file('planet.yml')
77
111
 
78
- templates_dir = conf.fetch('planet').fetch('templates_directory', 'source/_layouts/')
112
+ templates_dir = conf.fetch('planet').fetch('templates_directory', 'source/_layouts')
79
113
  FileUtils.mkdir_p(templates_dir)
80
114
 
81
- files = [templates_dir, templates_dir + 'author.html', templates_dir + 'header.md']
115
+ files = [templates_dir + 'author.html', templates_dir + 'header.md']
82
116
 
83
117
  files.each do |file|
84
118
  unless File.exists?(file)
@@ -101,41 +135,3 @@ on_error do |exception|
101
135
  end
102
136
 
103
137
  exit GLI.run(ARGV)
104
-
105
- __END__
106
- @@ header.md
107
- ---
108
- title: "{{ post_title }}"
109
- kind: article
110
- created_at: {{ post_date }}
111
- author: {{ author }}
112
- layout: post
113
- ---
114
-
115
- @@ author.html
116
- <div class="author">
117
- <img src="{{ image_url }}" style="width: 96px; height: 96;">
118
- <span style="position: absolute; padding: 32px 15px;">
119
- <i>Original post by <a href="{{ twitter_url }}">{{ author }}</a> - check out <a href="{{ blog_url }}">{{ blog_name }}</a></i>
120
- </span>
121
- </div>
122
-
123
- @@ planet.yml
124
- ## planet.rb default config file, modify it and spawn awesomeness!
125
-
126
- planet:
127
- posts_directory: source/_posts/
128
- templates_directory: source/_layouts/
129
-
130
- blogs:
131
- # Bare minimum to get it working
132
- - author: "Cubox"
133
- feed: "http://blog.cuboxlabs.com/atom.xml"
134
- image: "http://cuboxlabs.com/img/cubox-humans/could-be-you.png"
135
-
136
- - author: "Pablo Astigarraga"
137
- feed: "http://blog.poteland.com/atom.xml"
138
- image: "http://poteland.com/images/avatars/red_mage.png"
139
- # Other fields:
140
- twitter: "poteland"
141
- url: "http://blog.poteland.com" # => only required for people that don\'t have a \'url\' field on their RSS/Atom field'
@@ -2,7 +2,7 @@ module Planet
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- PATCH = 7
5
+ PATCH = 8
6
6
 
7
7
  def self.to_s
8
8
  [MAJOR, MINOR, PATCH].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: planet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -75,22 +75,6 @@ dependencies:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: box
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :runtime
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
78
  description:
95
79
  email: pote@tardis.com.uy
96
80
  executables: