aerial 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ spec/repo
2
2
  coverage
3
3
  content
4
4
  pkg
5
+ tmp/
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{aerial}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Sears"]
@@ -52,10 +52,10 @@ Gem::Specification.new do |s|
52
52
  "features/support/env.rb",
53
53
  "features/support/pages/article.rb",
54
54
  "features/support/pages/homepage.rb",
55
- "index.html",
56
55
  "lib/aerial.rb",
57
56
  "lib/aerial/app.rb",
58
57
  "lib/aerial/article.rb",
58
+ "lib/aerial/build.rb",
59
59
  "lib/aerial/base.rb",
60
60
  "lib/aerial/comment.rb",
61
61
  "lib/aerial/config.rb",
data/bin/aerial CHANGED
@@ -2,4 +2,6 @@
2
2
  $LOAD_PATH << File.join(File.dirname(__FILE__), '..')
3
3
  require 'rubygems'
4
4
  require File.dirname(__FILE__) + "/../lib/aerial/installer"
5
- Aerial::Installer.start
5
+ require File.dirname(__FILE__) + "/../lib/aerial/build"
6
+ #Aerial::Installer.start
7
+ Aerial::Build.start
@@ -24,7 +24,7 @@ module Aerial
24
24
 
25
25
  # Make sure git is added to the env path
26
26
  ENV['PATH'] = "#{ENV['PATH']}:/usr/local/bin"
27
- VERSION = '0.1.1'
27
+ VERSION = '0.1.2'
28
28
 
29
29
  class << self
30
30
  attr_accessor :debug, :logger, :repo, :config
@@ -34,14 +34,19 @@ module Aerial
34
34
  @root ||= root
35
35
  @logger ||= ::Logger.new(STDOUT)
36
36
  @debug ||= false
37
- @repo ||= Grit::Repo.new(@root)
38
- config = File.join(root, config_name)
39
37
 
40
- if config.is_a?(String) && File.file?(config)
41
- @config = Aerial::Config.new(YAML.load_file(config))
42
- elsif config.is_a?(Hash)
43
- @config = Aerial::Config.new(config)
38
+ begin
39
+ @repo ||= Grit::Repo.new(@root)
40
+ config = File.join(root, config_name)
41
+ if config.is_a?(String) && File.file?(config)
42
+ @config = Aerial::Config.new(YAML.load_file(config))
43
+ elsif config.is_a?(Hash)
44
+ @config = Aerial::Config.new(config)
45
+ end
46
+ rescue Exception => e
47
+ # TODO: Display an error
44
48
  end
49
+
45
50
  end
46
51
 
47
52
  def self.log(str)
@@ -73,7 +73,6 @@ module Aerial
73
73
  post '/article/:id/comments' do
74
74
  @article = Aerial::Article.find(params[:id])
75
75
  throw :halt, [404, not_found ] unless @article
76
-
77
76
  comment = Aerial::Comment.new(params.merge!({:referrer => request.referrer,
78
77
  :user_agent => request.user_agent,
79
78
  :ip => request.ip
@@ -0,0 +1,82 @@
1
+ require "thor"
2
+ require File.dirname(__FILE__) + "/../aerial"
3
+
4
+ module Aerial
5
+
6
+ class Build < Thor
7
+ attr_reader :root
8
+ include FileUtils
9
+ include Thor::Actions
10
+
11
+ desc "build", "Build alls static files."
12
+ def build
13
+ # TODO: Need a better way to find the root
14
+ # @root = Pathname(File.dirname(__FILE__) + "/../../").expand_path
15
+ @root = Pathname(File.dirname('.')).expand_path
16
+ @site_path = "#{@root}/public/site"
17
+ Aerial.new(@root, "/config/config.yml")
18
+ Aerial::App.set :root, @root
19
+ @articles = Aerial::Article.all
20
+ @request = Rack::MockRequest.new(Aerial::App)
21
+ build_style_css
22
+ build_pages_html
23
+ build_articles_html
24
+ build_tags_html
25
+ build_archives_html
26
+ build_feed_xml
27
+ end
28
+
29
+ desc "build_style_css", "Build all css files."
30
+ def build_style_css
31
+ create_file "#{@site_path}/style.css" do
32
+ @request.request('get', '/style.css').body
33
+ end
34
+ end
35
+
36
+ desc "build_html", "Build all html files."
37
+ def build_pages_html
38
+
39
+ create_file "#{@site_path}/index.html" do
40
+ @request.request('get', '/').body
41
+ end
42
+
43
+ create_file "#{@site_path}/articles.html" do
44
+ @request.request('get', '/articles').body
45
+ end
46
+ end
47
+
48
+ desc "build_articles_html", "Build all the single article pages."
49
+ def build_articles_html
50
+ @articles.each do |article|
51
+ create_file "#{@site_path}/#{article.permalink}.html" do
52
+ @request.request('get', "#{article.permalink}").body
53
+ end
54
+ end
55
+ end
56
+
57
+ desc "build_tags_html", "Build all the tag pages"
58
+ def build_tags_html
59
+ Aerial::Article.tags.each do |tag|
60
+ create_file "#{@site_path}/tags/#{tag}.html" do
61
+ @request.request('get', "/tags/#{tag}").body
62
+ end
63
+ end
64
+ end
65
+
66
+ desc "build_archives_html", "Build all the archive pages"
67
+ def build_archives_html
68
+ Aerial::Article.archives.each do |archive|
69
+ create_file "#{@site_path}/archives/#{archive.first.first}.html" do
70
+ @request.request('get', "/archives/#{archive.first.first}").body
71
+ end
72
+ end
73
+ end
74
+
75
+ desc "build_feed_xml", "Build the feed rss xml"
76
+ def build_feed_xml
77
+ create_file "#{@site_path}/feed.xml" do
78
+ @request.request('get', "/feed.xml").body
79
+ end
80
+ end
81
+ end
82
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt Sears
@@ -61,10 +61,10 @@ files:
61
61
  - features/support/env.rb
62
62
  - features/support/pages/article.rb
63
63
  - features/support/pages/homepage.rb
64
- - index.html
65
64
  - lib/aerial.rb
66
65
  - lib/aerial/app.rb
67
66
  - lib/aerial/article.rb
67
+ - lib/aerial/build.rb
68
68
  - lib/aerial/base.rb
69
69
  - lib/aerial/comment.rb
70
70
  - lib/aerial/config.rb
data/index.html DELETED
@@ -1,164 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7
- <title>aerial</title>
8
- <style type="text/css">
9
- /* reset */
10
- html, body, div, span, applet, object, iframe,
11
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
12
- a, abbr, acronym, address, big, cite, code,
13
- del, dfn, em, font, img, ins, kbd, q, s, samp,
14
- small, strike, strong, sub, sup, tt, var,
15
- dl, dt, dd, ul, li,
16
- form, label, legend,
17
- table, caption, tbody, tfoot, thead, tr, th, td {
18
- margin: 0;
19
- padding: 0;
20
- border: 0;
21
- outline: 0;
22
- font-weight: inherit;
23
- font-style: normal;
24
- font-size: 100%;
25
- font-family: inherit;
26
- vertical-align: baseline;
27
- }
28
- :focus {
29
- outline: 0;
30
- }
31
- body {
32
- line-height: 1;
33
- color: black;
34
- background: white;
35
- }
36
- ul {
37
- list-style: none;
38
- }
39
- table {
40
- border-collapse: collapse;
41
- border-spacing: 0;
42
- }
43
- caption, th, td {
44
- text-align: left;
45
- font-weight: normal;
46
- }
47
- blockquote:before, blockquote:after,
48
- q:before, q:after {
49
- content: "";
50
- }
51
- blockquote, q {
52
- quotes: "" "";
53
- }
54
-
55
- /* styles */
56
- body {
57
- font-family: Verdana,Arial,sans-serif;
58
- background: #f0f0f0;
59
- color: #333;
60
- }
61
- #inset {
62
- margin: 0 auto;
63
- width: 860px;
64
- }
65
- #container {
66
- background-color: #fff;
67
- color: #000;
68
- padding: 50px 100px;
69
- }
70
- p, h2 {
71
- margin: 20px 0;
72
- }
73
- p {
74
- line-height: 20px;
75
- }
76
- a {
77
- color: #000;
78
- text-decoration: none;
79
- font-weight: bold;
80
- }
81
- a:hover {
82
- color: #26B3CF;
83
- }
84
- h1 {
85
- /* Hide generated title */
86
- display: none;
87
- }
88
- h1.title {
89
- display: block;
90
- font-size: 3.8em;
91
- margin-bottom: 3px;
92
- }
93
- h1.title .small {
94
- font-size: 0.4em;
95
- }
96
- h1 a {
97
- font-weight: normal;
98
- }
99
- h2 {
100
- font-size: 1.5em;
101
- }
102
- li {
103
- padding-bottom: 10px;
104
- }
105
- .ribbon {
106
- float: right;
107
- }
108
- .description {
109
- font-size: 1.2em;
110
- margin-bottom: 30px;
111
- margin-top: 30px;
112
- font-style: italic;
113
- }
114
- pre {
115
- background: #444;
116
- color: #fff;
117
- font-family:'Bitstream Vera Sans Mono','Courier',monospace;
118
- padding: 15px;
119
- -moz-border-radius: 5px;
120
- -webkit-border-radius: 5px;
121
- }
122
- </style>
123
- </head>
124
- <body>
125
- <div id="inset">
126
- <a href="http://github.com/mattsears/aerial">
127
- <img class="ribbon" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" />
128
- </a>
129
- <div id="container">
130
- <div class="description">
131
- Aerial uses Git to store articles and pages.
132
- </div>
133
- <h1>Aerial</h1>
134
- <p>Designed for Ruby developers, there is no admin interface and no SQL database. Articles are written in your favorite text editor and versioned with Git. Comments are also stored as plain-text files and pushed to the remote repository when created. It uses Grit (http://github.com/mojombo/grit) to interface with local and remote Git repositories.</p>
135
- <h2>Installation</h2>
136
-
137
- <p>via Rubygems:</p>
138
- <pre><code>$ gem install aerial
139
- $ aerial install /home/user/myblog</code></pre>
140
- <p>This will create a couple files and directories. Mainly, the views, public, and configuration files. You may edit config.yml to your liking</p>
141
- <p>The installer provides special configuration files for Thin and Passenger.</p>
142
- <p>via Clone:</p>
143
- <pre><code>$ git clone git://github.com/mattsears/aerial</code></pre>
144
-
145
- <h2>Pasenger</h2>
146
- <pre><code>$ aerial install /home/user/myblog --passenger
147
- $ cd /home/user/myblog</code></pre>
148
- <p>Then, restart Passenger <b>$ touch tmp/restart.txt</b></p>
149
- <h2>Thin</h2>
150
- <p>Install Thin:</p>
151
- <pre><code>$ gem install thin</code></pre>
152
- <p>Run the installer:</p>
153
- <pre><code>$ aerial install /home/user/myblog --thin
154
- $ cd /home/user/myblog</code></pre>
155
- <p>Tweak the thin.yml</p>
156
- <p>Start the thin server</p>
157
- <pre><code>$ thin -C thin.yml -R config.ru start</code></pre>
158
- <h2>Issues</h2>
159
- <p>Find a bug? Want a feature? Submit an <a href="http://github.com/mattsears/aerial/issues">issue here</a>. Patches welcome!
160
- </p
161
- </div>
162
- </div>
163
- </body>
164
- </html>