bgotink-hyde 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b081f21b5c869455b93b00f9ebe7eff282203e4b
4
- data.tar.gz: a9cb5777018d9612c8e3ae2128f05c5a833760ca
3
+ metadata.gz: 21a0867d357e81906973917f64c1139711063872
4
+ data.tar.gz: 9efe24ee8d20d29c79d03957c7872e3b43f8e926
5
5
  SHA512:
6
- metadata.gz: eb102e9467d222bb06d68f95132fa58df9ae963497e540fddf7ce179c2c03b84007962a087d707022fe783c7cd408c8fed1b853d018f6b079a628507a1a7f81a
7
- data.tar.gz: 807d0a1b29aa0f87988260d036239c8ff541eaaf6ef7f87244805f5085c063dc1a2db109debcbd856270c27fce8dd2e6be05a729b0e91efd6eab783a1af35c45
6
+ metadata.gz: 072ef3df723bf7750eb6f8aff89ab066c4e99f564393c793e12c7d93c12256d7118232db2a0fe95b3547a6abcbbfd0bf634a43fb11c9822b22b0a95ff81e46e0
7
+ data.tar.gz: 6d1da3999dbc8fab921d468b0ee1e97c896d2e76e25d6cea904c5b0a101216e2d964b9929797ebe99faffdea8333666f4a7447f02e40547e5798b9f8244c8ad4
data/History.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## HEAD
2
+
3
+ ### Minor Enhancements
4
+ * change in template now also triggers jekyll rebuild
5
+ * a post called index.ext is now not added to the _posts but as index for the category
6
+ * only parse front-matter if needed (aka: if file is a post), this allows the user to enter a directory filled with images etc. as a page
7
+
8
+ ### Bugfixes
9
+ * index.ext can now also be updated using --watch
10
+
1
11
  ## 0.2.0 / 2014-01-08
2
12
 
3
13
  ### Major Enhancements
@@ -20,4 +30,4 @@
20
30
  * allow usage of `hyde_data: `, which takes precedense over `mtime`
21
31
 
22
32
  ## 0.0.0 / 2014-01-07
23
- * Birthday! (no really, 23rd birthday)
33
+ * Birthday! (no really, 23rd birthday)
@@ -4,9 +4,9 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'bgotink-hyde'
7
- s.version = '0.2.0'
7
+ s.version = '0.2.1'
8
8
  s.license = 'MIT'
9
- s.date = '2014-01-08'
9
+ s.date = '2014-01-12'
10
10
  s.rubyforge_project = 'bgotink-hyde'
11
11
 
12
12
  s.summary = "A user-friendly front-end for Jekyll"
@@ -19,7 +19,7 @@ require 'hyde/stevenson'
19
19
  require_all 'hyde/commands'
20
20
 
21
21
  module Hyde
22
- VERSION = '0.2.0'
22
+ VERSION = '0.2.1'
23
23
 
24
24
  # Public: Generate a Hyde configuration Hash by merging the default
25
25
  # options with anything in _config.yml, and adding the given options on top.
@@ -32,9 +32,8 @@ module Hyde
32
32
  def self.watch(site, options)
33
33
  require 'listen'
34
34
 
35
- # TODO check whether dest is in source?
36
-
37
35
  source = options['source']
36
+ template = options['template']['directory']
38
37
 
39
38
  ignored = Array.new
40
39
  %w[intermediary destination].each do |o|
@@ -54,7 +53,7 @@ module Hyde
54
53
 
55
54
  Hyde.logger.info 'Auto-regeneration:', 'enabled'
56
55
 
57
- listener = Listen::Listener.new(source, :ignore => ignored) do |modified, added, removed|
56
+ listener = Listen::Listener.new([source, template], :ignore => ignored) do |modified, added, removed|
58
57
  t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
59
58
  n = modified.length + added.length + removed.length
60
59
  Hyde.logger.info "Regenerating:", "#{n} files at #{t} "
@@ -1,22 +1,28 @@
1
1
  module Hyde
2
2
 
3
3
  class Page
4
- attr_accessor :original, :name, :time
4
+ attr_accessor :original, :name
5
5
 
6
6
  def initialize(location, destination)
7
7
  @original = File.absolute_path(location)
8
8
  @dest_dir = destination
9
-
10
- data = read_yaml(self.original)
11
9
 
12
10
  @name = File.basename(location)
13
- @time = if data['hyde_date']
14
- Time.parse(data['hyde_date'])
15
- elsif data['date']
16
- Time.parse(data['date'])
17
- else
18
- File.mtime(location)
19
- end
11
+ end
12
+
13
+ def data
14
+ read_yaml(original)
15
+ end
16
+
17
+ def time
18
+ data = self.data
19
+ if data['hyde_date']
20
+ Time.parse(data['hyde_date'])
21
+ elsif data['date']
22
+ Time.parse(data['date'])
23
+ else
24
+ File.mtime(original)
25
+ end
20
26
  end
21
27
 
22
28
  def dest_filename
@@ -32,7 +38,7 @@ module Hyde
32
38
  end
33
39
 
34
40
  def write
35
- File.symlink(original, destination)
41
+ FileUtils.cp(original, destination)
36
42
  end
37
43
 
38
44
  private
@@ -1,12 +1,24 @@
1
1
  module Hyde
2
2
 
3
3
  class Post < Page
4
+ def index?
5
+ name.match(/index(\.[^\.]+)?/)
6
+ end
7
+
4
8
  def dest_filename
5
- "#{time.strftime('%Y-%m-%d')}-#{name}"
9
+ if index?
10
+ name
11
+ else
12
+ "#{time.strftime('%Y-%m-%d')}-#{name}"
13
+ end
6
14
  end
7
15
 
8
16
  def dest_dir
9
- File.join(super, '_posts')
17
+ if index?
18
+ super
19
+ else
20
+ File.join(super, '_posts')
21
+ end
10
22
  end
11
23
  end
12
24
 
@@ -21,6 +21,7 @@ module Hyde
21
21
 
22
22
  def process
23
23
  self.reset
24
+ self.copy_template
24
25
  self.directories
25
26
  self.read
26
27
  self.write
@@ -48,7 +49,7 @@ module Hyde
48
49
  clone_directory(options['template']) if options['template']['branch']
49
50
 
50
51
  FileUtils.rm_rf(dest)
51
- FileUtils.cp_r(template, dest, :preserve => true)
52
+ FileUtils.mkdir_p(dest)
52
53
  end
53
54
 
54
55
  private
@@ -120,6 +121,10 @@ module Hyde
120
121
 
121
122
  public
122
123
 
124
+ def copy_template
125
+ FileUtils.cp_r(Dir[File.join(template, '*')], dest, :preserve => true)
126
+ end
127
+
123
128
  # read files
124
129
  def read
125
130
  self.files ||= Array.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bgotink-hyde
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bram Gotink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-08 00:00:00.000000000 Z
11
+ date: 2014-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll