proton 0.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,8 @@
1
+ hyde_requirement: 0.1
2
+ site_path: site
3
+ extensions_path: extensions
4
+ output_path: public
5
+ ignore:
6
+ - **/*~
7
+ - **/compass/**/*
8
+ - **/_*.scss
@@ -0,0 +1,2 @@
1
+ <h1>Welcome.</h1>
2
+ <%= "Hello" %>
@@ -0,0 +1 @@
1
+ <h1>ello</h1>
@@ -0,0 +1,10 @@
1
+ hyde_requirement: 0.1
2
+ site_path: site
3
+ extensions_path: extensions
4
+ output_path: public
5
+ partials_path: site
6
+ ignore:
7
+ - **/*~
8
+ - **/h*
9
+ - **/compass/**/*
10
+ - **/_*.scss
@@ -0,0 +1 @@
1
+ %h1 ello
@@ -0,0 +1 @@
1
+ xxx
@@ -0,0 +1,4 @@
1
+ <h1>Hyde is it</h1>
2
+ <pre class='prettyprint lang-html'>title: Hello world!
3
+ ---
4
+ <div class='highlight'> &lt;h1&gt;Hi&lt;/hi&gt;</div></pre>
@@ -0,0 +1,8 @@
1
+ hyde_requirement: 0.1
2
+ site_path: site
3
+ extensions_path: extensions
4
+ output_path: public
5
+ ignore:
6
+ - **/*~
7
+ - **/compass/**/*
8
+ - **/_*.scss
@@ -0,0 +1,8 @@
1
+ title: Hyde is it
2
+ ---
3
+ %h1= meta.title
4
+ %pre.prettyprint.lang-html
5
+ :escaped
6
+ title: Hello world!
7
+ ---
8
+ .highlight=" <h1>Hi</hi>"
@@ -0,0 +1,2 @@
1
+ <div id='default'><h1>Boo!</h1></div>
2
+ <div id='number'>10</div>
@@ -0,0 +1,9 @@
1
+ hyde_requirement: 0.1
2
+ site_path: site
3
+ extensions_path: extensions
4
+ layouts_path: layouts
5
+ output_path: public
6
+ ignore:
7
+ - **/*~
8
+ - **/compass/**/*
9
+ - **/_*.scss
@@ -0,0 +1,2 @@
1
+ #default!= yield
2
+ #number!= page.ten
@@ -0,0 +1,3 @@
1
+ layout: default
2
+ --
3
+ %h1!= yield
@@ -0,0 +1,4 @@
1
+ layout: post
2
+ ten: 10
3
+ --
4
+ Boo!
@@ -0,0 +1 @@
1
+ div{color:red}
@@ -0,0 +1 @@
1
+ <h1>hi</h1>
@@ -0,0 +1,5 @@
1
+ <html>
2
+ <h1>Site</h1>
3
+ <hr />
4
+ <div id='content'>lo.</div>
5
+ </html>
File without changes
@@ -0,0 +1 @@
1
+ dir{color:#332211}
@@ -0,0 +1,5 @@
1
+ <html>
2
+ <h1>Site</h1>
3
+ <hr />
4
+ <div id='content'><h1>Welcome!</h1></div>
5
+ </html>
@@ -0,0 +1 @@
1
+ Hello.
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ <ul>
2
+ <li>Home</li>
3
+ <li>About us</li>
4
+ </ul>
5
+ <h2>Home page</h2>
6
+ &lt;a&gt;
7
+ <a>
@@ -0,0 +1,9 @@
1
+ hyde_requirement: "0.1"
2
+ site_path: site
3
+ layouts_path: layouts
4
+ partials_path: partials
5
+ output_path: public
6
+ ignore:
7
+ - **/*~
8
+ - **/compass/**/*
9
+ - **/_*.scss
@@ -0,0 +1,4 @@
1
+ %html
2
+ %h1 Site
3
+ %hr
4
+ #content!= yield
@@ -0,0 +1,3 @@
1
+ %ul
2
+ %li Home
3
+ %li About us
@@ -0,0 +1 @@
1
+ div{color:red}
@@ -0,0 +1 @@
1
+ <h1>hi</h1>
@@ -0,0 +1,5 @@
1
+ <html>
2
+ <h1>Site</h1>
3
+ <hr />
4
+ <div id='content'>lo.</div>
5
+ </html>
File without changes
@@ -0,0 +1 @@
1
+ dir{color:#332211}
@@ -0,0 +1,5 @@
1
+ <html>
2
+ <h1>Site</h1>
3
+ <hr />
4
+ <div id='content'><h1>Welcome!</h1></div>
5
+ </html>
@@ -0,0 +1 @@
1
+ Hello.
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ <ul>
2
+ <li>Home</li>
3
+ <li>About us</li>
4
+ </ul>
5
+ <h2>Home page</h2>
6
+ &lt;a&gt;
7
+ <a>
@@ -0,0 +1 @@
1
+ div { color: red; }
@@ -0,0 +1,3 @@
1
+ layout: false
2
+ --
3
+ %h1 hi
@@ -0,0 +1 @@
1
+ lo.
File without changes
@@ -0,0 +1,2 @@
1
+ $red: #321;
2
+ dir { color: $red; }
@@ -0,0 +1,3 @@
1
+ hello: world
2
+ --
3
+ %h1 Welcome!
@@ -0,0 +1,3 @@
1
+ layout: false
2
+ --
3
+ Hello.
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ layout: false
2
+ lol: <a>
3
+ --
4
+ != partial :'menu'
5
+ %h2 Home page
6
+ = page.meta.lol
7
+ != page.meta.lol
@@ -0,0 +1,2 @@
1
+ Parent:
2
+ <a href='/index.html'>Back to parent</a>
@@ -0,0 +1,2 @@
1
+ Parent:
2
+ <a href='/about/index.html'>Back to parent</a>
@@ -0,0 +1 @@
1
+ <h1>Yo</h1>
@@ -0,0 +1,8 @@
1
+ hyde_requirement: 0.1
2
+ site_path: site
3
+ extensions_path: extensions
4
+ output_path: public
5
+ ignore:
6
+ - **/*~
7
+ - **/compass/**/*
8
+ - **/_*.scss
@@ -0,0 +1,3 @@
1
+ Parent:
2
+ - if parent
3
+ %a{:href => parent.path} Back to parent
@@ -0,0 +1,3 @@
1
+ Parent:
2
+ - if parent
3
+ %a{:href => parent.path} Back to parent
@@ -0,0 +1,3 @@
1
+ title: Hello there
2
+ --
3
+ %h1 Yo
@@ -0,0 +1,6 @@
1
+ <li>
2
+ <a href='/about/intrepid.html'>One, intrepid</a>
3
+ </li>
4
+ <li>
5
+ <a href='/about/hardy.html'>Two, hardy</a>
6
+ </li>
@@ -0,0 +1 @@
1
+ ...
@@ -0,0 +1,8 @@
1
+ hyde_requirement: 0.1
2
+ site_path: site
3
+ extensions_path: extensions
4
+ output_path: public
5
+ ignore:
6
+ - **/*~
7
+ - **/compass/**/*
8
+ - **/_*.scss
@@ -0,0 +1,3 @@
1
+ - children.each do |p|
2
+ %li
3
+ %a{:href => p.path}= p
@@ -0,0 +1,4 @@
1
+ position: 2
2
+ title: Two, hardy
3
+ --
4
+ ="..."
@@ -0,0 +1,4 @@
1
+ position: 1
2
+ title: One, intrepid
3
+ --
4
+ ="..."
@@ -0,0 +1 @@
1
+ <div id='post'><h1>hello-there</h1></div>
@@ -0,0 +1,12 @@
1
+ class Proton::Page::Post < Proton::Page
2
+ def css_class
3
+ title.downcase.gsub(' ', '-')
4
+ end
5
+
6
+ def default_layout
7
+ 'post' if html?
8
+ end
9
+
10
+ # Alias
11
+ ::Post = self
12
+ end
@@ -0,0 +1,9 @@
1
+ hyde_requirement: 0.1
2
+ site_path: site
3
+ extensions_path: extensions
4
+ output_path: public
5
+ layouts_path: layouts
6
+ ignore:
7
+ - **/*~
8
+ - **/compass/**/*
9
+ - **/_*.scss
@@ -0,0 +1 @@
1
+ Wrong!
@@ -0,0 +1 @@
1
+ #post!= yield
@@ -0,0 +1,4 @@
1
+ title: Hello there
2
+ type: post
3
+ --
4
+ %h1= page.css_class
data/test/helper.rb ADDED
@@ -0,0 +1,36 @@
1
+ $:.push File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'rubygems' if !Object.respond_to?(:gem)
4
+
5
+ gem "contest", "~> 0.1"
6
+
7
+ require 'proton'
8
+ require 'contest'
9
+
10
+ class TestCase < Test::Unit::TestCase
11
+ # Shorthand
12
+ Page = Proton::Page
13
+ Project = Proton::Project
14
+
15
+ def fixture(*a)
16
+ path = File.expand_path('../fixture', __FILE__)
17
+ File.join path, *a
18
+ end
19
+
20
+ def build(path)
21
+ @project = Proton::Project.new(path)
22
+ @project.pages.each { |p| p.write }
23
+ @project
24
+ end
25
+
26
+ def unbuild(project=@project)
27
+ FileUtils.rm_rf project.path(:output)
28
+ end
29
+ end
30
+
31
+ class Proton::Set
32
+ # Because 1.8.6 doesn't support map(&:path)
33
+ def paths
34
+ map { |page| page.path }
35
+ end
36
+ end
@@ -0,0 +1,18 @@
1
+
2
+ require File.expand_path('../../helper', __FILE__)
3
+
4
+ class BuildOptionsTest < TestCase
5
+ setup do
6
+ @path = fixture('build_options')
7
+ @project = Project.new(@path)
8
+ Dir.chdir @path
9
+ end
10
+
11
+ test "yada" do
12
+ raw = Page['/style.css'].to_html
13
+ built = Page['/style.css'].to_html({}, :build => true)
14
+
15
+ assert !built.include?("line 1")
16
+ assert raw.include?("line 1")
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path('../../helper', __FILE__)
2
+
3
+ class ExtensionsTest < TestCase
4
+ setup do
5
+ $extension_loaded = nil
6
+ @project = build fixture('extensions')
7
+ end
8
+
9
+ teardown do
10
+ unbuild @project
11
+ end
12
+
13
+ test "extensions" do
14
+ assert $extension_loaded == "aoeu"
15
+ assert $hi == 1
16
+ end
17
+ end