pipin 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -5,7 +5,7 @@
5
5
  == setup
6
6
 
7
7
  #pipin new myblog
8
- ruby -r pipin -e 'Pipin.command :new' myblog
8
+ ruby -I ./lib -r pipin -e 'Pipin::Exec.new().create_from_template' myblog
9
9
 
10
10
  == build
11
11
 
@@ -28,13 +28,13 @@
28
28
  == trap
29
29
 
30
30
  * 原稿ファイルを削除した場合、削除したファイルはrakeビルド時の更新条件から除外されます
31
- ** htmlが再出力されない場合は、そのhtmlファイルを手動で削除してからrakeを実行してください
31
+ * htmlが再出力されない場合は、そのhtmlファイルを手動で削除してからrakeを実行してください
32
32
 
33
33
  == from tDiary
34
34
 
35
35
  * 静的なhtmlとして保存できる
36
- ** postのhtmlを生成するプラグインや
37
- ** 写真とかもそのままいける
36
+ * postのhtmlを生成するプラグインや
37
+ * 写真とかもそのままいける
38
38
  * urlの互換
39
39
  * exportはレンダリングされたhtmlから
40
40
  * todo: コメント...
@@ -22,7 +22,7 @@ task :default => [:index, :archives, :months, :sitemap] + DSTS.sort.reverse
22
22
  # posts
23
23
  SRC_EXTNAMES.each do |extname|
24
24
  rule /public\/\w+\.html/ => "#{SRCDIR}/%n.#{extname}" do |t|
25
- Pipin.build 'post', File.basename(t.name, '.html')
25
+ Pipin::Exec.new('post', File.basename(t.name, '.html')).build
26
26
  end
27
27
  end
28
28
 
@@ -33,7 +33,7 @@ Pipin::Post.year_months.each do |year, months|
33
33
  dst = dst_html(year + month)
34
34
  srcs = FileList["#{SRCDIR}/#{year + month}[0-9][0-9]*.{#{EXTS}}"]
35
35
  file dst => srcs do
36
- Pipin.build 'month', year, month
36
+ Pipin::Exec.new('month', year, month).build
37
37
  end
38
38
  end
39
39
  end
@@ -48,7 +48,7 @@ OTHER_TASKS.each do |pagename, srcs|
48
48
  dst = dst_html(pagename)
49
49
  task pagename => dst
50
50
  file dst => srcs do
51
- Pipin.build pagename
51
+ Pipin::Exec.new(pagename).build
52
52
  end
53
53
  end
54
54
 
data/lib/pipin/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pipin
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -11,9 +11,9 @@
11
11
  %body
12
12
  %h1&= config[:title]
13
13
  .menus
14
- %a{:href => './index' + html_extname} Latest
15
- %a{:href => './archives' + html_extname} Archives
16
- %a{:href => './about' + html_extname} About
14
+ %a{:href => '' + html_extname} Latest
15
+ %a{:href => 'archives' + html_extname} Archives
16
+ %a{:href => 'about' + html_extname} About
17
17
  .main
18
18
  =# render_plugin_hook(:flavour_header, self)
19
19
  .content
@@ -23,7 +23,7 @@
23
23
  =# render_plugin_hook(:flavour_footer, self)
24
24
  .footer
25
25
  .sitemap
26
- %a{:href => './sitemap' + html_extname} Sitemap
26
+ %a{:href => 'sitemap' + html_extname} Sitemap
27
27
  %a{:href => 'https://github.com/dan5/pipin'} Pipin
28
28
  &= Pipin::VERSION
29
29
  on
data/lib/pipin.rb CHANGED
@@ -2,6 +2,7 @@ require 'pipin/version'
2
2
  require 'haml'
3
3
  require 'fileutils'
4
4
 
5
+ # todo: move in Pipin
5
6
  def rootdir() File.join(File.dirname(File.expand_path(__FILE__)), 'pipin') end
6
7
  def html_extname() config[:html_extname] or '.html' end
7
8
 
@@ -9,23 +10,22 @@ module Pipin
9
10
  Diary_pattern = '[0-9]' * 8 + '*'
10
11
  Post_pattern = '[0-9a-zA-Z]*'
11
12
 
12
- def self.build(page_name, *args)
13
- command :build, page_name, *args
14
- end
15
-
16
- def self.command(cmd, *args)
17
- opts = args.empty? ? ARGV : args
18
- __send__ "command_#{cmd}", *opts
19
- end
13
+ class Exec
14
+ def initialize(*args)
15
+ @args = args.empty? ? ARGV : args
16
+ end
20
17
 
21
- def self.command_new(dir)
22
- File.exist?(dir) && raise("File exists - #{dir}")
23
- FileUtils.cp_r File.join(rootdir ,'templates'), dir
24
- puts Dir.glob(File.join(dir, '**/*')).map {|e| ' create ' + e }
25
- end
18
+ def create_from_template
19
+ dir = @args.first
20
+ File.exist?(dir) && raise("File exists - #{dir}")
21
+ FileUtils.cp_r File.join(rootdir ,'templates'), dir
22
+ puts Dir.glob(File.join(dir, '**/*')).map {|e| ' create ' + e }
23
+ end
26
24
 
27
- def self.command_build(page_name, *args)
28
- Builder.new('public').__send__('render_' + page_name, *args)
25
+ def build
26
+ page_name, *opts = @args
27
+ Builder.new('public').__send__('render_' + page_name, *opts)
28
+ end
29
29
  end
30
30
 
31
31
  class Builder
metadata CHANGED
@@ -1,28 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pipin
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
4
5
  prerelease:
5
- version: 0.1.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - dan5ya
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-06-23 00:00:00 Z
12
+ date: 2011-06-24 00:00:00.000000000Z
14
13
  dependencies: []
15
-
16
14
  description: simple blog system
17
- email:
15
+ email:
18
16
  - dan5.ya@gmail.com
19
17
  executables: []
20
-
21
18
  extensions: []
22
-
23
19
  extra_rdoc_files: []
24
-
25
- files:
20
+ files:
26
21
  - .gitignore
27
22
  - Gemfile
28
23
  - README.rdoc
@@ -48,30 +43,26 @@ files:
48
43
  - pipin.gemspec
49
44
  homepage: https://github.com/dan5/pipin
50
45
  licenses: []
51
-
52
46
  post_install_message:
53
47
  rdoc_options: []
54
-
55
- require_paths:
48
+ require_paths:
56
49
  - lib
57
- required_ruby_version: !ruby/object:Gem::Requirement
50
+ required_ruby_version: !ruby/object:Gem::Requirement
58
51
  none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: "0"
63
- required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
57
  none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0"
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
69
62
  requirements: []
70
-
71
63
  rubyforge_project: pipin
72
64
  rubygems_version: 1.8.5
73
65
  signing_key:
74
66
  specification_version: 3
75
67
  summary: blog
76
68
  test_files: []
77
-