hydeweb 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,3 +1,14 @@
1
+ v0.1.14 - Jun 04, 2011
2
+ ----------------------
3
+
4
+ ### Fixed:
5
+ * Fixed a syntax error in page.rb.
6
+ * Don't impose gem versions explicitly, and don't load Rubygems if used as a
7
+ library.
8
+
9
+ ### Misc:
10
+ * Added some doc comments to the main classes.
11
+
1
12
  v0.1.13
2
13
  -------
3
14
 
data/bin/hyde CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  $:.push File.expand_path('../../lib', __FILE__)
3
3
 
4
+ require 'rubygems' unless defined?(::Gem)
4
5
  require 'hyde'
5
6
 
6
7
  hydefile = Hyde::CONFIG_FILES.inject { |a, fname| a ||= Hyde::CLI.find_in_project(fname) }
data/bin/hyde01 CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  $:.push File.expand_path('../../lib', __FILE__)
3
3
 
4
+ require 'rubygems' unless defined?(::Gem)
4
5
  require 'hyde'
5
6
 
6
7
  hydefile = Hyde::CONFIG_FILES.inject { |a, fname| a ||= Hyde::CLI.find_in_project(fname) }
data/lib/hyde/config.rb CHANGED
@@ -1,4 +1,14 @@
1
1
  class Hyde
2
+ # Configuration.
3
+ #
4
+ # == Common usage
5
+ #
6
+ # Hyde.project.config
7
+ # Hyde.project.config.tilt_options('sass')[:load_path]
8
+ #
9
+ # Hyde.project.config.site_path
10
+ # Hyde.project.config.layouts_path
11
+ #
2
12
  class Config < OpenStruct
3
13
  DEFAULTS = {
4
14
  :site_path => '.',
@@ -38,7 +48,7 @@ class Config < OpenStruct
38
48
  h
39
49
  end
40
50
 
41
- @table[key][what.to_s]
51
+ @table[key][what.to_s] ||= Hash.new
42
52
  end
43
53
  end
44
54
  end
data/lib/hyde/page.rb CHANGED
@@ -1,4 +1,75 @@
1
1
  class Hyde
2
+ # A project.
3
+ #
4
+ # Getting pages from paths:
5
+ #
6
+ # # Feed it a URL path, not a filename.
7
+ # page = Hyde::Page['/index.html'] # uses Hyde.project
8
+ # page = Hyde::Page['/index.html', project]
9
+ #
10
+ # Getting pages from files:
11
+ #
12
+ # # Feed it a file name, not a URL path.
13
+ # # Also, this does no sanity checks.
14
+ # page = Hyde::Page.new('/home/rsc/index.html', project)
15
+ #
16
+ # page.exists?
17
+ # page.valid?
18
+ #
19
+ # Paths:
20
+ #
21
+ # page.filepath #=> "index.haml" -- path in the filesystem
22
+ # page.path #=> "/index.html" -- path as a RUL
23
+ #
24
+ # Meta:
25
+ #
26
+ # page.meta #=> OpenStruct of the metadata
27
+ # page.title #=> "Welcome to my site!"
28
+ #
29
+ # page.layout # Hyde::Layout or nil
30
+ # page.layout?
31
+ #
32
+ # Types:
33
+ #
34
+ # page.html?
35
+ # page.mime_type #=> "text/html" or nil -- only for tilt? == true
36
+ # page.default_ext #=> "html"
37
+ #
38
+ # Contents:
39
+ #
40
+ # page.to_html
41
+ # page.to_html(locals={})
42
+ # page.content
43
+ # page.markup
44
+ #
45
+ # Traversion:
46
+ #
47
+ #
48
+ # # Pages (a Hyde::Page or nil)
49
+ # page.parent
50
+ # page.next
51
+ #
52
+ # # Sets (a Hyde::Set)
53
+ # page.children
54
+ # page.siblings
55
+ # page.breadcrumbs
56
+ #
57
+ # # Misc
58
+ # page.index? # if it's an index.html
59
+ # page.parent?
60
+ # page.root? # true if no parents
61
+ # page.depth
62
+ #
63
+ # Tilt:
64
+ #
65
+ # page.tilt? # true, if it's a dynamic file
66
+ # page.tilt_engine_name #=> 'RedCloth'
67
+ #
68
+ # Building:
69
+ #
70
+ # page.write
71
+ # page.write('~/foo.html')
72
+ #
2
73
  class Page
3
74
  attr_reader :project
4
75
  attr_reader :file
data/lib/hyde/project.rb CHANGED
@@ -1,4 +1,40 @@
1
1
  class Hyde
2
+ # A project.
3
+ #
4
+ # Instanciating:
5
+ #
6
+ # project = Project.new('~/spur')
7
+ # project == Hyde.project # the last defined project
8
+ #
9
+ # Building:
10
+ #
11
+ # project.build
12
+ # project.build { |file| puts "Building #{file}..." }
13
+ #
14
+ # Getting pages:
15
+ #
16
+ # Hyde::Page['/index.html'] # ~/spur/index.md; uses Hyde.project
17
+ #
18
+ # Configuration:
19
+ #
20
+ # project.config_file # ~/spur/hyde.conf
21
+ # project.config # Config from above file (OpenStruct)
22
+ # project.config.site_path
23
+ #
24
+ # Paths:
25
+ #
26
+ # project.path(:site) # ~/spur/site (based on config site_path)
27
+ # project.path(:extensions)
28
+ #
29
+ # project.root('a/b', 'c') # ~/spur/a/b/c
30
+ #
31
+ # Indexing:
32
+ #
33
+ # project.pages # [<#Page>, <#Page>, ...]
34
+ # project.files # ['/index.md', '/style.sass', ...]
35
+ # # (only site files)
36
+ # project.ignored_files
37
+ #
2
38
  class Project
3
39
  def initialize(root=Dir.pwd)
4
40
  @root = root
data/lib/hyde.rb CHANGED
@@ -1,10 +1,5 @@
1
1
  $:.push *Dir[File.expand_path('../../vendor/*/lib', __FILE__)]
2
2
 
3
- require 'rubygems' if !Object.respond_to?(:gem)
4
-
5
- gem 'shake', '>= 0.1.2'
6
- gem 'tilt', '>= 1.2.2'
7
-
8
3
  require 'fileutils'
9
4
  require 'ostruct'
10
5
  require 'yaml'
@@ -15,7 +10,7 @@ require 'shake'
15
10
  Tilt.mappings['html'] = Tilt.mappings['erb']
16
11
 
17
12
  class Hyde
18
- VERSION = "0.1.13"
13
+ VERSION = "0.1.14"
19
14
  PREFIX = File.expand_path('../', __FILE__)
20
15
 
21
16
  Error = Class.new(StandardError)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hydeweb
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.13
5
+ version: 0.1.14
6
6
  platform: ruby
7
7
  authors:
8
8
  - Rico Sta. Cruz
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-26 00:00:00 +08:00
13
+ date: 2011-06-04 00:00:00 +08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  requirements: []
220
220
 
221
221
  rubyforge_project:
222
- rubygems_version: 1.5.0
222
+ rubygems_version: 1.6.2
223
223
  signing_key:
224
224
  specification_version: 3
225
225
  summary: Website preprocessor.