aerial 0.0.0
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.
- data/.gitignore +1 -0
- data/MIT-LICENSE +22 -0
- data/README.md +74 -0
- data/Rakefile +96 -0
- data/VERSION +1 -0
- data/config/config.yml +19 -0
- data/config/deploy.rb +50 -0
- data/lib/aerial.rb +100 -0
- data/lib/aerial/article.rb +241 -0
- data/lib/aerial/base.rb +172 -0
- data/lib/aerial/comment.rb +160 -0
- data/lib/aerial/config.rb +41 -0
- data/lib/aerial/content.rb +74 -0
- data/lib/aerial/vendor/akismetor.rb +52 -0
- data/lib/aerial/vendor/cache.rb +139 -0
- data/lib/features/article.feature +10 -0
- data/lib/features/home.feature +16 -0
- data/lib/features/step_definitions/article_steps.rb +4 -0
- data/lib/features/step_definitions/home_steps.rb +8 -0
- data/lib/features/support/env.rb +38 -0
- data/lib/features/support/pages/article.rb +9 -0
- data/lib/features/support/pages/homepage.rb +9 -0
- data/lib/spec/aerial_spec.rb +203 -0
- data/lib/spec/article_spec.rb +338 -0
- data/lib/spec/base_spec.rb +65 -0
- data/lib/spec/comment_spec.rb +216 -0
- data/lib/spec/config_spec.rb +25 -0
- data/lib/spec/fixtures/articles/sample-article/sample-article.article +6 -0
- data/lib/spec/fixtures/articles/test-article-one/test-article.article +7 -0
- data/lib/spec/fixtures/articles/test-article-three/test-article.article +7 -0
- data/lib/spec/fixtures/articles/test-article-two/comment-missing-fields.comment +8 -0
- data/lib/spec/fixtures/articles/test-article-two/test-article.article +7 -0
- data/lib/spec/fixtures/articles/test-article-two/test-comment.comment +10 -0
- data/lib/spec/fixtures/config.yml +35 -0
- data/lib/spec/fixtures/public/javascripts/application.js +109 -0
- data/lib/spec/fixtures/public/javascripts/jquery-1.3.1.min.js +19 -0
- data/lib/spec/fixtures/public/javascripts/jquery.template.js +255 -0
- data/lib/spec/fixtures/views/article.haml +19 -0
- data/lib/spec/fixtures/views/articles.haml +2 -0
- data/lib/spec/fixtures/views/comment.haml +8 -0
- data/lib/spec/fixtures/views/home.haml +2 -0
- data/lib/spec/fixtures/views/layout.haml +22 -0
- data/lib/spec/fixtures/views/post.haml +27 -0
- data/lib/spec/fixtures/views/rss.haml +15 -0
- data/lib/spec/fixtures/views/sidebar.haml +21 -0
- data/lib/spec/fixtures/views/style.sass +163 -0
- data/lib/spec/spec_helper.rb +117 -0
- metadata +101 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
- article = @article if @article
|
2
|
+
.article
|
3
|
+
%h2
|
4
|
+
%a{:href => article.permalink}
|
5
|
+
=article.title
|
6
|
+
%span
|
7
|
+
=article.comments.size
|
8
|
+
%h3
|
9
|
+
="Posted by #{article.author} on #{humanized_date article.published_at}"
|
10
|
+
%p.entry
|
11
|
+
=article.body_html
|
12
|
+
.meta
|
13
|
+
%span
|
14
|
+
Tags:
|
15
|
+
=link_to_tags article.tags
|
16
|
+
%br/
|
17
|
+
%span
|
18
|
+
Meta:
|
19
|
+
="#{article.comments.size} comments, <a href='#{article.permalink}' rel='permalink'>permalink</a>"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
!!! Strict
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title= page_title
|
5
|
+
%script{ 'type' => "text/javascript", :src => "/javascripts/jquery-1.3.1.min.js" }
|
6
|
+
%script{ 'type' => "text/javascript", :src => "/javascripts/jquery.template.js" }
|
7
|
+
%script{ 'type' => "text/javascript", :src => "/javascripts/application.js" }
|
8
|
+
%link{:href => '/style.css', :rel => 'stylesheet', :type => 'text/css'}
|
9
|
+
%link{:href => "http://#{hostname}/feed", :rel => 'alternate', :type => 'application/atom+xml', :title => "Feed for #{}" }
|
10
|
+
%body
|
11
|
+
#container
|
12
|
+
#header
|
13
|
+
#logo
|
14
|
+
%h1
|
15
|
+
%a{:href => '/'}= Aerial.config.title
|
16
|
+
%span
|
17
|
+
=Aerial.config.subtitle
|
18
|
+
#content= yield
|
19
|
+
#sidebar= partial :sidebar
|
20
|
+
#footer
|
21
|
+
%p#legal= "© #{Time.now.strftime('%Y')} #{Aerial.config.author}"
|
22
|
+
%p#powered= "powered by <a href='http://github.com/mattsears/aerial' title='Aerial'>Aerial</a>"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
=partial :article
|
2
|
+
%h5
|
3
|
+
Comments
|
4
|
+
#comments
|
5
|
+
=partial :comment, :collection => @article.comments
|
6
|
+
|
7
|
+
%div{:id => "new_comment"}
|
8
|
+
%form{:action => "/article/#{@article.id}/comments"}
|
9
|
+
%p
|
10
|
+
%input{:type => "text", :id => "comment_author"}
|
11
|
+
%label{:id => "author_label"}
|
12
|
+
Your name (required)
|
13
|
+
%p
|
14
|
+
%input{:type => "text", :id => "comment_email"}
|
15
|
+
%label{:id => "email_label"}
|
16
|
+
Your email address (required)
|
17
|
+
%p
|
18
|
+
%input{:type => "text", :id => "comment_homepage"}
|
19
|
+
%label{:id => "homepage_label"}
|
20
|
+
Website
|
21
|
+
%p
|
22
|
+
%label{:id => "comment_label"}
|
23
|
+
Please enter your comment
|
24
|
+
%textarea{:id => "comment_body"}
|
25
|
+
%p
|
26
|
+
%button{:type => "submit", :id => "comment_submit", :onclick => "Comment.submit('#{@article.id}'); return false;"}
|
27
|
+
Submit Comment (Thanks)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
!!! XML
|
2
|
+
%rss{"version" => "2.0"}
|
3
|
+
%channel
|
4
|
+
%title= "#{Aerial.config.title}"
|
5
|
+
%link= "http://#{hostname}"
|
6
|
+
%language= "en-us"
|
7
|
+
%ttl= "40"
|
8
|
+
%description= "#{Aerial.config.subtitle}"
|
9
|
+
- @articles.each do |article|
|
10
|
+
%item
|
11
|
+
%title= article.title
|
12
|
+
%link= full_hostname(article.permalink)
|
13
|
+
%description= article.body_html
|
14
|
+
%pubDate= article.published_at
|
15
|
+
%guid{"isPermaLink" => "false"}= article.id
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#about
|
2
|
+
%h2 About
|
3
|
+
%p
|
4
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
|
5
|
+
labore et dolore magna aliqua. Ut enimad minim veniam, quis nostrud exercitation ullamco
|
6
|
+
laboris nisi ut aliquip ex ea commodo consequat.
|
7
|
+
%h2 Recent Posts
|
8
|
+
%ul
|
9
|
+
-Aerial::Article.recent.each do |article|
|
10
|
+
%li
|
11
|
+
%a{:href => "#{article.permalink}"}=article.title
|
12
|
+
%h2 Categories
|
13
|
+
%ul
|
14
|
+
-Aerial::Article.tags.each do |tag|
|
15
|
+
%li
|
16
|
+
%a{:href => "/tags/#{tag}"}=tag
|
17
|
+
%h2 Archives
|
18
|
+
%ul
|
19
|
+
-Aerial::Article.archives.each do |archive|
|
20
|
+
%li
|
21
|
+
%a{:href => "/archives/#{archive[0][0]}"}="#{archive[0][1]} (#{archive[1]})"
|
@@ -0,0 +1,163 @@
|
|
1
|
+
!red = #f00
|
2
|
+
!black = #000
|
3
|
+
!darkgrey = #555
|
4
|
+
!lightgrey = #eeeeee
|
5
|
+
!blue = #2168a6
|
6
|
+
!red = #ed1e24
|
7
|
+
|
8
|
+
=image-replacement
|
9
|
+
:text-indent -9999px
|
10
|
+
:margin-bottom 0.3em
|
11
|
+
|
12
|
+
body
|
13
|
+
:color = !black
|
14
|
+
:font normal 12px Verdana, Arial, sans-serif
|
15
|
+
:font-size 88%
|
16
|
+
:line-height 1.5
|
17
|
+
a
|
18
|
+
:text-decoration none
|
19
|
+
:color = !darkgrey
|
20
|
+
&:visited
|
21
|
+
:color = !darkgrey
|
22
|
+
&:hover, &:visited
|
23
|
+
:text-decoration underline
|
24
|
+
h2
|
25
|
+
:font-size 100%
|
26
|
+
|
27
|
+
ul
|
28
|
+
:padding 0
|
29
|
+
li
|
30
|
+
:list-style none
|
31
|
+
:line-height 1.2
|
32
|
+
:margin 0 0 5px 0
|
33
|
+
a
|
34
|
+
:text-decoration underline
|
35
|
+
&:hover
|
36
|
+
:text-decoration none
|
37
|
+
form
|
38
|
+
:background = !lightgrey
|
39
|
+
:padding 10px
|
40
|
+
:border-top 1px solid #ddd
|
41
|
+
:font-size 100%
|
42
|
+
p
|
43
|
+
:margin 0 0 5px 0
|
44
|
+
label
|
45
|
+
:font-size 88%
|
46
|
+
label.error
|
47
|
+
:background-color = !red
|
48
|
+
:padding 2px
|
49
|
+
:color #fff
|
50
|
+
input
|
51
|
+
:border 1px solid
|
52
|
+
:padding 2px
|
53
|
+
:width 300px
|
54
|
+
:border-color = #ddd
|
55
|
+
:font-size 100%
|
56
|
+
textarea
|
57
|
+
:border 1px solid
|
58
|
+
:border-color = #ddd
|
59
|
+
:width 500px
|
60
|
+
:padding 3px
|
61
|
+
:height 75px
|
62
|
+
:font normal 14px Verdana, Arial, sans-serif
|
63
|
+
|
64
|
+
#header
|
65
|
+
:height 60px
|
66
|
+
:width 100%
|
67
|
+
:border-bottom 1px dashed
|
68
|
+
:border-color = !lightgrey
|
69
|
+
#logo
|
70
|
+
:float left
|
71
|
+
:height 50px
|
72
|
+
h1
|
73
|
+
:font 300% arial, sans-serif
|
74
|
+
:padding 5px 0
|
75
|
+
:margin 0
|
76
|
+
a
|
77
|
+
:color = !blue
|
78
|
+
:text-decoration none
|
79
|
+
span
|
80
|
+
:font-size 16pt
|
81
|
+
:color = !darkgrey
|
82
|
+
|
83
|
+
#container
|
84
|
+
:width 800px
|
85
|
+
:margin 0 auto
|
86
|
+
|
87
|
+
#content
|
88
|
+
:width 575px
|
89
|
+
:float left
|
90
|
+
:border-right 1px dashed
|
91
|
+
:border-color = !lightgrey
|
92
|
+
:padding 10px 10px 0 0
|
93
|
+
h5
|
94
|
+
:font-size 110%
|
95
|
+
:background-color #ffd
|
96
|
+
:margin 1.2em 0 0.3em
|
97
|
+
:padding 3px
|
98
|
+
:border-bottom 1px dotted #aaa
|
99
|
+
.article, .page
|
100
|
+
h2
|
101
|
+
:color = !darkgrey
|
102
|
+
:font-family arial, sans-serif
|
103
|
+
:font-weight normal
|
104
|
+
:letter-spacing -1px
|
105
|
+
:font-size 28px
|
106
|
+
:margin 0 0 -9px 0
|
107
|
+
a
|
108
|
+
:text-decoration none
|
109
|
+
span
|
110
|
+
:color = !lightgrey
|
111
|
+
h3
|
112
|
+
:color #777
|
113
|
+
:font-weight normal
|
114
|
+
:margin 0 0 0 2px
|
115
|
+
:padding 0
|
116
|
+
:font-size 110%
|
117
|
+
:letter-spacing -0.5px
|
118
|
+
.meta
|
119
|
+
:font-size 8pt
|
120
|
+
:background = !lightgrey
|
121
|
+
:padding 5px
|
122
|
+
:border 1px solid #ddd
|
123
|
+
:margin 15px 0
|
124
|
+
span
|
125
|
+
:color = !darkgrey !important
|
126
|
+
:font-weight bold
|
127
|
+
|
128
|
+
.comment
|
129
|
+
:margin 15px 0
|
130
|
+
:padding 10px
|
131
|
+
:border 3px solid
|
132
|
+
:border-color = !lightgrey
|
133
|
+
h2
|
134
|
+
span
|
135
|
+
:font-size 88%
|
136
|
+
:margin-left 5px
|
137
|
+
:color #777
|
138
|
+
|
139
|
+
#sidebar
|
140
|
+
:float right
|
141
|
+
:width 200px
|
142
|
+
:font-size 88%
|
143
|
+
p
|
144
|
+
:margin-top -7px
|
145
|
+
a
|
146
|
+
:color = !blue
|
147
|
+
|
148
|
+
#footer
|
149
|
+
:width 100%
|
150
|
+
:height 100px
|
151
|
+
:float left
|
152
|
+
:margin-top 20px
|
153
|
+
:border-top 1px dashed
|
154
|
+
:border-color = !lightgrey
|
155
|
+
p
|
156
|
+
:margin-top 5px
|
157
|
+
#legal
|
158
|
+
:width 40%
|
159
|
+
:float left
|
160
|
+
#powered
|
161
|
+
:width 50%
|
162
|
+
:float right
|
163
|
+
:text-align right
|
@@ -0,0 +1,117 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hpricot'
|
5
|
+
require 'sinatra'
|
6
|
+
require 'git'
|
7
|
+
require 'fileutils'
|
8
|
+
require 'grit'
|
9
|
+
require 'rack'
|
10
|
+
require 'spec'
|
11
|
+
require 'sinatra/test/rspec'
|
12
|
+
|
13
|
+
# Helper for matching html tags
|
14
|
+
module TagMatchers
|
15
|
+
|
16
|
+
class TagMatcher
|
17
|
+
|
18
|
+
def initialize (expected)
|
19
|
+
@expected = expected
|
20
|
+
@text = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def with_text (text)
|
24
|
+
@text = text
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
28
|
+
def matches? (target)
|
29
|
+
@target = target
|
30
|
+
doc = Hpricot(target)
|
31
|
+
@elem = doc.at(@expected)
|
32
|
+
@elem && (@text.nil? || @elem.inner_html == @text)
|
33
|
+
end
|
34
|
+
|
35
|
+
def failure_message
|
36
|
+
"Expected #{match_message}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def negative_failure_message
|
40
|
+
"Did not expect #{match_message}"
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
def match_message
|
46
|
+
if @elem
|
47
|
+
"#{@elem} to have text #{@text} but got #{@elem.inner_html}"
|
48
|
+
else
|
49
|
+
"#{@target.inspect} to contain element #{@expected.inspect}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def have_tag (expression)
|
55
|
+
TagMatcher.new(expression)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
# Helpers for creating a test Git repo
|
61
|
+
module GitHelper
|
62
|
+
|
63
|
+
def new_git_repo
|
64
|
+
delete_git_repo # delete the old repo first
|
65
|
+
|
66
|
+
path = File.expand_path( File.join(File.dirname(__FILE__), 'repo') )
|
67
|
+
data = File.expand_path( File.join(File.dirname(__FILE__), 'fixtures') )
|
68
|
+
Dir.mkdir(path)
|
69
|
+
Dir.chdir(path) do
|
70
|
+
git = Git.init
|
71
|
+
FileUtils.cp_r "#{data}/.", "#{path}/"
|
72
|
+
git.add
|
73
|
+
git.commit('Copied test articles from Fixtures directory so we can test against them')
|
74
|
+
end
|
75
|
+
return path
|
76
|
+
end
|
77
|
+
|
78
|
+
def delete_git_repo
|
79
|
+
repo = File.join(File.dirname(__FILE__), 'repo')
|
80
|
+
if File.directory? repo
|
81
|
+
FileUtils.rm_rf repo
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def new_file(name, contents)
|
86
|
+
File.open(name, 'w') do |f|
|
87
|
+
f.puts contents
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
include GitHelper
|
94
|
+
|
95
|
+
Spec::Runner.configure do |config|
|
96
|
+
repo_path = new_git_repo
|
97
|
+
CONFIG = YAML.load_file( File.join(File.dirname(__FILE__), 'fixtures', 'config.yml') ) unless defined?(CONFIG)
|
98
|
+
AERIAL_ROOT = File.join(File.dirname(__FILE__), 'repo') unless defined?(AERIAL_ROOT)
|
99
|
+
require File.expand_path(File.dirname(__FILE__) + "/../aerial")
|
100
|
+
config.include TagMatchers
|
101
|
+
config.include GitHelper
|
102
|
+
config.include Aerial
|
103
|
+
config.include Aerial::Helper
|
104
|
+
end
|
105
|
+
|
106
|
+
# set test environment
|
107
|
+
set :environment, :test
|
108
|
+
set :run, false
|
109
|
+
set :raise_errors, true
|
110
|
+
set :logging, false
|
111
|
+
|
112
|
+
include Aerial
|
113
|
+
|
114
|
+
def setup_repo
|
115
|
+
@repo_path = new_git_repo
|
116
|
+
Aerial.stub!(:repo).and_return(Grit::Repo.new(@repo_path))
|
117
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aerial
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Sears
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-15 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A simple, blogish software build with Sinatra, jQuery, and uses Git for data storage
|
17
|
+
email: matt@mattsears.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.md
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- MIT-LICENSE
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- VERSION
|
30
|
+
- config/config.yml
|
31
|
+
- config/deploy.rb
|
32
|
+
- lib/aerial.rb
|
33
|
+
- lib/aerial/article.rb
|
34
|
+
- lib/aerial/base.rb
|
35
|
+
- lib/aerial/comment.rb
|
36
|
+
- lib/aerial/config.rb
|
37
|
+
- lib/aerial/content.rb
|
38
|
+
- lib/aerial/vendor/akismetor.rb
|
39
|
+
- lib/aerial/vendor/cache.rb
|
40
|
+
- lib/features/article.feature
|
41
|
+
- lib/features/home.feature
|
42
|
+
- lib/features/step_definitions/article_steps.rb
|
43
|
+
- lib/features/step_definitions/home_steps.rb
|
44
|
+
- lib/features/support/env.rb
|
45
|
+
- lib/features/support/pages/article.rb
|
46
|
+
- lib/features/support/pages/homepage.rb
|
47
|
+
- lib/spec/aerial_spec.rb
|
48
|
+
- lib/spec/article_spec.rb
|
49
|
+
- lib/spec/base_spec.rb
|
50
|
+
- lib/spec/comment_spec.rb
|
51
|
+
- lib/spec/config_spec.rb
|
52
|
+
- lib/spec/fixtures/articles/sample-article/sample-article.article
|
53
|
+
- lib/spec/fixtures/articles/test-article-one/test-article.article
|
54
|
+
- lib/spec/fixtures/articles/test-article-three/test-article.article
|
55
|
+
- lib/spec/fixtures/articles/test-article-two/comment-missing-fields.comment
|
56
|
+
- lib/spec/fixtures/articles/test-article-two/test-article.article
|
57
|
+
- lib/spec/fixtures/articles/test-article-two/test-comment.comment
|
58
|
+
- lib/spec/fixtures/config.yml
|
59
|
+
- lib/spec/fixtures/public/javascripts/application.js
|
60
|
+
- lib/spec/fixtures/public/javascripts/jquery-1.3.1.min.js
|
61
|
+
- lib/spec/fixtures/public/javascripts/jquery.template.js
|
62
|
+
- lib/spec/fixtures/views/article.haml
|
63
|
+
- lib/spec/fixtures/views/articles.haml
|
64
|
+
- lib/spec/fixtures/views/comment.haml
|
65
|
+
- lib/spec/fixtures/views/home.haml
|
66
|
+
- lib/spec/fixtures/views/layout.haml
|
67
|
+
- lib/spec/fixtures/views/post.haml
|
68
|
+
- lib/spec/fixtures/views/rss.haml
|
69
|
+
- lib/spec/fixtures/views/sidebar.haml
|
70
|
+
- lib/spec/fixtures/views/style.sass
|
71
|
+
- lib/spec/spec_helper.rb
|
72
|
+
has_rdoc: true
|
73
|
+
homepage: http://github.com/mattsears/aerial
|
74
|
+
licenses: []
|
75
|
+
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options:
|
78
|
+
- --charset=UTF-8
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
version:
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 1.3.5
|
97
|
+
signing_key:
|
98
|
+
specification_version: 3
|
99
|
+
summary: A simple, blogish software build with Sinatra, jQuery, and uses Git for data storage
|
100
|
+
test_files: []
|
101
|
+
|