proton 0.3.0.rc1

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.
Files changed (126) hide show
  1. data/AUTHORS +6 -0
  2. data/HISTORY.md +200 -0
  3. data/README.md +75 -0
  4. data/Rakefile +5 -0
  5. data/TODO.md +6 -0
  6. data/bin/proton +7 -0
  7. data/data/new_site/Protonfile +12 -0
  8. data/data/new_site/README.md +10 -0
  9. data/data/new_site/_layouts/default.haml +28 -0
  10. data/data/new_site/index.haml +5 -0
  11. data/data/rack/Gemfile +2 -0
  12. data/data/rack/Gemfile.lock +40 -0
  13. data/data/rack/config.ru +24 -0
  14. data/lib/proton.rb +78 -0
  15. data/lib/proton/cli.rb +227 -0
  16. data/lib/proton/cli/helpers.rb +89 -0
  17. data/lib/proton/compass_support.rb +8 -0
  18. data/lib/proton/config.rb +116 -0
  19. data/lib/proton/helpers.rb +126 -0
  20. data/lib/proton/layout.rb +20 -0
  21. data/lib/proton/meta.rb +17 -0
  22. data/lib/proton/page.rb +431 -0
  23. data/lib/proton/partial.rb +12 -0
  24. data/lib/proton/project.rb +176 -0
  25. data/lib/proton/server.rb +99 -0
  26. data/lib/proton/set.rb +32 -0
  27. data/lib/proton/version.rb +13 -0
  28. data/test/fixture/build_options/control/page.html +0 -0
  29. data/test/fixture/build_options/control/style.css +1 -0
  30. data/test/fixture/build_options/hyde.conf +18 -0
  31. data/test/fixture/build_options/site/page.haml +0 -0
  32. data/test/fixture/build_options/site/style.scss +1 -0
  33. data/test/fixture/compass/hyde.conf +4 -0
  34. data/test/fixture/compass/site/style.scss +5 -0
  35. data/test/fixture/empty_config/hyde.conf +0 -0
  36. data/test/fixture/extensions/control/index.html +1 -0
  37. data/test/fixture/extensions/extensions/a/a.rb +1 -0
  38. data/test/fixture/extensions/extensions/hi.rb +1 -0
  39. data/test/fixture/extensions/hyde.conf +8 -0
  40. data/test/fixture/extensions/site/index.haml +1 -0
  41. data/test/fixture/fail_type/control/about/index.html +2 -0
  42. data/test/fixture/fail_type/control/about/us.html +2 -0
  43. data/test/fixture/fail_type/control/index.html +1 -0
  44. data/test/fixture/fail_type/hyde.conf +8 -0
  45. data/test/fixture/fail_type/site/index.haml +4 -0
  46. data/test/fixture/high_version/hyde.conf +1 -0
  47. data/test/fixture/high_version_2/hyde.conf +1 -0
  48. data/test/fixture/html/control/index.html +2 -0
  49. data/test/fixture/html/hyde.conf +8 -0
  50. data/test/fixture/html/site/index.html +2 -0
  51. data/test/fixture/ignores/control/about.html +1 -0
  52. data/test/fixture/ignores/hyde.conf +10 -0
  53. data/test/fixture/ignores/site/about.haml +1 -0
  54. data/test/fixture/ignores/site/hi.haml +1 -0
  55. data/test/fixture/metadata/control/index.html +4 -0
  56. data/test/fixture/metadata/hyde.conf +8 -0
  57. data/test/fixture/metadata/site/index.haml +8 -0
  58. data/test/fixture/nested_layout/control/index.html +2 -0
  59. data/test/fixture/nested_layout/hyde.conf +9 -0
  60. data/test/fixture/nested_layout/layouts/default.haml +2 -0
  61. data/test/fixture/nested_layout/layouts/post.haml +3 -0
  62. data/test/fixture/nested_layout/site/index.haml +4 -0
  63. data/test/fixture/one/control/about/index.css +1 -0
  64. data/test/fixture/one/control/about/us.html +1 -0
  65. data/test/fixture/one/control/cheers.html +5 -0
  66. data/test/fixture/one/control/css/bar.css +0 -0
  67. data/test/fixture/one/control/css/style.css +1 -0
  68. data/test/fixture/one/control/hello.html +5 -0
  69. data/test/fixture/one/control/hi.html +1 -0
  70. data/test/fixture/one/control/images/bar.gif +0 -0
  71. data/test/fixture/one/control/images/baz.png +0 -0
  72. data/test/fixture/one/control/images/foo.jpg +0 -0
  73. data/test/fixture/one/control/index.html +7 -0
  74. data/test/fixture/one/hyde.conf +9 -0
  75. data/test/fixture/one/layouts/default.haml +4 -0
  76. data/test/fixture/one/partials/menu.haml +3 -0
  77. data/test/fixture/one/public/about/index.css +1 -0
  78. data/test/fixture/one/public/about/us.html +1 -0
  79. data/test/fixture/one/public/cheers.html +5 -0
  80. data/test/fixture/one/public/css/bar.css +0 -0
  81. data/test/fixture/one/public/css/style.css +1 -0
  82. data/test/fixture/one/public/hello.html +5 -0
  83. data/test/fixture/one/public/hi.html +1 -0
  84. data/test/fixture/one/public/images/bar.gif +0 -0
  85. data/test/fixture/one/public/images/baz.png +0 -0
  86. data/test/fixture/one/public/images/foo.jpg +0 -0
  87. data/test/fixture/one/public/index.html +7 -0
  88. data/test/fixture/one/site/about/index.scss +1 -0
  89. data/test/fixture/one/site/about/us.haml +3 -0
  90. data/test/fixture/one/site/cheers.html.haml +1 -0
  91. data/test/fixture/one/site/css/bar.scss +0 -0
  92. data/test/fixture/one/site/css/style.scss +2 -0
  93. data/test/fixture/one/site/hello.haml +3 -0
  94. data/test/fixture/one/site/hi.html +3 -0
  95. data/test/fixture/one/site/images/bar.gif +0 -0
  96. data/test/fixture/one/site/images/baz.png +0 -0
  97. data/test/fixture/one/site/images/foo.jpg +0 -0
  98. data/test/fixture/one/site/index.haml +7 -0
  99. data/test/fixture/parent/control/about/index.html +2 -0
  100. data/test/fixture/parent/control/about/us.html +2 -0
  101. data/test/fixture/parent/control/index.html +1 -0
  102. data/test/fixture/parent/hyde.conf +8 -0
  103. data/test/fixture/parent/site/about/index.haml +3 -0
  104. data/test/fixture/parent/site/about/us.haml +3 -0
  105. data/test/fixture/parent/site/index.haml +3 -0
  106. data/test/fixture/sort/control/about.html +6 -0
  107. data/test/fixture/sort/control/about/hardy.html +1 -0
  108. data/test/fixture/sort/control/about/intrepid.html +1 -0
  109. data/test/fixture/sort/hyde.conf +8 -0
  110. data/test/fixture/sort/site/about.haml +3 -0
  111. data/test/fixture/sort/site/about/hardy.haml +4 -0
  112. data/test/fixture/sort/site/about/intrepid.haml +4 -0
  113. data/test/fixture/subclass/control/index.html +1 -0
  114. data/test/fixture/subclass/extensions/a/a.rb +12 -0
  115. data/test/fixture/subclass/hyde.conf +9 -0
  116. data/test/fixture/subclass/layouts/default.haml +1 -0
  117. data/test/fixture/subclass/layouts/post.haml +1 -0
  118. data/test/fixture/subclass/site/index.haml +4 -0
  119. data/test/helper.rb +36 -0
  120. data/test/unit/build_options_test.rb +18 -0
  121. data/test/unit/extensions_test.rb +17 -0
  122. data/test/unit/fixture_test.rb +122 -0
  123. data/test/unit/page_test.rb +58 -0
  124. data/test/unit/proton_test.rb +27 -0
  125. data/test/unit/set_test.rb +26 -0
  126. metadata +301 -0
data/AUTHORS ADDED
@@ -0,0 +1,6 @@
1
+ Credits
2
+ =======
3
+
4
+ Hyde was created and being developed and maintained by Rico Sta. Cruz of Sinefunc, Inc.
5
+
6
+ A hat tip goes to Tom Preston-Werner (mojombo) for Jekyll, the very project that inspired Hyde.
data/HISTORY.md ADDED
@@ -0,0 +1,200 @@
1
+ Proton v0.3.0 - Jun 22, 2011
2
+ ----------------------------
3
+
4
+ **The project has been renamed to Proton** (previously called *Hyde*).
5
+
6
+ ### Changed:
7
+ * The main class is now called `Proton` instead of `Hyde`. However, `Hyde`
8
+ still works as an alias.
9
+ * The main executable is now called `proton` (and not `hyde`).
10
+ * The configuration file is now called `Protonfile`. The legacy `hyde.conf`
11
+ and `.hyderc` still works for backward-compatibility.
12
+
13
+ Hyde v0.2.3 - Jun 20, 2011
14
+ --------------------------
15
+
16
+ ### Changed:
17
+ * Use a bundler Gemfile for Hyde sites if a Gemfile is found.
18
+
19
+ ### Fixed:
20
+ * **Fixed `hyde create`.**
21
+ * Fixed overriding of Hyde::CLI via commands not working.
22
+ * Fixed the rel() helper.
23
+
24
+ Hyde v0.2.2 - Jun 16, 2011
25
+ --------------------------
26
+
27
+ ### Added:
28
+ * **Built-in Compass support.**
29
+ * **Enable Sass, SCSS, Haml, Textile and Markdown by default.**
30
+ * Extensions from `_extensions/*rb` will now be loaded.
31
+
32
+ ### Changed:
33
+ * The default `hyde.conf` now comments out the default stuff you don't need to set.
34
+ * Update dependencies to Cuba 2.0, and Hashie 1.0.
35
+
36
+ Hyde v0.1.14 - Jun 04, 2011
37
+ ---------------------------
38
+
39
+ ### Fixed:
40
+ * Fixed a syntax error in page.rb.
41
+ * Don't impose gem versions explicitly, and don't load Rubygems if used as a
42
+ library.
43
+
44
+ ### Misc:
45
+ * Added some doc comments to the main classes.
46
+
47
+ Hyde v0.1.13
48
+ ------------
49
+
50
+ - Try to fix an edge case where the path '/' gives you an arbitrary dotfile.
51
+
52
+ Hyde v0.1.11
53
+ ------------
54
+
55
+ - Deprecate in-app caching for rack-cache.
56
+ - The Hyde server now sends the Last-Modified HTTP header.
57
+ - New Hyde sites will now use rack-cache (optionally) when used as a Rack site.
58
+
59
+ Hyde v0.1.10
60
+ -------
61
+
62
+ - New Hyde sites will now have a gems manifest. This means you can
63
+ push your Hyde sites to Heroku instantly.
64
+ - Add cuba to dependencies.
65
+ - The server now serves the right MIME types.
66
+ - When used as a Rack app, Hyde sends cache headers.
67
+
68
+ Hyde v0.1.9
69
+ -----------
70
+
71
+ - Hotfix: tilt_build_options should work even if there was no tilt_options specified.
72
+
73
+ Hyde v0.1.8
74
+ -----------
75
+
76
+ - Fix: 404 pages in 'hyde start' no longer throws an exception log to the viewer.
77
+ - Implemented the `content_for` and `yield_content` helpers.
78
+ - Fix partial locals not working.
79
+ - Allow having the same layouts/partials path as the site.
80
+ - Implement `Hyde.project` which returns the latest project. (deprecates $project)
81
+ - Support tilt_build_options in the config.
82
+
83
+ Hyde v0.1.7
84
+ -----------
85
+
86
+ - Show friendlier error messages.
87
+ - Show steps on how to install missing gems when any are encountered.
88
+ - Change 'hyde build' display format to look better.
89
+
90
+ Hyde v0.1.6
91
+ -----------
92
+
93
+ - Fix an edge case where files containing '---' somewhere is treated wrong.
94
+ - Ruby 1.8 compatibility.
95
+
96
+ Hyde v0.1.4
97
+ -----------
98
+
99
+ - Fix: `hyde start` was giving errors.
100
+
101
+ Hyde v0.1.3
102
+ -----------
103
+
104
+ - .html files are now being treated as .erb.
105
+ - Implement `page.children.find`.
106
+ - Implement `page.children.except`.
107
+ - Fix #children and sorting giving errors.
108
+ - Fix #siblings.
109
+ - Revise the 'no config file found' error message.
110
+ - Allow `.hyderc` as a filename.
111
+ - Add help for `hyde help start`.
112
+ - Support `hyde start -D` which is a very hackish solution to have
113
+ Hyde start as a daemon.
114
+
115
+ Hyde v0.1.2
116
+ -----------
117
+
118
+ - Allow `hyde create .` to add a hyde.conf in the current folder.
119
+ - Revamp the help screen.
120
+ - Fix: change the default load path for Sass/SCSS to 'css'.
121
+ - Add Page#depth.
122
+ - Fix Page#breadcrumbs.
123
+ - Fix Page#parent.
124
+ - Add the `rel` helper.
125
+ - Generated Hyde projects are now Rack-compatible.
126
+
127
+ Hyde v0.1.1
128
+ -----------
129
+
130
+ - Default project is now simpler. The site_path is `.`.
131
+ - Implement `Project#build`.
132
+ - If YAML parsing of page metadata fails, treat it as content.
133
+ - All options in `hyde.conf` are now optional (even `hyde_requirement`).
134
+ - Page metadata can now only be a hash.
135
+ - Fix `hyde start`.
136
+ - Minimum Ruby version is now at 1.8.6.
137
+
138
+ Hyde v0.1.0
139
+ -----------
140
+
141
+ **Complete rewrite.** Many thing have been deprecated.
142
+
143
+ - Now uses Tilt (for templates), Shake (for CLI) and Cuba (for the server).
144
+ - Now supports everything Tilt supports: CoffeeScript, Liquid, etc.
145
+ - Allow `tilt_options` in hyde.conf.
146
+ - Old extensions will be broken (but who made any yet, anyway?)
147
+ - Update the `hyde create` template's gitignore file to account for _public.
148
+
149
+ Hyde v0.0.8
150
+ -----------
151
+
152
+ - Add support for subclassing. (just add a 'type' meta)
153
+ - Implement Project#all.
154
+ - Implement Page#all and Page#all(type).
155
+ - Fix binary files losing extensions on 'hyde build'.
156
+ - Allow "layout: false" to ensure that a page doesn't have a layout.
157
+ - Fix bug where "index.html.haml" and "index.rss.haml" clash.
158
+ - Implement Page#content.
159
+
160
+ Hyde v0.0.7
161
+ -----------
162
+
163
+ - Add support for Sass and SCSS.
164
+ - Add support for ignored files.
165
+
166
+ Hyde v0.0.6
167
+ -----------
168
+
169
+ - Added support for blocks for `yield_content` (as default text).
170
+ - `Page#referrer` now is a page (instead of a string of the name).
171
+ - Partials path is now not ignored by default.
172
+ - Add support for page ordering (by the `position` key in metadata).
173
+ - You can now start an IRB session with the `hyde console` command.
174
+ - Implement traversion methods for page: #next, #previous, #siblings,
175
+ and #parent.
176
+ - Implement the 'page' variable to be available in pages.
177
+ - Add Page#title.
178
+ - Add Page#path.
179
+ - Add Page#breadcrumbs.
180
+ - Implement Utils#escape_html.
181
+ - Hyde now always tries 'layouts/default.*' as the default layout, if none's
182
+ specified. (TODO: layout: false)
183
+ - Implement Renderer.layoutable?, which dictates if a renderer is capable of
184
+ having a layout.
185
+
186
+ Hyde v0.0.5 - 2010-05-30
187
+ ------------------------
188
+
189
+ - Implemented `content_for` and `yield_content` helpers
190
+ - Added `partials_path` config variable
191
+ - Changed helper method `partial`s syntax (from `partial X, :locals => { ... }` to `partial X, ...`)
192
+ - Line numbers for errors are shown now
193
+ - Added rudimentary 404 page
194
+ - Added `hyde_requirement` config variable -- Hyde will now not proceed if the project needs a later version of Hyde
195
+ - Extensions are now auto-guessed (for example, 'foo.less' will be accessible as 'foo.css')
196
+
197
+ Hyde v0.0.4 - 2010-05-25
198
+ ------------------------
199
+
200
+ - First public release
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # [Proton](http://sinefunc.com/proton?)
2
+ #### Proton is a website preprocessor.
3
+
4
+ http://sinefunc.com/proton/
5
+
6
+ - __HAML, Sass, Compass and more:__ Proton will let you write in HAML, SCSS,
7
+ Sass, and more by default. It also comes preloaded with
8
+ [Compass](http://compass-style.org).
9
+
10
+ - __Layouts and Partials:__ Proton lets you define your site's header and footer
11
+ layouts in a separate file, and even separate snippets of your site
12
+ into reuseable components (partials). Your code will be much cleaner and
13
+ DRYer!
14
+
15
+ - __Template languages:__ Proton lets you write your site in any template
16
+ language you need -- the translation will be taken care of for you.
17
+ Proton supports HAML, LessCSS, Markdown, SASS and Textile by default, and
18
+ more can be added through extensions.
19
+
20
+ - __Extendable:__ Proton is easily customizable with extensions. You can add
21
+ new helpers, new commands, support for new languages and many more by
22
+ simply adding the extensions to your project folder. Some are even
23
+ available as simple Ruby gems!
24
+
25
+ - __Design fast:__ Proton comes with a web server that lets you serve up
26
+ your site locally. Any changes to your files will be seen on your next
27
+ browser refresh!
28
+
29
+ - __Build your site as static HTMLs:__ You can export your site as plain
30
+ HTML files with one simple command.
31
+
32
+ Why use Proton?
33
+ ---------------
34
+
35
+ It's like building a static site, but better! You can use Proton for:
36
+
37
+ - Building HTML prototypes
38
+ - Building sites with no dynamic logic
39
+ - Creating a blog where the entries are stored in a source repository
40
+
41
+ Installation
42
+ ------------
43
+
44
+ gem install protonweb
45
+
46
+ Usage
47
+ -----
48
+
49
+ Here's how you can get started:
50
+
51
+ proton create <project_name>
52
+ cd <project_name>
53
+ proton build # <= Build the HTML files, or
54
+ proton start # <= Serve via a local web server
55
+
56
+
57
+ Testing
58
+ -------
59
+
60
+ Run tests:
61
+
62
+ rake test
63
+
64
+ To try it in a different Ruby version, you can use RVM + Bundler to make
65
+ things easier. For instance:
66
+
67
+ rvm use 1.8.7@proton --create # Create a gemset
68
+ bundle install # Install the needed gems on that set
69
+ rake test
70
+
71
+ Authors
72
+ -------
73
+
74
+ Authored and maintained by Rico Sta. Cruz and Sinefunc, Inc.
75
+ See [sinefunc.com](http://sinefunc.com) for more about our work!
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ task :test do
2
+ Dir['test/**/*_test.rb'].each { |f| load f }
3
+ end
4
+
5
+ task :default => :test
data/TODO.md ADDED
@@ -0,0 +1,6 @@
1
+ - Caching
2
+ - MIME types
3
+
4
+ - Post build hooks?
5
+ - tilt_build_options
6
+ - deprecate $project, implement Hyde.project
data/bin/proton ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ $:.push File.expand_path('../../lib', __FILE__)
3
+
4
+ require 'rubygems' unless defined?(::Gem)
5
+ require 'proton'
6
+
7
+ Proton::CLI.run!
@@ -0,0 +1,12 @@
1
+ # This is a Proton site.
2
+ # Install Proton (`gem install proton`) and type `proton` for help.
3
+ requirement: 0.2
4
+
5
+ # The folder where the site's source files are kept.
6
+ site_path: .
7
+ output_path: _output
8
+
9
+ # Other paths:
10
+ layouts_path: _layouts
11
+ extensions_path: _extensions
12
+ partials_path: .
@@ -0,0 +1,10 @@
1
+ Instructions
2
+ ------------
3
+
4
+ 1. Make sure Ruby (>= v1.8) is installed.
5
+ 2. Install the proton gem: `gem install proton`
6
+ 3. Build the site HTML files by typing: `proton build`
7
+
8
+ (If #2 fails, you may need to type `sudo gem install proton` instead.)
9
+
10
+
@@ -0,0 +1,28 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title= page.title
5
+
6
+ %meta(charset='UTF-8')
7
+ -# Use the latest IE engine, or Chrome frame.
8
+ %meta(http-equiv='X-UA-Compatible' content='IE=edge,chrome=1')
9
+
10
+ -# Mobile viewport optimization. j.mp/bplateviewport
11
+ %meta(name='viewport' content='width=device-width, initial-scale=1.0')
12
+
13
+ -# Standard SEO meta
14
+ - if page.meta.keywords
15
+ %meta{:name => 'keywords', :content => page.meta.keywords}
16
+ - if page.meta.description
17
+ %meta{:name => 'description', :content => page.meta.description}
18
+
19
+ %link{:rel => 'stylesheet', :href => '/css/style.css'}
20
+
21
+ %body
22
+ #content
23
+ != yield
24
+
25
+ %div#footer
26
+ %hr
27
+ %p Generated by Hyde
28
+
@@ -0,0 +1,5 @@
1
+ layout: default
2
+ title: Your new Hyde site
3
+ --
4
+ %h1 It works!
5
+ %p This is your new site. Feel free to take a look around!
data/data/rack/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ gem "proton", "0.3.0.rc1"
2
+ gem "rack-cache", "~> 1.0.0"
@@ -0,0 +1,40 @@
1
+ GEM
2
+ specs:
3
+ RedCloth (4.2.3)
4
+ chunky_png (1.2.0)
5
+ compass (0.11.3)
6
+ chunky_png (~> 1.2)
7
+ fssm (>= 0.2.7)
8
+ sass (~> 3.1)
9
+ cuba (2.0.0)
10
+ rack (~> 1.2)
11
+ tilt (~> 1.2)
12
+ fssm (0.2.7)
13
+ haml (3.1.1)
14
+ hashie (1.0.0)
15
+ maruku (0.6.0)
16
+ syntax (>= 1.0.0)
17
+ proton (0.3.0.rc1)
18
+ RedCloth (~> 4.2.3)
19
+ compass (~> 0.11.1)
20
+ cuba (~> 2.0.0)
21
+ haml (~> 3.1.1)
22
+ hashie (~> 1.0.0)
23
+ maruku (~> 0.6.0)
24
+ sass (~> 3.1.1)
25
+ shake (~> 0.1)
26
+ tilt (~> 1.2.2)
27
+ rack (1.3.0)
28
+ rack-cache (1.0.2)
29
+ rack (>= 0.4)
30
+ sass (3.1.1)
31
+ shake (0.1.2)
32
+ syntax (1.0.0)
33
+ tilt (1.2.2)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ proton (= 0.3.0.rc1)
40
+ rack-cache (~> 1.0.0)
@@ -0,0 +1,24 @@
1
+ # This file exists to make this project Rack-compatible.
2
+ # You may delete it if you're not concerned about this.
3
+
4
+ require 'rubygems' unless defined?(::Gem)
5
+
6
+ # Use Bundler if possible.
7
+ begin
8
+ require 'bundler'
9
+ Bundler.setup
10
+ rescue LoadError
11
+ gem 'proton', '0.3.0.rc1'
12
+ end
13
+
14
+ # Add the 'rack-cache' gem if you want to enable caching.
15
+ begin
16
+ require 'rack/cache'
17
+ use Rack::Cache
18
+ rescue LoadError
19
+ end
20
+
21
+ # Load Proton.
22
+ require 'proton/server'
23
+ Proton::Project.new File.dirname(__FILE__)
24
+ run Proton::Server
data/lib/proton.rb ADDED
@@ -0,0 +1,78 @@
1
+ $:.push *Dir[File.expand_path('../../vendor/*/lib', __FILE__)]
2
+
3
+ require 'fileutils'
4
+ require 'ostruct'
5
+ require 'hashie'
6
+ require 'yaml'
7
+ require 'tilt'
8
+ require 'shake'
9
+
10
+ # For Compass and such
11
+ Encoding.default_external = 'utf-8' if defined?(::Encoding)
12
+
13
+ # HTML files as ERB
14
+ Tilt.mappings['html'] = Tilt.mappings['erb']
15
+
16
+ # Class: Proton
17
+ # The Proton class.
18
+ #
19
+ # ## Description
20
+ # This is the main class.
21
+ #
22
+ # This class is also aliased as `Hyde` for backward-compatibility with
23
+ # versions <= 0.2.x, when the project was still called Hyde.
24
+
25
+ class Proton
26
+ PREFIX = File.expand_path('../', __FILE__)
27
+
28
+ # Class: Proton::Error
29
+ # An error.
30
+ #
31
+ # ## Description
32
+ # The class Error describes any error thrown by the application.
33
+ #
34
+ # ## Example
35
+ #
36
+ # begin
37
+ # Proton::Project.new './my_project/'
38
+ # rescue Proton::LegacyError => e
39
+ # puts "Old version."
40
+ # rescue Proton::VersionError => e
41
+ # puts "The project requires a newer version of Proton."
42
+ # rescue Proton::Error => e
43
+ # puts e
44
+ # end
45
+
46
+ Error = Class.new(StandardError)
47
+ LegacyError = Class.new(Error)
48
+ VersionError = Class.new(Error)
49
+
50
+ # Constant: CONFIG_FILES (Proton)
51
+ # An array of the allowed config filenames.
52
+ CONFIG_FILES = ['Protonfile', 'proton.conf', '.protonrc', 'hyde.conf', '.hyderc']
53
+
54
+ autoload :Project, "#{PREFIX}/proton/project"
55
+ autoload :Page, "#{PREFIX}/proton/page"
56
+ autoload :Meta, "#{PREFIX}/proton/meta"
57
+ autoload :Config, "#{PREFIX}/proton/config"
58
+ autoload :CLI, "#{PREFIX}/proton/cli"
59
+ autoload :Set, "#{PREFIX}/proton/set"
60
+ autoload :Layout, "#{PREFIX}/proton/layout"
61
+ autoload :Partial, "#{PREFIX}/proton/partial"
62
+ autoload :Helpers, "#{PREFIX}/proton/helpers"
63
+
64
+ require "#{PREFIX}/proton/version"
65
+
66
+ class << self
67
+ # Attribute: project (Proton)
68
+ # Returns the latest project.
69
+ #
70
+ # ## Example
71
+ # Proton.project.path(:site)
72
+
73
+ attr_accessor :project
74
+ end
75
+ end
76
+
77
+ # For backward compatibility reasons, Hyde is an alias for Proton.
78
+ Hyde = Proton