brite 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/.ruby +56 -0
  2. data/COPYING.rdoc +30 -0
  3. data/HISTORY.rdoc +16 -2
  4. data/README.rdoc +35 -27
  5. data/bin/brite-server +1 -1
  6. data/lib/brite.rb +2 -1
  7. data/lib/brite.yml +56 -0
  8. data/lib/brite/command.rb +100 -55
  9. data/lib/brite/config.rb +122 -40
  10. data/lib/brite/controller.rb +46 -104
  11. data/lib/brite/layout.rb +27 -13
  12. data/lib/brite/model.rb +107 -0
  13. data/lib/brite/page.rb +229 -0
  14. data/lib/brite/part.rb +88 -0
  15. data/lib/brite/post.rb +41 -0
  16. data/lib/brite/server.rb +88 -93
  17. data/lib/brite/site.rb +150 -0
  18. data/lib/brite/version.rb +21 -0
  19. data/test/fixture/brite.yml +3 -0
  20. data/test/fixture/example-page.page +8 -0
  21. data/test/fixture/example-post.post +9 -0
  22. data/test/helper.rb +5 -0
  23. data/test/test_config.rb +23 -0
  24. data/test/test_page.rb +28 -0
  25. data/test/test_site.rb +37 -0
  26. metadata +104 -109
  27. data/LICENSE +0 -205
  28. data/Syckfile +0 -76
  29. data/lib/brite/meta/data.rb +0 -26
  30. data/lib/brite/meta/package +0 -8
  31. data/lib/brite/meta/profile +0 -19
  32. data/lib/brite/models/model.rb +0 -97
  33. data/lib/brite/models/page.rb +0 -142
  34. data/lib/brite/models/post.rb +0 -9
  35. data/lib/brite/models/site.rb +0 -46
  36. data/lib/brite/rackup.rb +0 -6
  37. data/lib/plugins/sow/brite/awesome/Sowfile +0 -11
  38. data/lib/plugins/sow/brite/awesome/about.page +0 -28
  39. data/lib/plugins/sow/brite/awesome/assets/custom.less +0 -96
  40. data/lib/plugins/sow/brite/awesome/assets/fade.png +0 -0
  41. data/lib/plugins/sow/brite/awesome/assets/highlight.css +0 -96
  42. data/lib/plugins/sow/brite/awesome/assets/highlight.js +0 -1
  43. data/lib/plugins/sow/brite/awesome/assets/jquery.js +0 -19
  44. data/lib/plugins/sow/brite/awesome/assets/jquery.tabs.js +0 -1
  45. data/lib/plugins/sow/brite/awesome/assets/reset.css +0 -57
  46. data/lib/plugins/sow/brite/awesome/assets/ruby.png +0 -0
  47. data/lib/plugins/sow/brite/awesome/brite.yaml +0 -3
  48. data/lib/plugins/sow/brite/awesome/history.page +0 -15
  49. data/lib/plugins/sow/brite/awesome/index.page +0 -18
  50. data/lib/plugins/sow/brite/awesome/legal.page +0 -28
  51. data/lib/plugins/sow/brite/awesome/logs.page +0 -14
  52. data/lib/plugins/sow/brite/awesome/page.layout +0 -75
  53. data/lib/plugins/sow/brite/blog1/.rsync-filter +0 -12
  54. data/lib/plugins/sow/brite/blog1/2011/01/sample.html +0 -293
  55. data/lib/plugins/sow/brite/blog1/2011/01/sample.post +0 -44
  56. data/lib/plugins/sow/brite/blog1/Sowfile +0 -10
  57. data/lib/plugins/sow/brite/blog1/assets/images/bg.jpg +0 -0
  58. data/lib/plugins/sow/brite/blog1/assets/images/icon.jpg +0 -0
  59. data/lib/plugins/sow/brite/blog1/assets/styles/class.css +0 -15
  60. data/lib/plugins/sow/brite/blog1/assets/styles/id.css +0 -85
  61. data/lib/plugins/sow/brite/blog1/assets/styles/misc.css +0 -0
  62. data/lib/plugins/sow/brite/blog1/assets/styles/print.css +0 -76
  63. data/lib/plugins/sow/brite/blog1/assets/styles/reset.css +0 -77
  64. data/lib/plugins/sow/brite/blog1/assets/styles/tag.css +0 -68
  65. data/lib/plugins/sow/brite/blog1/brite.yml +0 -3
  66. data/lib/plugins/sow/brite/blog1/index.page +0 -23
  67. data/lib/plugins/sow/brite/blog1/page.layout +0 -88
  68. data/lib/plugins/sow/brite/blog1/post.layout +0 -25
  69. data/meta/data.rb +0 -26
  70. data/meta/package +0 -8
  71. data/meta/profile +0 -19
data/Syckfile DELETED
@@ -1,76 +0,0 @@
1
- ---
2
- email:
3
- service : Email
4
- file : ~
5
- subject : ~
6
- mailto :
7
- - ruby-talk@ruby-lang.org
8
- - proutils@googlegroups.com
9
- parts : ~
10
- active : true
11
-
12
- gemcutter:
13
- active: true
14
-
15
- grancher:
16
- active: true
17
-
18
- box:
19
- service: Box
20
- types : [gem]
21
- spec : false
22
- active : true
23
-
24
- dnote:
25
- service : DNote
26
- loadpath : ~
27
- labels : ~
28
- output : ~
29
- format : ~
30
- active : true
31
-
32
- rdoc:
33
- service : RDoc
34
- template: redfish
35
- exclude : [Syckfile]
36
- output : site/docs/api
37
- active : true
38
-
39
- ridoc:
40
- service: RIDoc
41
- include: ~
42
- exclude: ~
43
- output : ri
44
- active : true
45
-
46
- stats:
47
- service : Stats
48
- title : ~
49
- loadpath : ~
50
- exclude : ~
51
- output : ~
52
- active : true
53
-
54
- vclog:
55
- service : vclog
56
- formats : html,rdoc
57
- layout : history
58
- typed : true
59
- output : ~
60
- active : false
61
-
62
- testrb:
63
- service : TestUnit
64
- tests : ~
65
- exclude : ~
66
- loadpath : ~
67
- requires : ~
68
- live : false
69
- active : false
70
-
71
- syntax:
72
- service : Syntax
73
- loadpath : ~
74
- exclude : ~
75
- active : false
76
-
@@ -1,26 +0,0 @@
1
- module Brite
2
-
3
- def self.package
4
- @package ||= (
5
- require 'yaml'
6
- YAML.load(File.new(File.dirname(__FILE__) + '/package'))
7
- )
8
- end
9
-
10
- def self.profile
11
- @profile ||= (
12
- require 'yaml'
13
- YAML.load(File.new(File.dirname(__FILE__) + '/profile'))
14
- )
15
- end
16
-
17
- def self.const_missing(name)
18
- key = name.to_s.downcase
19
- package[key] || profile[key] || super(name)
20
- end
21
-
22
- end
23
-
24
- # becuase Ruby 1.8~ gets in the way
25
- Object.__send__(:remove_const, :VERSION) if Object.const_defined?(:VERSION)
26
-
@@ -1,8 +0,0 @@
1
- ---
2
- name : brite
3
- date : 2010-11-12
4
- version : 0.6.0
5
-
6
- requires:
7
- - neapolitan 0.3.0+
8
-
@@ -1,19 +0,0 @@
1
- ---
2
- title : Brite
3
- subtitle : Light Up Your Site
4
- summary : Super Simple Static Site Generation
5
- copyright: Copyright (c) 2006,2009 Thomas Sawyer
6
- license : Apache v2.0
7
- suite : proutils
8
- contact : http://googlegroups.com/group/proutils
9
- authors : Thomas Sawyer
10
-
11
- description:
12
- Brite is a remarkably easy to use, light-weight website
13
- generator. It supports a variety of backend rendering engines
14
- including rhtml via eruby, textile via redcloth, markdown
15
- via rdiscount, with others on the way.
16
-
17
- resources:
18
- homepage: http://proutils.github.com/brite
19
- repository: git://github.com/proutils/brite.git
@@ -1,97 +0,0 @@
1
- module Brite
2
-
3
- #
4
- class Model
5
-
6
- # Designate a field to be omitted from rendering context.
7
- def self.omit_field(name)
8
- omit_fields << (RUBY_VERSION >= "1.9" ? name.to_sym : name.to_s)
9
- end
10
-
11
- # Returns an Array of omitted fields for this class.
12
- def self.omit_fields
13
- @omit_fields ||= []
14
- end
15
-
16
- #
17
- def self.attr_accessor(name, &default)
18
- name = name.to_sym
19
- if default
20
- define_method(name) do
21
- value = instance_variable_get("@#{name}") || instance_eval(&default)
22
- (class << self; self; end).class_eval do
23
- define_method(name){ value }
24
- end
25
- value
26
- end
27
- else
28
- attr_reader(name)
29
- end
30
- attr_writer(name)
31
- end
32
-
33
- # Define a singleton method for given key-value pair.
34
- def []=(k,v)
35
- (class << self; self; end).class_eval do
36
- define_method(k){v}
37
- end
38
- end
39
-
40
- # Returns a Binding for this instance.
41
- def to_binding(&block)
42
- binding
43
- end
44
-
45
- # Returns a Hash of rendering fields.
46
- def to_h
47
- hash = {}
48
- fields = rendering_fields
49
- fields.each do |field|
50
- hash[field.to_s] = __send__(field)
51
- end
52
- #extra.each do |k,v|
53
- # hash[k.to_s] == v
54
- #end
55
- hash
56
- end
57
-
58
- # In case Liquid template is used.
59
- def to_liquid
60
- to_h
61
- end
62
-
63
- # Returns an Array of attribute/method names to be visible to the page
64
- # rendering.
65
- def rendering_fields
66
- list = public_methods
67
- list -= Model.public_instance_methods
68
- list -= omit_fields
69
- list.select do |name|
70
- case name.to_s
71
- when /\W+/ then false
72
- when /^to_/ then false
73
- else
74
- true
75
- end
76
- end
77
- end
78
-
79
- # Returns an Array of attribute/method names explicitly omitted from
80
- # being visible from the rendering.
81
- def omit_fields
82
- list = []
83
- self.class.ancestors.reverse_each do |ancestor|
84
- list.concat(ancestor.omit_fields) if ancestor.respond_to?(:omit_fields)
85
- end
86
- list
87
- end
88
-
89
- #
90
- def singleton_class
91
- (class << self; self; end)
92
- end
93
-
94
- end
95
-
96
- end
97
-
@@ -1,142 +0,0 @@
1
- require 'brite/models/model'
2
-
3
- module Brite
4
-
5
- #
6
- class Page < Model
7
-
8
- # New Page.
9
- def initialize(settings={}, &rendering)
10
- settings.each do |k,v|
11
- if respond_to?("#{k}=")
12
- __send__("#{k}=",v)
13
- else
14
- self[k] = v
15
- end
16
- end
17
-
18
- @rendering = rendering
19
- end
20
-
21
- #
22
- attr_accessor :file
23
-
24
- # Instance of Site class to which this page belongs.
25
- attr_accessor :site
26
-
27
- # Author
28
- attr_accessor :author do
29
- 'Anonymous'
30
- end
31
-
32
- # Title of page/post
33
- attr_accessor :title
34
-
35
- # Publish date
36
- attr_accessor :date do
37
- date_from_filename(file) || Time.now
38
- end
39
-
40
- # Category ("a glorified tag")
41
- attr_accessor :category
42
-
43
- # Tags (labels)
44
- attr_accessor :tags
45
-
46
- #
47
- def tags=(entry)
48
- case entry
49
- when String, Symbol
50
- entry = entry.to_s.strip
51
- if entry.index(/[,;]/)
52
- entry = entry.split(/[,;]/)
53
- else
54
- entry = entry.split(/\s+/)
55
- end
56
- else
57
- entry = entry.to_a.flatten
58
- end
59
- @tags = entry.map{ |e| e.strip }
60
- end
61
-
62
- #
63
- attr_accessor :url do
64
- File.join(site.url, name + extension)
65
- end
66
-
67
- #
68
- attr_accessor :layout
69
-
70
- #
71
- def output
72
- @output ||= file.chomp(File.extname(file)) + extension
73
- end
74
-
75
- #
76
- def output=(fname)
77
- @output = File.join(File.dirname(file), fname) if fname
78
- @output
79
- end
80
-
81
- #
82
- def name
83
- @name ||= file.chomp(File.extname(file))
84
- end
85
-
86
- #
87
- #attr_accessor :relative_url do
88
- # output #File.join(root, output)
89
- #end
90
-
91
- #
92
- attr_accessor :path do
93
- '/' + name + extension
94
- end
95
-
96
- # DEPRECATE: Get rid of this and use rack to test page instead of files.
97
- # OTOH, that may not alwasy be possible we may need to keep this.
98
- attr_accessor :root do
99
- '../' * file.count('/')
100
- end
101
-
102
- # Working directory of file being rendering. (Why a field?)
103
- attr_accessor :work do
104
- '/' + File.dirname(file)
105
- end
106
-
107
- # Summary is the rendering of the first part.
108
- attr_accessor :summary
109
-
110
- # Output extension (defualt is 'html')
111
- def extension
112
- @extension ||= '.html'
113
- end
114
-
115
- # Set output extension.
116
- def extension=(extname)
117
- @extension = (
118
- e = (extname || 'html').to_s
119
- e = '.' + e unless e.start_with?('.')
120
- e
121
- )
122
- end
123
-
124
- # Renders page template.
125
- def to_s
126
- @rendering.call(self)
127
- end
128
-
129
- private
130
-
131
- #
132
- def date_from_filename(file)
133
- if md = (/^\d\d\d\d-\d\d-\d\d/.match(file))
134
- md[1]
135
- else
136
- File.mtime(file)
137
- end
138
- end
139
-
140
- end
141
-
142
- end
@@ -1,9 +0,0 @@
1
- require 'brite/models/page'
2
-
3
- module Brite
4
-
5
- class Post < Page
6
-
7
- end
8
-
9
- end
@@ -1,46 +0,0 @@
1
- require 'brite/models/model'
2
-
3
- module Brite
4
-
5
- #
6
- class Site < Model
7
-
8
- # New Site model.
9
- def initialize(settings={})
10
- settings.each do |k,v|
11
- __send__("#{k}=", v)
12
- end
13
- @pages = []
14
- @posts = []
15
- end
16
-
17
- # Returns a String of the site's URL.
18
- attr_accessor :url
19
-
20
- # Returns and Array of Page instances.
21
- attr :pages
22
-
23
- # Returns and Array of Post instances.
24
- attr :posts
25
-
26
- # Returns an Array of all tags used in all posts.
27
- def tags
28
- @tags ||= posts.map{ |post| post.tags }.flatten.uniq.sort
29
- end
30
-
31
- # Returns a Hash posts indexed by tag.
32
- def posts_by_tag
33
- @posts_by_tag ||= (
34
- chart ||= Hash.new{|h,k|h[k]=[]}
35
- posts.each do |post|
36
- post.tags.each do |tag|
37
- chart[tag] << post
38
- end
39
- end
40
- chart
41
- )
42
- end
43
-
44
- end
45
-
46
- end
@@ -1,6 +0,0 @@
1
- # The static content rooted in the current working directory
2
- # Eg. Dir.pwd =&gt; http://0.0.0.0:3000/
3
- root = Dir.pwd
4
- puts ">>> Serving: #{root}"
5
- run Rack::Directory.new("#{root}")
6
-
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- #use 'gemdo'
4
-
5
- argument :site
6
-
7
- site = output.glob_relative('{site,website,web,www}').first
8
- site = data.site || site || 'site'
9
-
10
- copy :to=>site, :verbatim=>true
11
-