pipin 0.3.0 → 0.3.1

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.
@@ -7,8 +7,8 @@ end
7
7
 
8
8
  setup_environment
9
9
 
10
- SRCDIR = Pipin::Post.posts_dir
11
- DSTDIR = 'public'
10
+ SRCDIR = config[:dir][:posts]
11
+ DSTDIR = config[:dir][:dist]
12
12
  SRC_EXTNAMES = %w(html txt)
13
13
  EXTS = SRC_EXTNAMES.join(',')
14
14
 
@@ -27,7 +27,7 @@ end
27
27
 
28
28
  # posts
29
29
  SRC_EXTNAMES.each do |extname|
30
- rule /public\/\w+\.html/ => "#{SRCDIR}/%n.#{extname}" do |t|
30
+ rule /#{Regexp.escape DSTDIR}\/\w+\.html/ => "#{SRCDIR}/%n.#{extname}" do |t|
31
31
  Pipin::Exec.new('post', File.basename(t.name, '.html')).build
32
32
  end
33
33
  end
@@ -11,9 +11,10 @@ def config
11
11
  :title => 'Thie Pipin Diary',
12
12
  #:description => 'Please set config[:description] in pipinrc',
13
13
  :dir => {
14
- #:posts => '/Users/dan/w/piping/datasample',
15
- #:views => '/Users/dan/w/piping/views',
16
- #:plugins => "#{root_path}/config/plugins",
14
+ :dist => './public',
15
+ :posts => './data',
16
+ #:views => "#{pipin_root}/pipin/templates/plugins",
17
+ #:plugins => "#{pipin_root}/pipin/templates/plugins",
17
18
  },
18
19
  :limit => 5,
19
20
  # 複数のcssを使用する場合は配列で指定してください
@@ -53,7 +54,6 @@ def setup_environment
53
54
  $KCODE = 'UTF-8' # 1.8
54
55
  end
55
56
  add_compilers
56
- Pipin::Post.posts_dir = config[:dir][:posts] || './data'
57
57
  load_plugins config[:dir][:plugins] || './plugins'
58
58
  end
59
59
 
data/lib/pipin/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pipin
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/pipin.rb CHANGED
@@ -26,7 +26,7 @@ module Pipin
26
26
 
27
27
  def build
28
28
  page_name, *opts = @args
29
- Builder.new('public').__send__('render_' + page_name, *opts)
29
+ Builder.new(config[:dir][:dist]).__send__('render_' + page_name, *opts)
30
30
  end
31
31
  end
32
32
 
@@ -87,15 +87,12 @@ module Pipin
87
87
  end
88
88
 
89
89
  class Post
90
- def self.posts_dir=(dir) @@posts_dir = dir end
91
- def self.posts_dir() @@posts_dir end
92
-
93
90
  def self.find(pattern, options = {})
94
91
  self.find_srcs(pattern, options).map {|e| Post.new(e) }
95
92
  end
96
93
 
97
94
  def self.find_srcs(pattern, options = {})
98
- files = Dir.chdir(@@posts_dir) { Dir.glob(pattern + '.{txt,html}') }.sort.reverse
95
+ files = Dir.chdir(config[:dir][:posts]) { Dir.glob(pattern + '.{txt,html}') }.sort.reverse
99
96
  options[:limit] ? files[0, options[:limit]] : files
100
97
  end
101
98
 
@@ -118,7 +115,7 @@ module Pipin
118
115
  attr_reader :filename, :header, :body
119
116
  def initialize(filename)
120
117
  @filename = filename
121
- @header, @body = Dir.chdir(@@posts_dir) { File.read(@filename) }.split(/^__$/, 2)
118
+ @header, @body = Dir.chdir(config[:dir][:posts]) { File.read(@filename) }.split(/^__$/, 2)
122
119
  @header, @body = nil, @header unless @body
123
120
  @header and p(@header)
124
121
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -26,7 +26,6 @@ files:
26
26
  - lib/misc/mixistyle.rb
27
27
  - lib/pipin.rb
28
28
  - lib/pipin/build_tasks.rb
29
- - lib/pipin/templates/.htaccess
30
29
  - lib/pipin/templates/Rakefile
31
30
  - lib/pipin/templates/data/20110620.txt
32
31
  - lib/pipin/templates/data/20110622.txt
@@ -36,6 +35,7 @@ files:
36
35
  - lib/pipin/templates/plugins/amazon.rb
37
36
  - lib/pipin/templates/plugins/genarate_rss.rb
38
37
  - lib/pipin/templates/plugins/use_hiki_plugin.rb
38
+ - lib/pipin/templates/public/dot.htaccess
39
39
  - lib/pipin/templates/public/stylesheets/pipin.css
40
40
  - lib/pipin/version.rb
41
41
  - lib/pipin/views/archives.haml