jekyll-import 0.1.0.beta4 → 0.1.0.rc1

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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/History.markdown +5 -0
  3. data/Rakefile +114 -11
  4. data/jekyll-import.gemspec +67 -2
  5. data/lib/jekyll-import.rb +3 -5
  6. data/lib/jekyll-import/importer.rb +6 -0
  7. data/lib/jekyll-import/importers/rss.rb +2 -2
  8. data/lib/jekyll-import/importers/s9y.rb +1 -1
  9. data/lib/jekyll-import/importers/textpattern.rb +1 -1
  10. data/site/.gitignore +4 -0
  11. data/site/CNAME +1 -0
  12. data/site/README +1 -0
  13. data/site/_config.yml +7 -0
  14. data/site/_includes/analytics.html +32 -0
  15. data/site/_includes/docs_contents.html +10 -0
  16. data/site/_includes/docs_contents_mobile.html +14 -0
  17. data/site/_includes/docs_option.html +11 -0
  18. data/site/_includes/docs_ul.html +20 -0
  19. data/site/_includes/footer.html +15 -0
  20. data/site/_includes/header.html +18 -0
  21. data/site/_includes/news_contents.html +23 -0
  22. data/site/_includes/news_contents_mobile.html +11 -0
  23. data/site/_includes/news_item.html +24 -0
  24. data/site/_includes/primary-nav-items.html +14 -0
  25. data/site/_includes/section_nav.html +22 -0
  26. data/site/_includes/top.html +17 -0
  27. data/site/_layouts/default.html +12 -0
  28. data/site/_layouts/docs.html +29 -0
  29. data/site/_layouts/news.html +19 -0
  30. data/site/_layouts/news_item.html +27 -0
  31. data/site/_posts/2013-11-09-jekyll-import-0-1-0-beta4-release.markdown +23 -0
  32. data/site/_posts/2013-11-18-jekyll-import-0-1-0-rc1-released.markdown +17 -0
  33. data/site/css/gridism.css +110 -0
  34. data/site/css/normalize.css +1 -0
  35. data/site/css/pygments.css +70 -0
  36. data/site/css/style.css +946 -0
  37. data/site/docs/contributing.md +8 -0
  38. data/site/docs/csv.md +25 -0
  39. data/site/docs/drupal6.md +24 -0
  40. data/site/docs/drupal7.md +24 -0
  41. data/site/docs/enki.md +23 -0
  42. data/site/docs/google_reader.md +19 -0
  43. data/site/docs/history.md +7 -0
  44. data/site/docs/index.md +17 -0
  45. data/site/docs/installation.md +26 -0
  46. data/site/docs/joomla.md +26 -0
  47. data/site/docs/jrnl.md +23 -0
  48. data/site/docs/marley.md +20 -0
  49. data/site/docs/mephisto.md +23 -0
  50. data/site/docs/mt.md +23 -0
  51. data/site/docs/posterous.md +25 -0
  52. data/site/docs/rss.md +19 -0
  53. data/site/docs/s9y.md +19 -0
  54. data/site/docs/textpattern.md +30 -0
  55. data/site/docs/third-party.md +30 -0
  56. data/site/docs/tumblr.md +24 -0
  57. data/site/docs/typo.md +26 -0
  58. data/site/docs/usage.md +28 -0
  59. data/site/docs/wordpress.md +31 -0
  60. data/site/docs/wordpressdotcom.md +44 -0
  61. data/site/favicon.png +0 -0
  62. data/site/feed.xml +36 -0
  63. data/site/img/article-footer.png +0 -0
  64. data/site/img/footer-arrow.png +0 -0
  65. data/site/img/footer-logo.png +0 -0
  66. data/site/img/logo-2x.png +0 -0
  67. data/site/img/octojekyll.png +0 -0
  68. data/site/img/tube.png +0 -0
  69. data/site/img/tube1x.png +0 -0
  70. data/site/index.html +100 -0
  71. data/site/js/modernizr-2.5.3.min.js +4 -0
  72. data/site/news/index.html +10 -0
  73. data/site/news/releases/index.html +10 -0
  74. metadata +68 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbe997aa363075c0bba1d699dd1b4ccbcd29f080
4
- data.tar.gz: 6856676d49ecf6a8c64eebd4f85bd846696e63f4
3
+ metadata.gz: cb0a7bbe8aca1585023f14fd2c866837814187a3
4
+ data.tar.gz: 03d0d027aed6b677d10f4a29abbdb15baa6dbe13
5
5
  SHA512:
6
- metadata.gz: 303be81dcf7b40d878d25153ced30e8865602c8fe0b6b8f57111c021accd27ce3b6e5df2cb95290a2f23fa66fbdcdf791fa79cbdc527ba2851435a4d142902cf
7
- data.tar.gz: 5812ffbedffcf64ce640c8af5d1140347d71406e2020e75fece71797b4f744b7e8ab29702a29d52ca27dbd11eda12a58698b36015dde65e287b869c41eb859ee
6
+ metadata.gz: 74f2d5907720b4e013bba9edc05ea0bf12247e8015ea03c5fc8254d696eb3f0811cbf1a3c41cbd864888edecc466d07503f05119e4de8264530a0cfd88e088b2
7
+ data.tar.gz: 1c422eee36df10b8b7458bb3fcc205e6e9af79d610442a228ea88b9b9e2cc92f630dc3158f56fdf4782ea0600fe152cef178e45d32be9c9282ed1022f213610f
data/History.markdown CHANGED
@@ -22,6 +22,8 @@
22
22
  * Improve the handling of tags in the Drupal 6 importer. Tags with
23
23
  spaces are handled now and the importer doesn't eat tags anymore. (#42)
24
24
  * Upgrade to `jekyll ~> 1.3` and `safe_yaml ~> 0.9.7`
25
+ * Add license to gemspec (#83)
26
+ * Add an `Importer.run` method for easy invocation (#88)
25
27
 
26
28
  ### Bug Fixes
27
29
  * Remove usage of `Hash#at` in Tumblr importer (#14)
@@ -39,8 +41,11 @@
39
41
  * Fix bug where post date in `MT` importer was not imported for older versions
40
42
  of MT sites (#62)
41
43
  * Fix interface of importers' `#process` method (#69)
44
+ * RSS importer should specify `--source` option (#81)
45
+ * Fix fetching of parameters from options hash (#86)
42
46
 
43
47
  ### Site Enhancements
48
+ * Add the site (#87)
44
49
 
45
50
  ### Development Fixes
46
51
  * Update usage docs in RSS importer (#35)
data/Rakefile CHANGED
@@ -9,7 +9,9 @@
9
9
 
10
10
  require 'rubygems'
11
11
  require 'rake'
12
+ require 'rdoc'
12
13
  require 'date'
14
+ require 'yaml'
13
15
 
14
16
  #############################################################################
15
17
  #
@@ -46,6 +48,39 @@ def replace_header(head, header_name)
46
48
  head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
47
49
  end
48
50
 
51
+ def normalize_bullets(markdown)
52
+ markdown.gsub(/\s{2}\*{1}/, "-")
53
+ end
54
+
55
+ def linkify_prs(markdown)
56
+ markdown.gsub(/#(\d+)/) do |word|
57
+ "[#{word}]({{ site.repository }}/issues/#{word.delete("#")})"
58
+ end
59
+ end
60
+
61
+ def linkify_users(markdown)
62
+ markdown.gsub(/(@\w+)/) do |username|
63
+ "[#{username}](https://github.com/#{username.delete("@")})"
64
+ end
65
+ end
66
+
67
+ def linkify(markdown)
68
+ linkify_users(linkify_prs(markdown))
69
+ end
70
+
71
+ def liquid_escape(markdown)
72
+ markdown.gsub(/(`{[{%].+[}%]}`)/, "{% raw %}\\1{% endraw %}")
73
+ end
74
+
75
+ def remove_head_from_history(markdown)
76
+ index = markdown =~ /^##\s+\d+\.\d+\.\d+/
77
+ markdown[index..-1]
78
+ end
79
+
80
+ def converted_history(markdown)
81
+ remove_head_from_history(liquid_escape(linkify(normalize_bullets(markdown))))
82
+ end
83
+
49
84
  #############################################################################
50
85
  #
51
86
  # Standard tasks
@@ -76,22 +111,90 @@ end
76
111
 
77
112
  #############################################################################
78
113
  #
79
- # Custom tasks (add your own tasks here)
114
+ # Site tasks - http://import.jekyllrb.com
80
115
  #
81
116
  #############################################################################
82
117
 
83
- namespace :migrate do
84
- desc "Migrate from mephisto in the current directory"
85
- task :mephisto do
86
- sh %q(ruby -r './lib/jekyll/migrators/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["SERVER"]}", "#{ENV["DB"]}")')
118
+ namespace :site do
119
+ desc "Generate and view the site locally"
120
+ task :preview do
121
+ require "launchy"
122
+
123
+ # Yep, it's a hack! Wait a few seconds for the Jekyll site to generate and
124
+ # then open it in a browser. Someday we can do better than this, I hope.
125
+ Thread.new do
126
+ sleep 4
127
+ puts "Opening in browser..."
128
+ Launchy.open("http://localhost:4000")
129
+ end
130
+
131
+ # Generate the site in server mode.
132
+ puts "Running Jekyll..."
133
+ Dir.chdir("site") do
134
+ sh "jekyll serve --watch"
135
+ end
87
136
  end
88
- desc "Migrate from Movable Type in the current directory"
89
- task :mt do
90
- sh %q(ruby -r './lib/jekyll/migrators/mt' -e 'Jekyll::MT.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
137
+
138
+ desc "Update normalize.css library to the latest version and minify"
139
+ task :update_normalize_css do
140
+ Dir.chdir("site/css") do
141
+ sh 'curl "http://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"'
142
+ sh 'sass "normalize.scss":"normalize.css" --style compressed'
143
+ sh 'rm "normalize.scss"'
144
+ end
91
145
  end
92
- desc "Migrate from Typo in the current directory"
93
- task :typo do
94
- sh %q(ruby -r './lib/jekyll/migrators/typo' -e 'Jekyll::Typo.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
146
+
147
+ desc "Commit the local site to the gh-pages branch and publish to GitHub Pages"
148
+ task :publish => [:history] do
149
+ sh "git subtree push --prefix site origin gh-pages"
150
+ end
151
+
152
+ desc "Create a nicely formatted history page for the jekyll site based on the repo history."
153
+ task :history do
154
+ if File.exist?("History.markdown")
155
+ history_file = File.read("History.markdown")
156
+ front_matter = {
157
+ "layout" => "docs",
158
+ "title" => "History",
159
+ "permalink" => "/docs/history/",
160
+ "prev_section" => "contributing"
161
+ }
162
+ Dir.chdir('site/docs/') do
163
+ File.open("history.md", "w") do |file|
164
+ file.write("#{front_matter.to_yaml}---\n\n")
165
+ file.write(converted_history(history_file))
166
+ end
167
+ end
168
+ sh "git add site/docs/history.md"
169
+ sh "git commit -m 'Updated generated history.md file in the site.'"
170
+ else
171
+ abort "You seem to have misplaced your History.markdown file. I can haz?"
172
+ end
173
+ end
174
+
175
+ namespace :releases do
176
+ desc "Create new release post"
177
+ task :new, :version do |t, args|
178
+ raise "Specify a version: rake site:releases:new['1.2.3']" unless args.version
179
+ today = Time.new.strftime('%Y-%m-%d')
180
+ release = args.version.to_s
181
+ filename = "site/_posts/#{today}-jekyll-import-#{release.split('.').join('-')}-released.markdown"
182
+
183
+ File.open(filename, "wb") do |post|
184
+ post.puts("---")
185
+ post.puts("layout: news_item")
186
+ post.puts("title: 'jekyll-import #{release} Released'")
187
+ post.puts("date: #{Time.new.strftime('%Y-%m-%d %H:%M:%S %z')}")
188
+ post.puts("author: ")
189
+ post.puts("version: #{version}")
190
+ post.puts("categories: [release]")
191
+ post.puts("---")
192
+ post.puts
193
+ post.puts
194
+ end
195
+
196
+ puts "Created #{filename}"
197
+ end
95
198
  end
96
199
  end
97
200
 
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
5
5
  s.required_ruby_version = '>= 1.9.2'
6
6
 
7
7
  s.name = 'jekyll-import'
8
- s.version = '0.1.0.beta4'
9
- s.date = '2013-11-09'
8
+ s.version = '0.1.0.rc1'
9
+ s.date = '2013-11-18'
10
10
  s.rubyforge_project = 'jekyll-import'
11
11
 
12
12
  s.summary = "Import command for Jekyll (static site generator)."
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.authors = ["Tom Preston-Werner"]
16
16
  s.email = 'tom@mojombo.com'
17
17
  s.homepage = 'http://github.com/jekyll/jekyll-import'
18
+ s.license = 'MIT'
18
19
 
19
20
  s.require_paths = %w[lib]
20
21
 
@@ -76,6 +77,70 @@ Gem::Specification.new do |s|
76
77
  lib/jekyll-import/importers/wordpress.rb
77
78
  lib/jekyll-import/importers/wordpressdotcom.rb
78
79
  lib/jekyll/commands/import.rb
80
+ site/.gitignore
81
+ site/CNAME
82
+ site/README
83
+ site/_config.yml
84
+ site/_includes/analytics.html
85
+ site/_includes/docs_contents.html
86
+ site/_includes/docs_contents_mobile.html
87
+ site/_includes/docs_option.html
88
+ site/_includes/docs_ul.html
89
+ site/_includes/footer.html
90
+ site/_includes/header.html
91
+ site/_includes/news_contents.html
92
+ site/_includes/news_contents_mobile.html
93
+ site/_includes/news_item.html
94
+ site/_includes/primary-nav-items.html
95
+ site/_includes/section_nav.html
96
+ site/_includes/top.html
97
+ site/_layouts/default.html
98
+ site/_layouts/docs.html
99
+ site/_layouts/news.html
100
+ site/_layouts/news_item.html
101
+ site/_posts/2013-11-09-jekyll-import-0-1-0-beta4-release.markdown
102
+ site/_posts/2013-11-18-jekyll-import-0-1-0-rc1-released.markdown
103
+ site/css/gridism.css
104
+ site/css/normalize.css
105
+ site/css/pygments.css
106
+ site/css/style.css
107
+ site/docs/contributing.md
108
+ site/docs/csv.md
109
+ site/docs/drupal6.md
110
+ site/docs/drupal7.md
111
+ site/docs/enki.md
112
+ site/docs/google_reader.md
113
+ site/docs/history.md
114
+ site/docs/index.md
115
+ site/docs/installation.md
116
+ site/docs/joomla.md
117
+ site/docs/jrnl.md
118
+ site/docs/marley.md
119
+ site/docs/mephisto.md
120
+ site/docs/mt.md
121
+ site/docs/posterous.md
122
+ site/docs/rss.md
123
+ site/docs/s9y.md
124
+ site/docs/textpattern.md
125
+ site/docs/third-party.md
126
+ site/docs/tumblr.md
127
+ site/docs/typo.md
128
+ site/docs/usage.md
129
+ site/docs/wordpress.md
130
+ site/docs/wordpressdotcom.md
131
+ site/favicon.png
132
+ site/feed.xml
133
+ site/img/article-footer.png
134
+ site/img/footer-arrow.png
135
+ site/img/footer-logo.png
136
+ site/img/logo-2x.png
137
+ site/img/octojekyll.png
138
+ site/img/tube.png
139
+ site/img/tube1x.png
140
+ site/index.html
141
+ site/js/modernizr-2.5.3.min.js
142
+ site/news/index.html
143
+ site/news/releases/index.html
79
144
  test/helper.rb
80
145
  test/test_jrnl_importer.rb
81
146
  test/test_mt_importer.rb
data/lib/jekyll-import.rb CHANGED
@@ -8,7 +8,7 @@ require 'jekyll-import/importer'
8
8
  require 'jekyll-import/importers'
9
9
 
10
10
  module JekyllImport
11
- VERSION = '0.1.0.beta4'
11
+ VERSION = '0.1.0.rc1'
12
12
 
13
13
  def self.logger
14
14
  @logger ||= Jekyll::Stevenson.new
@@ -27,10 +27,8 @@ module JekyllImport
27
27
  cmd.command(name.to_sym) do |c|
28
28
  c.syntax "jekyll import #{name} [options]"
29
29
  importer.specify_options(c)
30
- c.action do |args, options|
31
- importer.require_deps
32
- importer.validate(options) if importer.respond_to?(:validate)
33
- importer.process(options)
30
+ c.action do |_, options|
31
+ importer.run(options)
34
32
  end
35
33
  end
36
34
  end
@@ -7,5 +7,11 @@ module JekyllImport
7
7
  def self.subclasses
8
8
  @subclasses ||= []
9
9
  end
10
+
11
+ def self.run(options = {})
12
+ self.require_deps
13
+ self.validate(options) if self.respond_to?(:validate)
14
+ self.process(options)
15
+ end
10
16
  end
11
17
  end
@@ -12,7 +12,7 @@ module JekyllImport
12
12
  module Importers
13
13
  class RSS < Importer
14
14
  def self.specify_options(c)
15
- c.option 'file', '--file NAME', 'The RSS file to import'
15
+ c.option 'source', '--source NAME', 'The RSS file or URL to import'
16
16
  end
17
17
 
18
18
  def self.validate(options)
@@ -37,7 +37,7 @@ module JekyllImport
37
37
  #
38
38
  # Returns nothing.
39
39
  def self.process(options)
40
- source = options.fetch('file')
40
+ source = options.fetch('source')
41
41
 
42
42
  content = ""
43
43
  open(source) { |s| content = s.read }
@@ -28,7 +28,7 @@ module JekyllImport
28
28
  end
29
29
 
30
30
  def self.process(options)
31
- source = options.fetch(:source)
31
+ source = options.fetch('source')
32
32
 
33
33
  FileUtils.mkdir_p("_posts")
34
34
 
@@ -39,7 +39,7 @@ module JekyllImport
39
39
  def self.process(options)
40
40
  dbname = options.fetch('dbname')
41
41
  user = options.fetch('user')
42
- pass = options.fetch('password')
42
+ pass = options.fetch('password', "")
43
43
  host = options.fetch('host', "localhost")
44
44
 
45
45
  db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8')
data/site/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ _site/
2
+ *.swp
3
+ pkg/
4
+ test/
data/site/CNAME ADDED
@@ -0,0 +1 @@
1
+ import.jekyllrb.com
data/site/README ADDED
@@ -0,0 +1 @@
1
+ Jekyll's awesome website.
data/site/_config.yml ADDED
@@ -0,0 +1,7 @@
1
+ title: "jekyll-import • Import your old &amp; busted site to Jekyll"
2
+ pygments: true
3
+ relative_permalinks: false
4
+ permalink: /news/:year/:month/:day/:title/
5
+ excerpt_separator: ""
6
+ repository: https://github.com/jekyll/jekyll-import
7
+ latest_release: 0.1.0.beta4
@@ -0,0 +1,32 @@
1
+ {% if site.gauges_id %}
2
+ <!-- Gauges (http://gaug.es/) -->
3
+ <script type="text/javascript">
4
+ var _gauges = _gauges || [];
5
+ (function() {
6
+ var t = document.createElement('script');
7
+ t.type = 'text/javascript';
8
+ t.async = true;
9
+ t.id = 'gauges-tracker';
10
+ t.setAttribute('data-site-id', '{{ site.gauges_id }}');
11
+ t.src = '//secure.gaug.es/track.js';
12
+ var s = document.getElementsByTagName('script')[0];
13
+ s.parentNode.insertBefore(t, s);
14
+ })();
15
+ </script>
16
+ {% endif %}
17
+
18
+ {% if site.google_analytics_id %}
19
+ <!-- Google Analytics (http://google.com/analytics) -->
20
+ <script type="text/javascript">
21
+ var _gaq = _gaq || [];
22
+ _gaq.push(['_setAccount', '{{ site.google_analytics_id }}']);
23
+ _gaq.push(['_setDomainName', '{{ site.url }}']); // Multiple sub-domains
24
+ _gaq.push(['_setAllowLinker', true]); // Multiple TLDs
25
+ _gaq.push(['_trackPageview']);
26
+ (function() {
27
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
28
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
29
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
30
+ })();
31
+ </script>
32
+ {% endif %}
@@ -0,0 +1,10 @@
1
+ <div class="unit one-fifth hide-on-mobiles">
2
+ <aside>
3
+ <h4>Getting Started</h4>
4
+ {% include docs_ul.html items='home installation usage' %}
5
+ <h4>Importers</h4>
6
+ {% include docs_ul.html items='csv drupal6 drupal7 enki google_reader joomla jrnl marley mephisto mt posterous rss s9y textpattern tumblr typo wordpress wordpressdotcom' %}
7
+ <h4>Meta</h4>
8
+ {% include docs_ul.html items='third-party contributing history' %}
9
+ </aside>
10
+ </div>
@@ -0,0 +1,14 @@
1
+ <div class="docs-nav-mobile unit whole show-on-mobiles">
2
+ <select onchange="if (this.value) window.location.href=this.value">
3
+ <option value="">Navigate the docs…</option>
4
+ <optgroup label="Getting started">
5
+ {% include docs_option.html items='home installation usage' %}
6
+ </optgroup>
7
+ <optgroup label="Importers">
8
+ {% include docs_option.html items='csv drupal6 drupal7 enki google_reader joomla jrnl marley mephisto mt posterous rss s9y textpattern tumblr typo wordpress wordpressdotcom' %}
9
+ </optgroup>
10
+ <optgroup label="Meta">
11
+ {% include docs_option.html items='third-party contributing history' %}
12
+ </optgroup>
13
+ </select>
14
+ </div>
@@ -0,0 +1,11 @@
1
+ {% assign items = include.items | split: ' ' %}
2
+
3
+ {% for item in items %}
4
+ {% assign item_url = item | prepend:'/docs/' | append:'/' %}
5
+
6
+ {% for p in site.pages %}
7
+ {% if p.url == item_url %}
8
+ <option value="{{ site.url }}{{ p.url }}">{{ p.title }}</option>
9
+ {% endif %}
10
+ {% endfor %}
11
+ {% endfor %}