jekyll-reposter 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -14,10 +14,14 @@ gem "jekyll-reposter"
14
14
 
15
15
  ## Usage
16
16
 
17
- create a ruby file in the jekyll root folder or subfolder like "tools"/"import"
18
- etc. and fill in:
17
+ create a ruby file in your blog's root folder, or a subfolder like "tools", "import" etc. Here I use a executable in my root, called ```repost-notes```
18
+
19
19
 
20
20
  ```ruby
21
+ #!/usr/bin/env ruby
22
+ #
23
+ require "bundler"
24
+ Bundler.setup
21
25
  require "jekyll-reposter"
22
26
 
23
27
  reposter = Jekyll::Reposter.new "http://notes.it-jobs-und-stellen.de/notes.atom",
@@ -28,18 +32,17 @@ reposter.create_if do |entry|
28
32
  end
29
33
  ```
30
34
 
31
- This will create all blog posts, if not exists yet inside my
35
+ This will create all blog posts, if not existing yet inside my
32
36
  ```source/_posts/notes.it-jobs-und-stellen.de`` folder.
33
37
 
34
- The ```create_if``` directive decideds if a blog posts is created. So if you
38
+ The ```create_if``` directive decides if a blog posts is created. So if you
35
39
  want to filter the passed feed, like to only show specific authors posts, then
36
40
  here you can add any logic. In our case, we post all new items.
37
41
 
38
42
 
39
43
  After finshed, you can run that script like
40
- ```bash
41
- ruby tools/notes.rb
42
- ```
44
+ ```chmod +x repost-notes && ruby repost-notes```
45
+
43
46
  any time in your workflow, to add all new posts. Afterwards, check formatting and
44
47
  add categories if necessary.
45
48
 
@@ -4,7 +4,7 @@ $:.push File.expand_path("../lib", __FILE__)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "jekyll-reposter"
7
- s.version = "0.1.1"
7
+ s.version = "0.1.2"
8
8
  s.authors = ["Stefan Wienert"]
9
9
  s.email = ["stefan.wienert@pludoni.de"]
10
10
  s.homepage = "https://github.com/zealot128/jekyll-reposter"
@@ -64,19 +64,18 @@ module Jekyll
64
64
  unless File.exists? filename
65
65
  content = Sanitize.clean entry.content, :elements => @options[:allowed_tags]
66
66
 
67
- end
68
- @replacings.each do |from,to|
69
- content.gsub! from, to
70
- end
67
+ @replacings.each do |from,to|
68
+ content.gsub! from, to
69
+ end
71
70
 
72
- meta = {
73
- "title" => entry.title,
74
- "date" => entry.published.strftime("%Y-%m-%d %H:%M"),
75
- }.merge(@options[:meta])
71
+ meta = {
72
+ "title" => entry.title,
73
+ "date" => entry.published.strftime("%Y-%m-%d %H:%M"),
74
+ }.merge(@options[:meta])
76
75
 
77
- tags = @options[:tags]
78
- file = <<DOC
79
- #{meta.to_yaml}
76
+ tags = @options[:tags]
77
+ file = <<DOC
78
+ #{meta.to_yaml}
80
79
  categories: #{tags}
81
80
  ---
82
81
  #{content}
@@ -85,16 +84,17 @@ categories: #{tags}
85
84
  <i>Reposted from <a href='#{entry.url}' rel='canonical'>#{@uri.host}</a></i>
86
85
  DOC
87
86
 
88
- if !@options[:pretend]
89
- File.open filename, "w+" do |f|
90
- puts "Writing #{filename}"
91
- f.write file
87
+ if !@options[:pretend]
88
+ File.open filename, "w+" do |f|
89
+ puts "Writing #{filename}"
90
+ f.write file
91
+ end
92
+ else
93
+ breakwater = (["="] * 20).join + "\n"
94
+ puts "#{breakwater}Would create #{filename} with content:\n#{breakwater}#{file}"
92
95
  end
93
- else
94
- breakwater = (["="] * 20).join + "\n"
95
- puts "#{breakwater}Would create #{filename} with content:\n#{breakwater}#{file}"
96
- end
97
96
 
97
+ end
98
98
  end
99
99
  end
100
100
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-reposter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: feedzirra
16
- requirement: &80739650 !ruby/object:Gem::Requirement
16
+ requirement: &85395680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *80739650
24
+ version_requirements: *85395680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: curb
27
- requirement: &80739350 !ruby/object:Gem::Requirement
27
+ requirement: &85395370 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.8'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *80739350
35
+ version_requirements: *85395370
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: stringex
38
- requirement: &80739080 !ruby/object:Gem::Requirement
38
+ requirement: &85395130 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *80739080
46
+ version_requirements: *85395130
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sanitize
49
- requirement: &80738830 !ruby/object:Gem::Requirement
49
+ requirement: &85394810 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *80738830
57
+ version_requirements: *85394810
58
58
  description: Provides a interface for generating posts as a repost from external feeds.
59
59
  Tested with octopress.
60
60
  email: