cg 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mkd +33 -10
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/cg +7 -1
- data/cg.gemspec +5 -5
- data/lib/cg/convert.rb +3 -3
- data/lib/cg/server.rb +11 -2
- data/skel/templates/{disqus.rb → disqus.erb} +0 -0
- data/skel/templates/{html.rb → html.erb} +1 -1
- metadata +6 -6
data/README.mkd
CHANGED
@@ -36,37 +36,60 @@ cg is A Ruby based HTML "contents generator".
|
|
36
36
|
|
37
37
|
$ cg scratch cg.example.com
|
38
38
|
|
39
|
-
2.
|
39
|
+
2. Convert
|
40
|
+
|
41
|
+
$ cd cg.example.com/markdown/
|
42
|
+
$ cg convert index.mkd
|
43
|
+
|
44
|
+
e.g.
|
45
|
+
|
46
|
+
$ cg convert cg.example.com/markdown/index.mkd
|
47
|
+
=> cg.example.com/index.html
|
48
|
+
|
49
|
+
$ cg convert cg.example.com/markdown/foo+index.mkd
|
50
|
+
=> cg.example.com/foo/index.html
|
51
|
+
|
52
|
+
$ cg convert cg.example.com/markdown/foo-bar+hello.mkd
|
53
|
+
=> cg.example.com/foo/bar/hello.html
|
54
|
+
|
55
|
+
3. All Rebuild
|
40
56
|
|
41
57
|
$ cd cg.example.com
|
42
58
|
$ cg rebuild
|
43
59
|
|
44
|
-
|
60
|
+
4. All Rebuild and Packing
|
45
61
|
|
46
62
|
$ cd cg.example.com
|
47
63
|
$ cg rebuild packing
|
48
64
|
$ tar zxvf public.tar.gz -C /var/www/html/
|
49
65
|
|
50
|
-
|
51
|
-
|
52
|
-
$ cd cg.example.com/markdown/
|
53
|
-
$ cg convert markdown_file
|
54
|
-
|
55
|
-
4. Server
|
66
|
+
5. Server
|
56
67
|
|
57
68
|
$ cg server
|
58
69
|
|
59
70
|
Access to [http://localhost:9292](http://localhost:9292)
|
60
71
|
|
72
|
+
$ cg server -h host -p 8080
|
73
|
+
|
74
|
+
Access to http://host:8080
|
75
|
+
|
76
|
+
Want to run cg server as a daemon? use `nohup`.
|
77
|
+
|
78
|
+
$ nohup cg server -h host -p 8080 > &
|
79
|
+
|
61
80
|
|
62
81
|
### Tips
|
63
82
|
|
64
|
-
1.
|
83
|
+
1. Template customize
|
84
|
+
|
85
|
+
$ vi templates/html.erb
|
86
|
+
|
87
|
+
2. After save hook for Vim
|
65
88
|
|
66
89
|
$ vi .vimrc
|
67
90
|
> autocmd BufWritePost *.mkd :silent !cg convert % > /dev/null
|
68
91
|
|
69
|
-
|
92
|
+
3. After save hook for Emacs
|
70
93
|
|
71
94
|
|
72
95
|
### Note on Patches/Pull Requests
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = 'cg'
|
8
|
-
gem.summary = '
|
8
|
+
gem.summary = 'HTML Contents Generator'
|
9
9
|
gem.description = 'cg is A Ruby based contents generator'
|
10
10
|
gem.email = "tomohiro.t+github@gmail.com"
|
11
11
|
gem.homepage = 'http://rubygems.org/gems/cg'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/bin/cg
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
CG_ROOT = File.expand_path('..', File.dirname(__FILE__))
|
4
4
|
$: << CG_ROOT
|
5
5
|
|
6
|
-
|
6
|
+
Version = open(CG_ROOT + '/VERSION').read
|
7
|
+
|
8
|
+
if ARGV.include? '--version'
|
9
|
+
puts "#{File.basename(__FILE__)} #{Version}"
|
10
|
+
exit
|
11
|
+
end
|
7
12
|
|
13
|
+
require 'lib/contents_generator'
|
8
14
|
ContentsGenerator.boot
|
data/cg.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cg}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tomohiro, TAIRA"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-06-04}
|
13
13
|
s.default_executable = %q{cg}
|
14
14
|
s.description = %q{cg is A Ruby based contents generator}
|
15
15
|
s.email = %q{tomohiro.t+github@gmail.com}
|
@@ -45,8 +45,8 @@ Gem::Specification.new do |s|
|
|
45
45
|
"skel/styles/iphone.css",
|
46
46
|
"skel/styles/reset-min.css",
|
47
47
|
"skel/templates/.htaccess",
|
48
|
-
"skel/templates/disqus.
|
49
|
-
"skel/templates/html.
|
48
|
+
"skel/templates/disqus.erb",
|
49
|
+
"skel/templates/html.erb",
|
50
50
|
"spec/cg_spec.rb",
|
51
51
|
"spec/spec.opts",
|
52
52
|
"spec/spec_helper.rb"
|
@@ -55,7 +55,7 @@ Gem::Specification.new do |s|
|
|
55
55
|
s.rdoc_options = ["--charset=UTF-8"]
|
56
56
|
s.require_paths = ["lib"]
|
57
57
|
s.rubygems_version = %q{1.3.6}
|
58
|
-
s.summary = %q{
|
58
|
+
s.summary = %q{HTML Contents Generator}
|
59
59
|
s.test_files = [
|
60
60
|
"spec/cg_spec.rb",
|
61
61
|
"spec/spec_helper.rb"
|
data/lib/cg/convert.rb
CHANGED
@@ -50,7 +50,7 @@ module CG
|
|
50
50
|
[dir_path, html_name]
|
51
51
|
end
|
52
52
|
|
53
|
-
def load_template(template_name = 'html.
|
53
|
+
def load_template(template_name = 'html.erb')
|
54
54
|
Tilt::ErubisTemplate.new { File.read("#{@templates_dir}/#{template_name}") }
|
55
55
|
end
|
56
56
|
|
@@ -74,11 +74,11 @@ module CG
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def comment_rendering
|
77
|
-
return unless File.exist? "#{@templates_dir}/disqus.
|
77
|
+
return unless File.exist? "#{@templates_dir}/disqus.erb"
|
78
78
|
|
79
79
|
@disqus_subdomain = @domain.gsub('.', '-')
|
80
80
|
|
81
|
-
comment = Tilt::ErubisTemplate.new { File.read("#{@templates_dir}/disqus.
|
81
|
+
comment = Tilt::ErubisTemplate.new { File.read("#{@templates_dir}/disqus.erb") }
|
82
82
|
comment.render(self)
|
83
83
|
end
|
84
84
|
|
data/lib/cg/server.rb
CHANGED
@@ -19,6 +19,15 @@ module CG
|
|
19
19
|
end
|
20
20
|
|
21
21
|
if __FILE__ == $0
|
22
|
-
|
23
|
-
|
22
|
+
require 'optparse'
|
23
|
+
host = 'localhost'
|
24
|
+
port = 9292
|
25
|
+
ARGV.options do |o|
|
26
|
+
o.on('-p', '--port PORT_NUMBER', " (default: #{port})") { |v| port = v }
|
27
|
+
o.on('-h', '--host HOST', " (default: #{host})") { |v| host = v }
|
28
|
+
o.parse!
|
29
|
+
end
|
30
|
+
|
31
|
+
puts "[#{Time.now.strftime('%Y-%m-%d %H:%m')}] cg server start. http://#{host}:#{port}"
|
32
|
+
Rack::Handler::default.run CG::Server.new, :Port => port, :Host => host
|
24
33
|
end
|
File without changes
|
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
<footer>
|
36
36
|
<p>Copyright © <%= Date.today.year %> <a href="http://tomohiro.github.com">Tomohiro</a> All rights reserved.</p>
|
37
|
-
<p>
|
37
|
+
<p>Powered by <a href="http://rubygems.org/gems/cg" title="cg - A Ruby based contents generator">cg - A Ruby based contents generator</a></p>
|
38
38
|
</footer>
|
39
39
|
</body>
|
40
40
|
</html>
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 7
|
9
|
+
version: 0.0.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tomohiro, TAIRA
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-04 00:00:00 +09:00
|
18
18
|
default_executable: cg
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -137,8 +137,8 @@ files:
|
|
137
137
|
- skel/styles/iphone.css
|
138
138
|
- skel/styles/reset-min.css
|
139
139
|
- skel/templates/.htaccess
|
140
|
-
- skel/templates/disqus.
|
141
|
-
- skel/templates/html.
|
140
|
+
- skel/templates/disqus.erb
|
141
|
+
- skel/templates/html.erb
|
142
142
|
- spec/cg_spec.rb
|
143
143
|
- spec/spec.opts
|
144
144
|
- spec/spec_helper.rb
|
@@ -172,7 +172,7 @@ rubyforge_project:
|
|
172
172
|
rubygems_version: 1.3.6
|
173
173
|
signing_key:
|
174
174
|
specification_version: 3
|
175
|
-
summary:
|
175
|
+
summary: HTML Contents Generator
|
176
176
|
test_files:
|
177
177
|
- spec/cg_spec.rb
|
178
178
|
- spec/spec_helper.rb
|