cg 0.0.3 → 0.0.4

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 (5) hide show
  1. data/Rakefile +1 -1
  2. data/VERSION +1 -1
  3. data/cg.gemspec +2 -2
  4. data/lib/cg/convert.rb +2 -6
  5. metadata +3 -3
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ begin
8
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
- gem.homepage = "http://github.com/Tomohiro/cg"
11
+ gem.homepage = 'http://rubygems.org/gems/cg'
12
12
  gem.authors = ["Tomohiro, TAIRA"]
13
13
  gem.add_dependency 'tilt', '>= 0.9'
14
14
  gem.add_dependency 'erubis', '>= 2.6.5'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/cg.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cg}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
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"]
@@ -49,7 +49,7 @@ Gem::Specification.new do |s|
49
49
  "spec/spec.opts",
50
50
  "spec/spec_helper.rb"
51
51
  ]
52
- s.homepage = %q{http://github.com/Tomohiro/cg}
52
+ s.homepage = %q{http://rubygems.org/gems/cg}
53
53
  s.rdoc_options = ["--charset=UTF-8"]
54
54
  s.require_paths = ["lib"]
55
55
  s.rubygems_version = %q{1.3.6}
data/lib/cg/convert.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'fileutils'
4
+ require 'pathname'
4
5
 
5
6
  require 'rubygems'
6
7
  require 'tilt'
@@ -32,7 +33,7 @@ module CG
32
33
  html_path = File.join(dir_path, html_name)
33
34
  open(html_path, 'w') do |f|
34
35
  @article = article_rendering(load_markdown(@source))
35
- @relative = relative_path(dir_path)
36
+ @relative = (Pathname.new(@root).relative_path_from(Pathname.new(dir_path))).to_s + '/'
36
37
 
37
38
  f.write page_build(load_template)
38
39
  puts "#{@source} => #{html_path}"
@@ -49,11 +50,6 @@ module CG
49
50
  [dir_path, html_name]
50
51
  end
51
52
 
52
- def relative_path(dir_path)
53
- point = dir_path.gsub(@root, '').split('/').count
54
- '../' * point
55
- end
56
-
57
53
  def load_template(template_name = 'html.rb')
58
54
  Tilt::ErubisTemplate.new { File.read("#{@templates_dir}/#{template_name}") }
59
55
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tomohiro, TAIRA
@@ -127,7 +127,7 @@ files:
127
127
  - spec/spec.opts
128
128
  - spec/spec_helper.rb
129
129
  has_rdoc: true
130
- homepage: http://github.com/Tomohiro/cg
130
+ homepage: http://rubygems.org/gems/cg
131
131
  licenses: []
132
132
 
133
133
  post_install_message: