hikkoshi 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b22a2e482d35d86ff7a9a4d93e6a23744d77f3fc
4
+ data.tar.gz: 115c62d742875ca4267988e7c545c6de4cc33d0a
5
+ SHA512:
6
+ metadata.gz: d3effd2c71bfb283077b1e0b70503e783006fa35c4c42a62e9455b31e29a94cfe3e060fca1563be5657c2602074fc8f59dbfcb53d81dea525a05c94ea8d1f0b8
7
+ data.tar.gz: c7d1065c5faf29ef23f24a20061f871e9928e45c0a357c91837f43fbc2f353ed9489c1d50f7ad304f683bad64d7925660067117d02e1be2263bc9fcab8956dce
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hikkoshi.gemspec
4
+ gemspec
5
+
6
+ gem "hikkoshi-jekyll", :path => '../hikkoshi-jekyll', :group => :development
7
+ gem "hikkoshi-hexo", :path => '../hikkoshi-hexo', :group => :development
8
+ gem "hikkoshi-logdown", :path => '../hikkoshi-logdown', :group => :development
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hikkoshi (0.0.1)
5
+ activesupport
6
+
7
+ PATH
8
+ remote: ../hikkoshi-hexo
9
+ specs:
10
+ hikkoshi-hexo (0.0.1)
11
+ hikkoshi-jekyll (~> 0.0.1)
12
+
13
+ PATH
14
+ remote: ../hikkoshi-jekyll
15
+ specs:
16
+ hikkoshi-jekyll (0.0.1)
17
+ hikkoshi (~> 0.0.1)
18
+
19
+ PATH
20
+ remote: ../hikkoshi-logdown
21
+ specs:
22
+ hikkoshi-logdown (0.0.1)
23
+ hikkoshi (~> 0.0.1)
24
+ hikkoshi-jekyll (~> 0.0.1)
25
+
26
+ GEM
27
+ remote: https://rubygems.org/
28
+ specs:
29
+ activesupport (4.2.0)
30
+ i18n (~> 0.7)
31
+ json (~> 1.7, >= 1.7.7)
32
+ minitest (~> 5.1)
33
+ thread_safe (~> 0.3, >= 0.3.4)
34
+ tzinfo (~> 1.1)
35
+ byebug (3.5.1)
36
+ columnize (~> 0.8)
37
+ debugger-linecache (~> 1.2)
38
+ slop (~> 3.6)
39
+ coderay (1.1.0)
40
+ columnize (0.9.0)
41
+ debugger-linecache (1.2.0)
42
+ i18n (0.7.0)
43
+ json (1.8.1)
44
+ method_source (0.8.2)
45
+ minitest (5.5.0)
46
+ pry (0.10.1)
47
+ coderay (~> 1.1.0)
48
+ method_source (~> 0.8.1)
49
+ slop (~> 3.4)
50
+ pry-byebug (2.0.0)
51
+ byebug (~> 3.4)
52
+ pry (~> 0.10)
53
+ rake (10.4.2)
54
+ slop (3.6.0)
55
+ thread_safe (0.3.4)
56
+ tzinfo (1.2.2)
57
+ thread_safe (~> 0.1)
58
+
59
+ PLATFORMS
60
+ ruby
61
+
62
+ DEPENDENCIES
63
+ bundler (~> 1.7)
64
+ hikkoshi!
65
+ hikkoshi-hexo!
66
+ hikkoshi-jekyll!
67
+ hikkoshi-logdown!
68
+ pry-byebug (~> 2.0.0)
69
+ rake (~> 10.0)
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Yu-Cheng Chuang
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,25 @@
1
+ # Hikkoshi Core Functionality
2
+
3
+ This gem contains the core functionality to make Hikkoshi work.
4
+
5
+ ## Installation
6
+
7
+ $ gem install hikkoshi
8
+
9
+ ## Usage
10
+
11
+ See ../README.md instead.
12
+
13
+ *TODO: how to create a new blog support*
14
+
15
+ ## Contributing
16
+
17
+ 1. Fork it ( https://github.com/[my-github-username]/hikkoshi/fork )
18
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
19
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
20
+ 4. Push to the branch (`git push origin my-new-feature`)
21
+ 5. Create a new Pull Request
22
+
23
+ ## License
24
+
25
+ MIT License. See "LICENSE.txt".
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH << File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'optparse'
6
+ require 'active_support/inflector'
7
+
8
+ require 'hikkoshi'
9
+
10
+ options = {}
11
+
12
+ OptionParser.new {|opts|
13
+ opts.banner = "Usage: \e[1mhikkoshi -f BLOG_SYSTEM_A -t BLOG_SYSTEM_B -i INPUT_PATH -o OUTPUT_PATH\e[m"
14
+
15
+ opts.separator ""
16
+ opts.separator "Required arguments:"
17
+
18
+ opts.on("-f BLOG_SYSTEM_A", "Your current blog system, e.g. jekyll") {|from|
19
+ options[:from] = from
20
+ }
21
+
22
+ opts.on("-t BLOG_SYSTEM_B", "Your target blog system, e.g. ghost") {|to|
23
+ options[:to] = to
24
+ }
25
+
26
+ opts.on("-i INPUT_PATH", "Location of your current blog posts.") {|filename|
27
+ options[:input] = File.expand_path(filename)
28
+ }
29
+
30
+ opts.on("-o OUTPUT_PATH", "Location to store the exported file(s).") {|filename|
31
+ options[:output] = File.expand_path(filename)
32
+ }
33
+
34
+ opts.separator ""
35
+ opts.separator "Example: hikkoshi -f jekyll -t ghost -i ~/blog-jekyll/_posts/ -o ~/tmp/ghost.json"
36
+ }.parse!
37
+
38
+ load_success = true
39
+
40
+ begin
41
+ require "hikkoshi/#{options[:from]}"
42
+ rescue LoadError => e
43
+ STDERR.puts "Unable to load importer for #{options[:from]}. Try `gem install hikkoshi-#{options[:from]}`."
44
+ load_success = false
45
+ end
46
+
47
+ begin
48
+ require "hikkoshi/#{options[:to]}"
49
+ rescue LoadError => e
50
+ STDERR.puts "Unable to load exporter for #{options[:to]}. Try `gem install hikkoshi-#{options[:to]}`."
51
+ load_success = false
52
+ end
53
+
54
+ exit(1) unless load_success
55
+
56
+ importer_class = "hikkoshi/#{options[:from]}/importer".camelize.constantize
57
+ exporter_class = "hikkoshi/#{options[:to]}/exporter".camelize.constantize
58
+
59
+ importer = importer_class.new(options[:input])
60
+ exporter = exporter_class.new(importer.posts)
61
+ exporter.export(options[:output])
62
+
63
+ puts "Exported #{importer.posts.size} posts."
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hikkoshi/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "hikkoshi"
8
+ spec.version = Hikkoshi::VERSION
9
+ spec.authors = ["Yu-Cheng Chuang"]
10
+ spec.email = ["ducksteven@gmail.com"]
11
+ spec.summary = %q{Blog Moving Tool Framework}
12
+ spec.description = %q{A frmaework to move your blog from one system to another"}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "activesupport"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "pry-byebug", "~> 2.0.0"
26
+ end
@@ -0,0 +1,14 @@
1
+ require "hikkoshi/version"
2
+
3
+ module Hikkoshi
4
+ autoload :Post, "hikkoshi/post"
5
+ autoload :Tag, "hikkoshi/tag"
6
+
7
+ autoload :Importer, "hikkoshi/importer"
8
+ autoload :Exporter, "hikkoshi/exporter"
9
+
10
+ module Support
11
+ autoload :Slugify, "hikkoshi/support/slugify"
12
+ autoload :TimeParser, "hikkoshi/support/time_parser"
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ class Hikkoshi::Exporter
2
+ def initialize(posts)
3
+ @posts = posts
4
+ end
5
+
6
+ def export(target)
7
+ raise NotImplementedError
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ class Hikkoshi::Importer
2
+ attr_reader :posts
3
+
4
+ def initialize(source)
5
+ raise NotImplementedError
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ class Hikkoshi::Post
2
+ attr_accessor :content
3
+
4
+ attr_accessor :title, :slug, :status,
5
+ :published_at, :created_at, :updated_at,
6
+ :tags, :categories,
7
+ :layout,
8
+ :comments
9
+
10
+ attr_accessor :extra_metadata
11
+
12
+ def initialize
13
+ @extra_metadata = OpenStruct.new
14
+
15
+ @status = "published"
16
+ @categories = []
17
+ @tags = []
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ module Hikkoshi::Support
2
+ module Slugify
3
+ RE_INVALID = /[\s[:punct:]]+/
4
+
5
+ def slugify(text, delimiter="-")
6
+ text.split(RE_INVALID).join(delimiter).downcase
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ require "time"
2
+
3
+ module Hikkoshi::Support
4
+ module TimeParser
5
+ def parse_time(time)
6
+ # Assume local time zone
7
+ Time.parse(time) rescue nil
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module Hikkoshi
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hikkoshi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yu-Cheng Chuang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.0
69
+ description: A frmaework to move your blog from one system to another"
70
+ email:
71
+ - ducksteven@gmail.com
72
+ executables:
73
+ - hikkoshi
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/hikkoshi
83
+ - hikkoshi.gemspec
84
+ - lib/hikkoshi.rb
85
+ - lib/hikkoshi/exporter.rb
86
+ - lib/hikkoshi/importer.rb
87
+ - lib/hikkoshi/post.rb
88
+ - lib/hikkoshi/support/slugify.rb
89
+ - lib/hikkoshi/support/time_parser.rb
90
+ - lib/hikkoshi/version.rb
91
+ homepage: ''
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.2.2
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Blog Moving Tool Framework
115
+ test_files: []