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/.ruby ADDED
@@ -0,0 +1,56 @@
1
+ ---
2
+ source:
3
+ - var
4
+ authors:
5
+ - name: trans
6
+ email: transfire@gmail.com
7
+ copyrights:
8
+ - holder: Rubyworks
9
+ year: '2006'
10
+ replacements: []
11
+ alternatives: []
12
+ requirements:
13
+ - name: neapolitan
14
+ version: 0.4.0+
15
+ - name: detroit
16
+ groups:
17
+ - build
18
+ development: true
19
+ - name: reap
20
+ groups:
21
+ - build
22
+ development: true
23
+ - name: lemon
24
+ groups:
25
+ - test
26
+ development: true
27
+ - name: ae
28
+ groups:
29
+ - test
30
+ development: true
31
+ dependencies: []
32
+ conflicts: []
33
+ repositories:
34
+ - uri: git://github.com/rubyworks/brite.git
35
+ scm: git
36
+ name: upstream
37
+ resources:
38
+ home: http://rubyworks.github.com/brite
39
+ code: http://github.com/rubyworks/brite
40
+ bugs: http://github.com/rubyworks/brite/issues
41
+ mail: http://groups.google.com/groups/rubyworks-mailinglist
42
+ extra: {}
43
+ load_path:
44
+ - lib
45
+ revision: 0
46
+ summary: Super Simple Static Site Generation
47
+ title: Brite
48
+ version: 0.7.0
49
+ name: brite
50
+ description: ! 'Brite is an easy to use, light-weight website generator. It supports
51
+
52
+ a variety of backend rendering engines including erb, liquid, rdoc,
53
+
54
+ markdown, textile and so on.'
55
+ organization: RubyWorks
56
+ date: '2011-12-17'
@@ -0,0 +1,30 @@
1
+ = COPYRIGHT NOTICES
2
+
3
+ == Brite - Copyright (c) 2009 Rubyworks
4
+
5
+ PROJECT:: Brite
6
+ WEBSITE:: http://rubyworks.github.com/brite
7
+ LICENSE:: BSD-2-Clause License
8
+
9
+ Copyright (c) 2009 Rubyworks
10
+
11
+ Redistribution and use in source and binary forms, with or without modification, are
12
+ permitted provided that the following conditions are met:
13
+
14
+ 1. Redistributions of source code must retain the above copyright notice, this list of
15
+ conditions and the following disclaimer.
16
+
17
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
18
+ of conditions and the following disclaimer in the documentation and/or other materials
19
+ provided with the distribution.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY EXPRESS OR IMPLIED
22
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
23
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
@@ -1,6 +1,20 @@
1
1
  = RELEASE HISTORY
2
2
 
3
- == 0.6.0 / 2008-11-12
3
+
4
+ == 0.7.0 / 2011-12-15
5
+
6
+ New release of Brite cleans up the code a great deal, adds templated route
7
+ support via `route` field, and actually adds a few unit tests (wowzeres,
8
+ that's a good thing, right?).
9
+
10
+ Changes:
11
+
12
+ * Add route field for templated routes.
13
+ * Fix use of config field defaults.
14
+ * Add some initial unit tests.
15
+
16
+
17
+ == 0.6.0 / 2010-11-12
4
18
 
5
19
  Version 0.6 is a full rewrite of Brite's underlying site generation system.
6
20
  Where as before the Site and Page classes handled their own rendering, now
@@ -14,7 +28,7 @@ Changes:
14
28
  * Sow templates modified to work with latest release.
15
29
 
16
30
 
17
- == 0.5.0 / 2008-10-25
31
+ == 0.5.0 / 2010-10-25
18
32
 
19
33
  Brite (formerly Webrite) has been completely rewritten from the ground-up,
20
34
  applying a number of ideas gathered from other systems and adding further
@@ -2,60 +2,68 @@
2
2
 
3
3
  A Shiny Static Website Generator
4
4
 
5
- * home: http://proutils.github.com/brite
6
- * code: http://github.com/proutils/brite
5
+ {Homepage}[http://rubyworks.github.com/brite] /
6
+ {Documentation}[http://rubydoc.info/gems/brite/frames] /
7
+ {Report Issue}[http://github.com/rubyworks/brite/issues] /
8
+ {Development}[http://github.com/rubyworks/brite] /
9
+ {Mailing List}[http://groups.google.com/group/rubyworks-mailinglist]
10
+
11
+ {<img src="http://travis-ci.org/rubyworks/brite.png" />}[http://travis-ci.org/rubyworks/brite]
7
12
 
8
13
 
9
14
  == DESCRIPTION
10
15
 
11
16
  Brite is an inovative static website/blog generation utility
12
- which is as easy to use as it is versitle.
17
+ which is as easy to use as it is versatile.
13
18
 
14
19
 
15
20
  == FEATURES
16
21
 
17
- * Generates files in place (no special subdirectories required).
18
- * Utilizes multi-format templates via Neapolitan.
19
- * Supports many markup and templating formats.
22
+ * Site layout is 100% user-defined.
23
+ * Can generate files in place, so no "special directories" are required.
24
+ * Alternatively templated routes can customize the site organization.
25
+ * Supports multi-format templates via Neapolitan template engine.
26
+ * Supports many markup and templating formats via Malt or Tilt.
20
27
 
21
28
 
22
29
  == SYNOPSIS
23
30
 
24
- To use Brite create .page, .post and .layout files and then
25
- run:
31
+ Very briefly, one creates `.page`, `.post`, .part and `.layout` files and
32
+ then runs:
26
33
 
27
34
  $ brite
28
35
 
29
- For details please see the Brite website and the GitHub repository. In
30
- particular have a look at the `site/` directory which contains Brites
31
- own website built on Brite.
36
+ Voila, website made!
37
+
38
+ Of course, the question really is how does one go about creating `.page`,
39
+ `.post`, `.part` and `.layout` files and such. For information about that see the
40
+ {Brite website}[https://rubyworks.github.com/brite] and see the
41
+ {Getting Started Tutorial}[https://github.com/rubyworks/brite/wiki/Getting-Started].
42
+
43
+ For a quick start, have a look at the {brite-site repository}[https://github.com/rubyworks/brite-site]
44
+ which contains a generic Brite project anyone can use to start their own Brite Site.
45
+
46
+ To get further under the hood see Brite source code in the
47
+ {GitHub hosted repository}[http://github.com/rubyworks/brite]
48
+ and read the {API documentation}[http://rubydoc.info/gems/brite/frames].
32
49
 
33
50
 
34
51
  == HOW TO INSTALL
35
52
 
36
53
  === RubyGems
37
54
 
38
- $ sudo gem install brite
55
+ $ gem install brite
39
56
 
40
57
  === Setup.rb
41
58
 
42
- If you're old fashion and want to install to a site
43
- location, see Setup.rb[http://rubyworks.github.com/setup].
44
-
45
-
46
- == COPYRIGHT/LICENSE
59
+ If you're old fashion and want to install to a site location,
60
+ see Setup.rb[http://rubyworks.github.com/setup].
47
61
 
48
- Copyright (c) 2009 Thomas Sawyer
49
62
 
50
- Licensed under the Apache License, Version 2.0 (the "License");
51
- you may not use this file except in compliance with the License.
52
- You may obtain a copy of the License at
63
+ == COPYRIGHTS
53
64
 
54
- http://www.apache.org/licenses/LICENSE-2.0
65
+ Copyright (c) 2009 Rubyworks
55
66
 
56
- Unless required by applicable law or agreed to in writing, software
57
- distributed under the License is distributed on an "AS IS" BASIS,
58
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59
- See the License for the specific language governing permissions and
60
- limitations under the License.
67
+ Brite is distributable in accordance to the *BSD-2-Clause* license.
61
68
 
69
+ See COPYING.rdoc file for details.
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'brite/server'
3
- Brite::Server.start
3
+ Brite::Server.start(ARGV)
4
4
 
@@ -6,6 +6,7 @@
6
6
  #
7
7
  module Brite; end
8
8
 
9
- require 'brite/meta/data'
9
+ require 'brite/version'
10
10
  require 'brite/controller'
11
11
  require 'brite/command'
12
+
@@ -0,0 +1,56 @@
1
+ ---
2
+ source:
3
+ - var
4
+ authors:
5
+ - name: trans
6
+ email: transfire@gmail.com
7
+ copyrights:
8
+ - holder: Rubyworks
9
+ year: '2006'
10
+ replacements: []
11
+ alternatives: []
12
+ requirements:
13
+ - name: neapolitan
14
+ version: 0.4.0+
15
+ - name: detroit
16
+ groups:
17
+ - build
18
+ development: true
19
+ - name: reap
20
+ groups:
21
+ - build
22
+ development: true
23
+ - name: lemon
24
+ groups:
25
+ - test
26
+ development: true
27
+ - name: ae
28
+ groups:
29
+ - test
30
+ development: true
31
+ dependencies: []
32
+ conflicts: []
33
+ repositories:
34
+ - uri: git://github.com/rubyworks/brite.git
35
+ scm: git
36
+ name: upstream
37
+ resources:
38
+ home: http://rubyworks.github.com/brite
39
+ code: http://github.com/rubyworks/brite
40
+ bugs: http://github.com/rubyworks/brite/issues
41
+ mail: http://groups.google.com/groups/rubyworks-mailinglist
42
+ extra: {}
43
+ load_path:
44
+ - lib
45
+ revision: 0
46
+ summary: Super Simple Static Site Generation
47
+ title: Brite
48
+ version: 0.7.0
49
+ name: brite
50
+ description: ! 'Brite is an easy to use, light-weight website generator. It supports
51
+
52
+ a variety of backend rendering engines including erb, liquid, rdoc,
53
+
54
+ markdown, textile and so on.'
55
+ organization: RubyWorks
56
+ date: '2011-12-17'
@@ -5,78 +5,123 @@ module Brite
5
5
 
6
6
  # Initialize and run Command.
7
7
  def self.cli(*argv)
8
- Command.new(*argv).call
8
+ Command.call(*argv)
9
9
  end
10
10
 
11
- # Webrite command line interface.
12
- class Command
11
+ # Brite command module.
12
+ module Command
13
+ extend self
13
14
 
14
- # New Command.
15
- def initialize(*argv)
16
- @output = nil #@argv.shift
17
- @url = nil
18
- @dryrun = false
19
- @trace = false
15
+ # Execute command.
16
+ #
17
+ # @public
18
+ def call(*argv)
19
+ options = parse(argv)
20
+
21
+ begin
22
+ controller(options).build
23
+ rescue => e
24
+ $DEBUG ? raise(e) : puts(e.message)
25
+ end
26
+ end
27
+
28
+ # Create an instance of Brite::Controller given controller options.
29
+ #
30
+ # @private
31
+ #
32
+ # @return [Controller] New controller instance.
33
+ def controller(options)
34
+ Controller.new(options)
35
+ end
36
+
37
+ # Parse controller options from command line arguments.
38
+ #
39
+ # @private
40
+ #
41
+ # @return [Hash] controller options
42
+ def parse(argv)
43
+ parser = OptionParser.new
44
+
45
+ options = {
46
+ :output => nil,
47
+ :url => nil
48
+ }
49
+
50
+ options_url parser, options
51
+ options_general parser, options
52
+ options_help parser, options
20
53
 
21
54
  parser.parse!(argv)
22
55
 
23
- @location = argv.shift || '.'
56
+ options[:location] = argv.shift || '.'
57
+
58
+ options
24
59
  end
25
60
 
26
- # Returns an OptionParser instance.
27
- def parser
28
- OptionParser.new do |opt|
29
- opt.on("--url URL", "site URL") do |url|
30
- @url = url
31
- end
32
-
33
- opt.on("--trace", "show extra operational information") do
34
- @trace = true
35
- end
36
-
37
- opt.on("--dryrun", "-n", "don't actually write to disk") do
38
- @dryrun = true
39
- end
40
-
41
- opt.on("--force", "force overwrites") do
42
- $FORCE = true
43
- end
44
-
45
- opt.on("--debug", "run in debug mode") do
46
- $DEBUG = true
47
- end
48
-
49
- opt.on("--warn", "show Ruby warnings") do
50
- $VERBOSE = true
51
- end
52
-
53
- opt.on_tail("--help", "display this help message") do
54
- puts opt
55
- exit
56
- end
61
+ # Add `--url` option to command line parser.
62
+ #
63
+ # @param [OptionParser] parser
64
+ # An instance of option parser.
65
+ #
66
+ # @param [Hash] options
67
+ # An options hash to be passed to Controller.
68
+ #
69
+ # @private
70
+ def options_url(parser, options)
71
+ parser.on("--url URL", "website fully qualified URL") do |url|
72
+ options[:url] = url
57
73
  end
58
74
  end
59
75
 
76
+ # Add `--trace`, `--dryrun`, `--force`, `--debug` and `--warn` options
77
+ # to command line interface. These are all "global" options which means
78
+ # they set global variables if used.
60
79
  #
61
- def call
62
- begin
63
- controller.build
64
- rescue => e
65
- $DEBUG ? raise(e) : puts(e.message)
80
+ # @param [OptionParser] parser
81
+ # An instance of option parser.
82
+ #
83
+ # @param [Hash] options
84
+ # An options hash to be passed to Controller.
85
+ #
86
+ # @private
87
+ def options_general(parser, options)
88
+ parser.on("--trace", "show extra operational information") do
89
+ $TRACE = true
90
+ end
91
+
92
+ parser.on("--dryrun", "-n", "don't actually write to disk") do
93
+ $DRYRUN = true
94
+ end
95
+
96
+ parser.on("--force", "force overwrites") do
97
+ $FORCE = true
98
+ end
99
+
100
+ parser.on("--debug", "run in debug mode") do
101
+ $DEBUG = true
102
+ end
103
+
104
+ parser.on("--warn", "show Ruby warnings") do
105
+ $VERBOSE = true
66
106
  end
67
107
  end
68
108
 
69
- def controller
70
- Controller.new(
71
- :location => @location,
72
- :output => @output,
73
- :url => @url,
74
- :dryrun => @dryrun,
75
- :trace => @trace
76
- )
109
+ # Add `--help` option to command line parser.
110
+ #
111
+ # @param [OptionParser] parser
112
+ # An instance of option parser.
113
+ #
114
+ # @param [Hash] options
115
+ # An options hash to be passed to Controller.
116
+ #
117
+ # @private
118
+ def options_help(parser, options)
119
+ parser.on_tail("--help", "display this help message") do
120
+ puts opt
121
+ exit
122
+ end
77
123
  end
78
124
 
79
125
  end
80
126
 
81
127
  end
82
-