logi 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +50 -1
- data/Rakefile +2 -2
- data/bin/logi-list +2 -2
- data/bin/logi-post +2 -2
- data/bin/logi-wiki +4 -0
- data/example/config/logi.rb +4 -3
- data/example/layout/list.html.erb +16 -0
- data/example/public/hello.html +2 -1
- data/example/public/index.html +2 -1
- data/example/public/list.html +16 -0
- data/example/public/misc/about.html +2 -1
- data/lib/logi.rb +11 -55
- data/lib/logi/command/list.rb +19 -0
- data/lib/logi/command/post.rb +12 -0
- data/lib/logi/command/wiki.rb +14 -0
- data/lib/logi/compiler.rb +44 -0
- data/lib/logi/config.rb +47 -12
- data/lib/logi/loader.rb +41 -0
- data/lib/logi/logger.rb +39 -0
- data/lib/logi/post.rb +3 -0
- data/lib/logi/runner.rb +60 -11
- data/lib/logi/version.rb +1 -1
- data/logi.gemspec +18 -8
- metadata +17 -8
- data/pkg/logi-0.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3475cb97948ff33502fbd216c8724b9b3de00ae5
|
4
|
+
data.tar.gz: 732a3c178a6ce76c9e53732046f0c2ee5282aa4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 518489b42423a530f1c129c1bb0f59f61ebd6d90485b7b1459fb527503b630f37f7a8078530e41c78846fb71c08b601aa3ce685a23b9353fea10144921458e64
|
7
|
+
data.tar.gz: 49ac258973c40a12737c0e47d4cf123aae429cc84ae3191988a0e3cebf43612dbd2fea9c5e4246a6bbfbe9b78a31289ab32dae11239f0925ce98556a0f12e54a
|
data/.gitignore
ADDED
data/README.md
CHANGED
@@ -14,18 +14,67 @@ Highly customizable static blog/wiki generator.
|
|
14
14
|
|
15
15
|
## FEATURES:
|
16
16
|
|
17
|
-
|
17
|
+
* Generate posts via external commands, so you can customize it easily.
|
18
|
+
* Built-in post/list generator using [tilt][]. Support any tilt format.
|
19
|
+
* Specify configuration in [config/logi.rb](example/config/logi.rb).
|
20
|
+
* Basic wiki syntax: `[[wiki]]` or `[[wiki|text]]`.
|
21
|
+
* Write your own layouts.
|
22
|
+
|
23
|
+
[tilt]: https://github.com/rtomayko/tilt
|
18
24
|
|
19
25
|
## REQUIREMENTS:
|
20
26
|
|
21
27
|
* Tested with MRI (official CRuby) 2.0.0, Rubinius and JRuby.
|
28
|
+
* Tilt for built-in post/list generator: `gem install tilt`
|
22
29
|
|
23
30
|
## INSTALLATION:
|
24
31
|
|
25
32
|
gem install logi
|
33
|
+
gem install tilt # if you want to use built-in generators
|
26
34
|
|
27
35
|
## SYNOPSIS:
|
28
36
|
|
37
|
+
You can check the [example blog](example). Or read help:
|
38
|
+
|
39
|
+
$ logi -h
|
40
|
+
Usage: logi \[OPTIONS\] \[PATH to logi root\]
|
41
|
+
logi options:
|
42
|
+
-c, --color Color mode (default)
|
43
|
+
-n, --no-color No color mode
|
44
|
+
-V, --verbose Verbose mode (default)
|
45
|
+
-q, --quiet Quiet mode
|
46
|
+
-h, --help Print this message
|
47
|
+
-v, --version Print the version
|
48
|
+
defaults:
|
49
|
+
root directory .
|
50
|
+
post directory post
|
51
|
+
layout directory layout
|
52
|
+
output directory public
|
53
|
+
post command post
|
54
|
+
layout file /path/to/logi/lib/logi/layout/default.html.erb
|
55
|
+
|
56
|
+
## Built-in generators
|
57
|
+
|
58
|
+
* [logi-post](bin/logi-post)
|
59
|
+
* [logi-list](bin/logi-list)
|
60
|
+
|
61
|
+
## Write your own generators
|
62
|
+
|
63
|
+
Suppose you want to use [pandoc][] to generate your post, you could build
|
64
|
+
a command line tool called `logi-pandoc` which the first argument would
|
65
|
+
be the path to the original post file, and the second argument to the
|
66
|
+
path of the layout file. Also, read from `stdin` for post content
|
67
|
+
preprocessed for the wiki syntax.
|
68
|
+
|
69
|
+
So you could think of it like this:
|
70
|
+
|
71
|
+
logi-wiki post.md | logi-pandoc post.md layout.html.erb > post.html
|
72
|
+
|
73
|
+
For a more complex generator, you could see [logi-list](bin/logi-list)
|
74
|
+
which would generate a post listing all the posts.
|
75
|
+
|
76
|
+
[pandoc]: http://johnmacfarlane.net/pandoc/
|
77
|
+
|
29
78
|
## CONTRIBUTORS:
|
30
79
|
|
31
80
|
* Lin Jen-Shin (@godfat)
|
data/Rakefile
CHANGED
@@ -16,8 +16,8 @@ task 'gem:spec' do
|
|
16
16
|
require 'logi/version'
|
17
17
|
s.name = 'logi'
|
18
18
|
s.version = Logi::VERSION
|
19
|
-
%w[
|
20
|
-
%w[bacon muack].each{ |g| s.add_development_dependency(g) }
|
19
|
+
%w[].each{ |g| s.add_dependency(g) }
|
20
|
+
%w[bacon muack tilt].each{ |g| s.add_development_dependency(g) }
|
21
21
|
end
|
22
22
|
|
23
23
|
Gemgem.write
|
data/bin/logi-list
CHANGED
data/bin/logi-post
CHANGED
data/bin/logi-wiki
ADDED
data/example/config/logi.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
|
2
|
-
layout 'default.html.erb'
|
3
|
-
|
4
2
|
post_path 'post'
|
3
|
+
layout_path 'layout'
|
5
4
|
output_path 'public'
|
6
5
|
|
6
|
+
layout 'default.html.erb'
|
7
|
+
|
7
8
|
post 'hello.md', :layout => 'another.html.erb'
|
8
|
-
list 'list' , :layout => '
|
9
|
+
list 'list' , :layout => 'list.html.erb'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Logi's example blog</title>
|
6
|
+
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<h1>Posts listing</h1>
|
10
|
+
<ul>
|
11
|
+
<% @posts.each do |post| %>
|
12
|
+
<li><a href="<%= post.link %>"><%= post.title %></a></li>
|
13
|
+
<% end %>
|
14
|
+
</ul>
|
15
|
+
</body>
|
16
|
+
</html>
|
data/example/public/hello.html
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
<html lang="en">
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
|
-
<title>Logi</title>
|
5
|
+
<title>Another Logi</title>
|
6
6
|
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
|
7
7
|
</head>
|
8
8
|
<body>
|
9
|
+
<h1>This is a specialized layout.</h1>
|
9
10
|
|
10
11
|
<h1 id="hello-world">Hello, World!</h1>
|
11
12
|
|
data/example/public/index.html
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
<html lang="en">
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
|
-
<title>Logi</title>
|
5
|
+
<title>Logi's example blog</title>
|
6
6
|
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
|
7
7
|
</head>
|
8
8
|
<body>
|
9
|
+
<h1>This is the default layout from user.</h1>
|
9
10
|
|
10
11
|
<h1 id="logis-example-blog">Logi's example blog</h1>
|
11
12
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Logi's example blog</title>
|
6
|
+
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<h1>Posts listing</h1>
|
10
|
+
<ul>
|
11
|
+
<li><a href="hello.html">hello</a></li>
|
12
|
+
<li><a href="index.html">index</a></li>
|
13
|
+
<li><a href="misc/about.html">misc/about</a></li>
|
14
|
+
</ul>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -2,10 +2,11 @@
|
|
2
2
|
<html lang="en">
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
|
-
<title>Logi</title>
|
5
|
+
<title>Logi's example blog</title>
|
6
6
|
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
|
7
7
|
</head>
|
8
8
|
<body>
|
9
|
+
<h1>This is the default layout from user.</h1>
|
9
10
|
|
10
11
|
<h1 id="about">About</h1>
|
11
12
|
|
data/lib/logi.rb
CHANGED
@@ -1,66 +1,22 @@
|
|
1
1
|
|
2
2
|
require 'logi/config'
|
3
|
-
|
4
|
-
require 'fileutils'
|
5
|
-
require 'cgi'
|
6
|
-
require 'tilt'
|
3
|
+
require 'logi/compiler'
|
7
4
|
|
8
5
|
class Logi
|
9
|
-
attr_reader :
|
10
|
-
def initialize
|
11
|
-
@
|
6
|
+
attr_reader :options, :config, :compiler
|
7
|
+
def initialize options={}
|
8
|
+
@options = options
|
9
|
+
@config = Config.new(options)
|
10
|
+
@compiler = Compiler.new(options)
|
12
11
|
end
|
13
12
|
|
14
13
|
def make
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def posts
|
23
|
-
@posts ||= Dir["#{full_post_path}/**/*.*"].inject({}) do |r, path|
|
24
|
-
r[path] = layout_for(path)
|
25
|
-
r
|
26
|
-
end
|
27
|
-
end
|
14
|
+
config.posts.each_value do |post|
|
15
|
+
io = compiler.compile(post.command,
|
16
|
+
config.post_path_for(post),
|
17
|
+
config.layout_path_for(post))
|
28
18
|
|
29
|
-
|
30
|
-
@contents ||= posts.inject({}) do |r, (path, layout)|
|
31
|
-
content = File.read(path).gsub(/\[\[(.+?)(\|(.+?))?\]\]/) do
|
32
|
-
%Q{<a href="/#{CGI.escape_html($1)}.html">#{$3 || $1}</a>}
|
33
|
-
end
|
34
|
-
r[path] = Tilt.new(layout).render{Tilt[path].new{content}.render}
|
35
|
-
r
|
19
|
+
compiler.write(config.output_path_for(post), io)
|
36
20
|
end
|
37
21
|
end
|
38
|
-
|
39
|
-
def config
|
40
|
-
@config ||= Logi::Config.new(root)
|
41
|
-
end
|
42
|
-
|
43
|
-
def layout_for post
|
44
|
-
config.layout[post] || Logi::Config.default_layout
|
45
|
-
end
|
46
|
-
|
47
|
-
def post_path
|
48
|
-
config['post_path'] || Logi::Config.default_post_path
|
49
|
-
end
|
50
|
-
|
51
|
-
def output_path
|
52
|
-
config['output_path'] || Logi::Config.default_output_path
|
53
|
-
end
|
54
|
-
|
55
|
-
def post_name path
|
56
|
-
path.sub("#{full_post_path}/", '').sub(/\..+$/, '')
|
57
|
-
end
|
58
|
-
|
59
|
-
def full_post_path
|
60
|
-
"#{root}/#{post_path}"
|
61
|
-
end
|
62
|
-
|
63
|
-
def full_output_path
|
64
|
-
"#{root}/#{output_path}"
|
65
|
-
end
|
66
22
|
end
|
data/lib/logi/command/list.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
require 'tilt'
|
3
|
+
|
4
|
+
class Logi ; end
|
5
|
+
module Logi::Command; end
|
6
|
+
module Logi::Command::List
|
7
|
+
Post = Struct.new(:link, :title)
|
8
|
+
|
9
|
+
module_function
|
10
|
+
def run argv
|
11
|
+
path, layout = argv
|
12
|
+
dir = File.dirname(path)
|
13
|
+
@posts = Dir["#{dir}/**/*.*"].map{ |post|
|
14
|
+
name = post.sub("#{dir}/", '')
|
15
|
+
Post.new(name.sub(/\..+$/, '.html'), name.sub(/\..+$/, ''))
|
16
|
+
}
|
17
|
+
puts Tilt.new(layout).render(self)
|
18
|
+
end
|
19
|
+
end
|
data/lib/logi/command/post.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
require 'cgi'
|
3
|
+
|
4
|
+
class Logi ; end
|
5
|
+
module Logi::Command; end
|
6
|
+
module Logi::Command::Wiki
|
7
|
+
module_function
|
8
|
+
def run argv
|
9
|
+
return unless File.exist?(argv.first)
|
10
|
+
puts File.read(argv.first).gsub(/\[\[(.+?)(\|(.+?))?\]\]/){
|
11
|
+
%Q{<a href="/#{CGI.escape_html($1)}.html">#{$3 || $1}</a>}
|
12
|
+
}
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
require 'logi/logger'
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
class Logi; end
|
7
|
+
class Logi::Compiler
|
8
|
+
include Logi::Logger
|
9
|
+
|
10
|
+
attr_reader :options
|
11
|
+
def initialize options={}
|
12
|
+
@options = options
|
13
|
+
end
|
14
|
+
|
15
|
+
def compile command, path, layout
|
16
|
+
log_compile(command, path, layout)
|
17
|
+
wiki = IO.popen("logi-wiki #{path}", 'r')
|
18
|
+
out = IO.popen("logi-#{command} #{path} #{layout}", 'r+')
|
19
|
+
IO.copy_stream(wiki, out)
|
20
|
+
out.close_write
|
21
|
+
out
|
22
|
+
end
|
23
|
+
|
24
|
+
def write output, out
|
25
|
+
log_write(output)
|
26
|
+
FileUtils.mkdir_p(File.dirname(output))
|
27
|
+
IO.copy_stream(out, output)
|
28
|
+
ensure
|
29
|
+
out.close
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def log_compile command, path, layout
|
34
|
+
w = red('logi-wiki')
|
35
|
+
c = red("logi-#{command}")
|
36
|
+
p = magenta(strip_path(path))
|
37
|
+
l = yellow(strip_path(layout))
|
38
|
+
log "#{w} #{p} |\n#{c} #{p} #{l}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def log_write path
|
42
|
+
log "> #{green(strip_path(path))}"
|
43
|
+
end
|
44
|
+
end
|
data/lib/logi/config.rb
CHANGED
@@ -1,27 +1,62 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
require 'logi/loader'
|
3
|
+
|
4
|
+
class Logi; end
|
5
|
+
class Logi::Config < Struct.new(:post_path, :layout_path,
|
6
|
+
:output_path, :default_layout)
|
7
|
+
def self.default_root_path ; '.' ; end
|
8
|
+
def self.default_post_path ; 'post' ; end
|
9
|
+
def self.default_layout_path; 'layout'; end
|
10
|
+
def self.default_output_path; 'public'; end
|
11
|
+
def self.default_command ; 'post' ; end
|
3
12
|
def self.default_layout
|
4
13
|
File.expand_path("#{__dir__}/layout/default.html.erb")
|
5
14
|
end
|
6
15
|
|
7
|
-
|
8
|
-
|
16
|
+
attr_reader :options
|
17
|
+
attr_accessor
|
18
|
+
def initialize options={}
|
19
|
+
@options = options
|
20
|
+
Logi::Loader.new(self).load if File.exist?(path)
|
21
|
+
end
|
22
|
+
|
23
|
+
def posts
|
24
|
+
@posts ||= {}
|
25
|
+
end
|
26
|
+
|
27
|
+
def root
|
28
|
+
options[:root] || self.class.default_root_path
|
29
|
+
end
|
30
|
+
|
31
|
+
def path
|
32
|
+
"#{root}/config/logi.rb"
|
33
|
+
end
|
34
|
+
|
35
|
+
def post_path_for post
|
36
|
+
"#{root}/#{post_path}/#{post.path}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def layout_path_for post
|
40
|
+
if layout = post.options[:layout] || default_layout
|
41
|
+
"#{root}/#{layout_path}/#{layout}"
|
42
|
+
else
|
43
|
+
self.class.default_layout
|
44
|
+
end
|
9
45
|
end
|
10
46
|
|
11
|
-
def
|
12
|
-
'
|
47
|
+
def output_path_for post
|
48
|
+
"#{root}/#{output_path}/#{post.path.sub(/\..+$/, '')}.html"
|
13
49
|
end
|
14
50
|
|
15
|
-
|
16
|
-
|
17
|
-
@root = root
|
51
|
+
def post_path
|
52
|
+
super || self.class.default_post_path
|
18
53
|
end
|
19
54
|
|
20
|
-
def
|
21
|
-
|
55
|
+
def layout_path
|
56
|
+
super || self.class.default_layout_path
|
22
57
|
end
|
23
58
|
|
24
|
-
def
|
25
|
-
|
59
|
+
def output_path
|
60
|
+
super || self.class.default_output_path
|
26
61
|
end
|
27
62
|
end
|
data/lib/logi/loader.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
require 'logi/post'
|
3
|
+
|
4
|
+
class Logi; end
|
5
|
+
class Logi::Loader
|
6
|
+
attr_reader :config
|
7
|
+
def initialize config
|
8
|
+
@config = config
|
9
|
+
end
|
10
|
+
|
11
|
+
def load
|
12
|
+
instance_eval(File.read(config.path))
|
13
|
+
prefix = "#{config.root}/#{config.post_path}"
|
14
|
+
Dir["#{prefix}/**/*.*"].each do |fullpath|
|
15
|
+
path = fullpath.sub("#{prefix}/", '')
|
16
|
+
config.posts[path] ||=
|
17
|
+
Logi::Post.new(config.class.default_command, path, {}, nil)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def post_path path
|
22
|
+
config.post_path = path
|
23
|
+
end
|
24
|
+
|
25
|
+
def layout_path path
|
26
|
+
config.layout_path = path
|
27
|
+
end
|
28
|
+
|
29
|
+
def output_path path
|
30
|
+
config.output_path = path
|
31
|
+
end
|
32
|
+
|
33
|
+
def layout path
|
34
|
+
config.default_layout = path
|
35
|
+
end
|
36
|
+
|
37
|
+
def method_missing cmd, *args, &block
|
38
|
+
path, options = args[0], args[1]
|
39
|
+
config.posts[path] = Logi::Post.new(cmd, path, options, block)
|
40
|
+
end
|
41
|
+
end
|
data/lib/logi/logger.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
class Logi; end
|
3
|
+
module Logi::Logger
|
4
|
+
module_function
|
5
|
+
def log msg
|
6
|
+
return if options[:quiet]
|
7
|
+
puts msg
|
8
|
+
end
|
9
|
+
|
10
|
+
def black text; color(30, text); end
|
11
|
+
def red text; color(31, text); end
|
12
|
+
def green text; color(32, text); end
|
13
|
+
def yellow text; color(33, text); end
|
14
|
+
def blue text; color(34, text); end
|
15
|
+
def magenta text; color(35, text); end
|
16
|
+
def cyan text; color(36, text); end
|
17
|
+
def white text; color(37, text); end
|
18
|
+
def color rgb, text
|
19
|
+
if nocolor = options[:nocolor]
|
20
|
+
text
|
21
|
+
elsif nocolor.nil? && !$stdout.tty? # auto-detect
|
22
|
+
text
|
23
|
+
else
|
24
|
+
"\e[#{rgb}m#{text}\e[0m"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def strip_path path
|
29
|
+
strip_home_path(strip_cwd_path(path))
|
30
|
+
end
|
31
|
+
|
32
|
+
def strip_home_path path
|
33
|
+
path.sub(ENV['HOME'], '~')
|
34
|
+
end
|
35
|
+
|
36
|
+
def strip_cwd_path path
|
37
|
+
path.sub(Dir.pwd, '.')
|
38
|
+
end
|
39
|
+
end
|
data/lib/logi/post.rb
ADDED
data/lib/logi/runner.rb
CHANGED
@@ -3,28 +3,77 @@ class Logi; end
|
|
3
3
|
module Logi::Runner
|
4
4
|
module_function
|
5
5
|
def options
|
6
|
+
@options ||=
|
7
|
+
[['logi options:' , '' ],
|
8
|
+
['-c, --color' , ' Color mode (default)'],
|
9
|
+
['-n, --no-color' , 'No color mode' ],
|
10
|
+
['-V, --verbose' , ' Verbose mode (default)'],
|
11
|
+
['-q, --quiet' , ' Quiet mode' ],
|
12
|
+
['-h, --help' , 'Print this message' ],
|
13
|
+
['-v, --version' , 'Print the version' ],
|
14
|
+
['defaults:' , '' ],
|
15
|
+
[' root directory' , Logi::Config. default_root_path],
|
16
|
+
[' post directory' , Logi::Config. default_post_path],
|
17
|
+
['layout directory' , Logi::Config.default_layout_path],
|
18
|
+
['output directory' , Logi::Config.default_output_path],
|
19
|
+
[' post command' , Logi::Config.default_command ],
|
20
|
+
[' layout file' , Logi::Logger.strip_path(
|
21
|
+
Logi::Config.default_layout) ]]
|
6
22
|
end
|
7
23
|
|
8
24
|
def run argv=ARGV
|
9
|
-
|
10
|
-
|
25
|
+
options = parse(argv)
|
26
|
+
require 'logi' # lazily load logi since we might exit earlier
|
27
|
+
Logi.new(options).make
|
11
28
|
end
|
12
29
|
|
13
|
-
def
|
14
|
-
|
15
|
-
|
30
|
+
def parse argv
|
31
|
+
options = {}
|
32
|
+
until argv.empty?
|
33
|
+
case arg = argv.shift
|
34
|
+
when /^-c/, '--color'
|
35
|
+
options[:nocolor] = false
|
36
|
+
parse_next(argv, arg)
|
37
|
+
|
38
|
+
when /^-n/, '--no-color'
|
39
|
+
options[:nocolor] = true
|
40
|
+
parse_next(argv, arg)
|
41
|
+
|
42
|
+
when /^-V/, '--verbose'
|
43
|
+
options[:quiet] = false
|
44
|
+
parse_next(argv, arg)
|
45
|
+
|
46
|
+
when /^-q/, '--quiet'
|
47
|
+
options[:quiet] = true
|
48
|
+
parse_next(argv, arg)
|
16
49
|
|
17
|
-
|
18
|
-
|
50
|
+
when /^-h/, '--help'
|
51
|
+
puts(help)
|
52
|
+
exit
|
53
|
+
|
54
|
+
when /^-v/, '--version'
|
55
|
+
require 'rib/version'
|
56
|
+
puts(Rib::VERSION)
|
57
|
+
exit
|
58
|
+
|
59
|
+
else
|
60
|
+
options[:root] = File.expand_path(arg)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
options
|
19
64
|
end
|
20
65
|
|
21
|
-
def
|
66
|
+
def parse_next argv, arg
|
67
|
+
argv.unshift("-#{arg[2..-1]}") if arg.size > 2
|
22
68
|
end
|
23
69
|
|
24
70
|
def help
|
25
|
-
|
26
|
-
|
27
|
-
|
71
|
+
require 'logi/config'
|
72
|
+
require 'logi/logger'
|
73
|
+
optt = options.transpose
|
74
|
+
maxn = optt.first.map(&:size).max
|
75
|
+
maxd = [optt.last .map(&:size).max, `tput cols`.to_i - maxn - 4].min
|
76
|
+
"Usage: logi [OPTIONS] [PATH to logi root]\n" +
|
28
77
|
options.map{ |(name, desc)|
|
29
78
|
if name.end_with?(':')
|
30
79
|
name
|
data/lib/logi/version.rb
CHANGED
data/logi.gemspec
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: logi 0.1.0 ruby lib
|
2
3
|
|
3
4
|
Gem::Specification.new do |s|
|
4
5
|
s.name = "logi"
|
5
|
-
s.version = "0.0
|
6
|
+
s.version = "0.1.0"
|
6
7
|
|
7
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
9
|
s.authors = ["Lin Jen-Shin (godfat)"]
|
9
|
-
s.date = "2013-09-
|
10
|
+
s.date = "2013-09-20"
|
10
11
|
s.description = "Highly customizable static blog/wiki generator."
|
11
12
|
s.email = ["godfat (XD) godfat.org"]
|
12
13
|
s.executables = [
|
13
14
|
"logi",
|
14
15
|
"logi-list",
|
15
|
-
"logi-post"
|
16
|
+
"logi-post",
|
17
|
+
"logi-wiki"]
|
16
18
|
s.files = [
|
19
|
+
".gitignore",
|
17
20
|
".gitmodules",
|
18
21
|
"Gemfile",
|
19
22
|
"LICENSE",
|
@@ -22,48 +25,55 @@ Gem::Specification.new do |s|
|
|
22
25
|
"bin/logi",
|
23
26
|
"bin/logi-list",
|
24
27
|
"bin/logi-post",
|
28
|
+
"bin/logi-wiki",
|
25
29
|
"example/config/logi.rb",
|
26
30
|
"example/layout/another.html.erb",
|
27
31
|
"example/layout/default.html.erb",
|
32
|
+
"example/layout/list.html.erb",
|
28
33
|
"example/layout/misc/about.html.erb",
|
29
34
|
"example/post/hello.md",
|
30
35
|
"example/post/index.md",
|
31
36
|
"example/post/misc/about.md",
|
32
37
|
"example/public/hello.html",
|
33
38
|
"example/public/index.html",
|
39
|
+
"example/public/list.html",
|
34
40
|
"example/public/misc/about.html",
|
35
41
|
"lib/logi.rb",
|
36
42
|
"lib/logi/command/list.rb",
|
37
43
|
"lib/logi/command/post.rb",
|
44
|
+
"lib/logi/command/wiki.rb",
|
45
|
+
"lib/logi/compiler.rb",
|
38
46
|
"lib/logi/config.rb",
|
39
47
|
"lib/logi/layout/default.html.erb",
|
48
|
+
"lib/logi/loader.rb",
|
49
|
+
"lib/logi/logger.rb",
|
50
|
+
"lib/logi/post.rb",
|
40
51
|
"lib/logi/runner.rb",
|
41
52
|
"lib/logi/version.rb",
|
42
53
|
"logi.gemspec",
|
43
|
-
"pkg/logi-0.0.1.gem",
|
44
54
|
"task/.gitignore",
|
45
55
|
"task/gemgem.rb"]
|
46
56
|
s.homepage = "https://github.com/godfat/logi"
|
47
57
|
s.licenses = ["Apache License 2.0"]
|
48
58
|
s.require_paths = ["lib"]
|
49
|
-
s.rubygems_version = "2.
|
59
|
+
s.rubygems_version = "2.1.4"
|
50
60
|
s.summary = "Highly customizable static blog/wiki generator."
|
51
61
|
|
52
62
|
if s.respond_to? :specification_version then
|
53
63
|
s.specification_version = 4
|
54
64
|
|
55
65
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
-
s.add_runtime_dependency(%q<tilt>, [">= 0"])
|
57
66
|
s.add_development_dependency(%q<bacon>, [">= 0"])
|
58
67
|
s.add_development_dependency(%q<muack>, [">= 0"])
|
68
|
+
s.add_development_dependency(%q<tilt>, [">= 0"])
|
59
69
|
else
|
60
|
-
s.add_dependency(%q<tilt>, [">= 0"])
|
61
70
|
s.add_dependency(%q<bacon>, [">= 0"])
|
62
71
|
s.add_dependency(%q<muack>, [">= 0"])
|
72
|
+
s.add_dependency(%q<tilt>, [">= 0"])
|
63
73
|
end
|
64
74
|
else
|
65
|
-
s.add_dependency(%q<tilt>, [">= 0"])
|
66
75
|
s.add_dependency(%q<bacon>, [">= 0"])
|
67
76
|
s.add_dependency(%q<muack>, [">= 0"])
|
77
|
+
s.add_dependency(%q<tilt>, [">= 0"])
|
68
78
|
end
|
69
79
|
end
|
metadata
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lin Jen-Shin (godfat)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bacon
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
|
-
type: :
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: muack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: tilt
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '>='
|
@@ -59,9 +59,11 @@ executables:
|
|
59
59
|
- logi
|
60
60
|
- logi-list
|
61
61
|
- logi-post
|
62
|
+
- logi-wiki
|
62
63
|
extensions: []
|
63
64
|
extra_rdoc_files: []
|
64
65
|
files:
|
66
|
+
- .gitignore
|
65
67
|
- .gitmodules
|
66
68
|
- Gemfile
|
67
69
|
- LICENSE
|
@@ -70,25 +72,32 @@ files:
|
|
70
72
|
- bin/logi
|
71
73
|
- bin/logi-list
|
72
74
|
- bin/logi-post
|
75
|
+
- bin/logi-wiki
|
73
76
|
- example/config/logi.rb
|
74
77
|
- example/layout/another.html.erb
|
75
78
|
- example/layout/default.html.erb
|
79
|
+
- example/layout/list.html.erb
|
76
80
|
- example/layout/misc/about.html.erb
|
77
81
|
- example/post/hello.md
|
78
82
|
- example/post/index.md
|
79
83
|
- example/post/misc/about.md
|
80
84
|
- example/public/hello.html
|
81
85
|
- example/public/index.html
|
86
|
+
- example/public/list.html
|
82
87
|
- example/public/misc/about.html
|
83
88
|
- lib/logi.rb
|
84
89
|
- lib/logi/command/list.rb
|
85
90
|
- lib/logi/command/post.rb
|
91
|
+
- lib/logi/command/wiki.rb
|
92
|
+
- lib/logi/compiler.rb
|
86
93
|
- lib/logi/config.rb
|
87
94
|
- lib/logi/layout/default.html.erb
|
95
|
+
- lib/logi/loader.rb
|
96
|
+
- lib/logi/logger.rb
|
97
|
+
- lib/logi/post.rb
|
88
98
|
- lib/logi/runner.rb
|
89
99
|
- lib/logi/version.rb
|
90
100
|
- logi.gemspec
|
91
|
-
- pkg/logi-0.0.1.gem
|
92
101
|
- task/.gitignore
|
93
102
|
- task/gemgem.rb
|
94
103
|
homepage: https://github.com/godfat/logi
|
@@ -111,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
120
|
version: '0'
|
112
121
|
requirements: []
|
113
122
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.1.4
|
115
124
|
signing_key:
|
116
125
|
specification_version: 4
|
117
126
|
summary: Highly customizable static blog/wiki generator.
|
data/pkg/logi-0.0.1.gem
DELETED
Binary file
|