Class: Aerial::Build
- Includes:
- FileUtils, Thor::Actions
- Defined in:
- lib/aerial/build.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #build ⇒ Object
- #build_archives_html ⇒ Object
- #build_articles_html ⇒ Object
- #build_feed_xml ⇒ Object
- #build_pages_html ⇒ Object
- #build_style_css ⇒ Object
- #build_tags_html ⇒ Object
Instance Attribute Details
Instance Method Details
#build ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/aerial/build.rb', line 12 def build # TODO: Need a better way to find the root # @root = Pathname(File.dirname(__FILE__) + "/../../").expand_path @root = Pathname(File.dirname('.')). @site_path = "#{@root}/public/site" Aerial.new(@root, "/config/config.yml") Aerial::App.set :root, @root @articles = Aerial::Article.all @request = Rack::MockRequest.new(Aerial::App) build_style_css build_pages_html build_articles_html build_archives_html build_feed_xml end |
#build_archives_html ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/aerial/build.rb', line 67 def build_archives_html Aerial::Article.archives.each do |archive| create_file "#{@site_path}/archives/#{archive.first.first}.html" do @request.request('get', "/archives/#{archive.first.first}").body end end end |
#build_articles_html ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/aerial/build.rb', line 49 def build_articles_html @articles.each do |article| create_file "#{@site_path}/#{article.permalink}.html" do @request.request('get', "#{article.permalink}").body end end end |
#build_feed_xml ⇒ Object
76 77 78 79 80 |
# File 'lib/aerial/build.rb', line 76 def build_feed_xml create_file "#{@site_path}/feed.xml" do @request.request('get', "/feed.xml").body end end |
#build_pages_html ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/aerial/build.rb', line 37 def build_pages_html create_file "#{@site_path}/index.html" do @request.request('get', '/').body end create_file "#{@site_path}/articles.html" do @request.request('get', '/articles').body end end |
#build_style_css ⇒ Object
30 31 32 33 34 |
# File 'lib/aerial/build.rb', line 30 def build_style_css create_file "#{@site_path}/style.css" do @request.request('get', '/style.css').body end end |