ace 0.3.3 → 0.4

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/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ = Version 0.4
2
+ * Added project generator (ace-gen).
3
+
1
4
  = Version 0.3
2
5
  * Added LazyRendering mixin.
3
6
  * Added SassFilter.
@@ -20,6 +20,8 @@ rescue LoadError
20
20
  end
21
21
 
22
22
  templater = SimpleTemplater.new(:ace)
23
+ templater.discover!
24
+
23
25
  generator = templater.find(:project)
24
26
 
25
27
  if generator.nil?
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Ace
4
- VERSION = "0.3.3"
4
+ VERSION = "0.4"
5
5
  end
@@ -0,0 +1 @@
1
+ output
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ # Use local clones if possible.
4
+ # If you want to use your local copy, just symlink it to vendor.
5
+ extend Module.new {
6
+ def gem(name, options = Hash.new)
7
+ local_path = File.expand_path("../vendor/#{name}", __FILE__)
8
+ if File.exist?(local_path)
9
+ super name, options.merge(path: local_path).delete_if { |key, _| [:git, :branch].include?(key) }
10
+ else
11
+ super name, options
12
+ end
13
+ end
14
+ }
15
+
16
+ source "http://gemcutter.org"
17
+
18
+ gem "ace"
19
+ gem "nake"
20
+ gem "template-inheritance"
21
+
22
+ group(:development)
23
+ gem "rack"
24
+ end
@@ -0,0 +1,26 @@
1
+ Copyright (c) <%= Time.now.year %> <%= @user %>
2
+
3
+ All the logic can be used under the MIT license (see bellow).
4
+ The actual articles though shall not be used by other people
5
+ in any circumstances unless the author gives permission to do
6
+ otherwise. In such case the copyright information shall not
7
+ be omitted as well as a link to its original source.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining
10
+ a copy of this software and associated documentation files (the
11
+ "Software"), to deal in the Software without restriction, including
12
+ without limitation the rights to use, copy, modify, merge, publish,
13
+ distribute, sublicense, and/or sell copies of the Software, and to
14
+ permit persons to whom the Software is furnished to do so, subject to
15
+ the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be
18
+ included in all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,11 @@
1
+ h1. About
2
+
3
+ This is "<%= @name %>":<%= @url %>. It is written in "Ace":https://github.com/botanicus/ace, a powerful generator of static sites.
4
+
5
+ h1. Usage
6
+
7
+ _*NOTE:* You need Ruby 1.9.2 or later._
8
+
9
+ # Install all the dependencies via bundler: @bundle install@.
10
+ # Generate the output by running @./tasks.rb generate@.
11
+ # Run @./config.ru@ and view the content at "localhost:9292":http://localhost:9292/.
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bundle exec ace
2
+ # encoding: utf-8
3
+
4
+ Encoding.default_internal = "utf-8"
5
+ Encoding.default_external = "utf-8"
6
+
7
+ # Setup $LOAD_PATH.
8
+ require "bundler/setup"
9
+
10
+ # Custom setup.
11
+ require "pupu/adapters/ace"
12
+ Pupu.media_prefix = "/assets"
13
+
14
+ require "helpers"
15
+
16
+ # Load the app.
17
+ Dir["app/**/*.rb"].each do |file|
18
+ puts "~ Loading #{file}"
19
+ load file
20
+ end
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env rackup
2
+
3
+ # This is just for development. The only thing it does
4
+ # is serving of static files from the output/ directory.
5
+
6
+ use Rack::Head
7
+
8
+ class Server
9
+ def initialize(root)
10
+ @file_server = Rack::File.new(root)
11
+ end
12
+
13
+ def call(env)
14
+ path = env["PATH_INFO"]
15
+ returned = @file_server.call(env)
16
+ if returned[0] == 404 && env["PATH_INFO"].end_with?("/")
17
+ env["PATH_INFO"] = File.join(env["PATH_INFO"], "index.html")
18
+ returned = @file_server.call(env)
19
+ log "[404]", env["PATH_INFO"] if returned[0] == 404
20
+ returned
21
+ else
22
+ returned
23
+ end
24
+ end
25
+
26
+ private
27
+ def log(bold, message)
28
+ warn "~ \033[1;31m#{bold}\033[0m #{message}"
29
+ end
30
+ end
31
+
32
+ run Server.new("output")
@@ -0,0 +1,2 @@
1
+ title: ""
2
+ base_url: "<% @url %>"
@@ -0,0 +1,7 @@
1
+ - extends "base.html"
2
+
3
+ - block(:description, "Hello world page, nothing fancy.")
4
+ - block(:keywords, "hello world, ace, whatever else")
5
+
6
+ = block(:body) do
7
+ %h1 Hello World!
@@ -0,0 +1,3 @@
1
+ User-agent: *
2
+ Disallow: /assets
3
+ Allow: /
@@ -0,0 +1,13 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %title= block(:title, "<%= @name %>")
5
+ %meta{"http-equiv" => "content-type", content: "text/html; charset=utf-8"}
6
+ %meta{"http-equiv" => "content-language", content: "en"}
7
+ %meta{name: "description", content: block(:description, "")}
8
+ %meta{name: "keywords", content: block(:keywords, "")}
9
+ = block(:head)
10
+ %body
11
+ = block(:body)
12
+ #footer
13
+ &copy; <%= Time.now.year %> &ndash; #{Time.now.year} <%= @user %> | Powered by <a href="https://github.com/botanicus/ace">Ace</a>.
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ require "ace/static"
4
+
5
+ rule Ace::Static, "index.html.haml"
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env bundle exec nake
2
+ # encoding: utf-8
3
+
4
+ Encoding.default_internal = "utf-8"
5
+ Encoding.default_external = "utf-8"
6
+
7
+ # Task.tasks.default_proc = lambda { |*| Task[:generate] }
8
+
9
+ Task.new(:generate) do |task|
10
+ task.description = "Generate static HTML."
11
+
12
+ task.define do
13
+ sh "./boot.rb"
14
+ end
15
+ end
16
+
17
+ Task.new(:rsync) do |task|
18
+ task.description = "Rsync the output to server."
19
+
20
+ # config
21
+ task.config[:user] = "TODO"
22
+ task.config[:server] = "TODO"
23
+ task.config[:path] = "TODO"
24
+
25
+ task.define do |options|
26
+ sh "rsync -av --delete output/ #{config[:user]}@#{config[:server]}:#{config[:path]}"
27
+ end
28
+ end
@@ -4,6 +4,10 @@
4
4
  # You can update context hash and register hooks. Don't forget to use merge! instead of merge, because you are
5
5
  # manipulating with one object, rather than returning new one.
6
6
 
7
+ # ace-gen project --user="Jakub Stastny" --name=101Ideas.cz --url=http://101ideas.cz
8
+
7
9
  hook do |generator, context|
8
- # TODO
10
+ context[:user] ||= ENV["USER"]
11
+ context[:name] || raise("You have to specify at least --title=WebTitle")
12
+ context[:url] ||= "http://#{context[:name]}"
9
13
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: ace
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.3
5
+ version: "0.4"
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
- date: 2011-06-05 00:00:00 +02:00
12
+ date: 2011-06-12 00:00:00 +02:00
13
13
  default_executable: ace
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -97,6 +97,22 @@ files:
97
97
  - lib/ace/mixins/lazy.rb
98
98
  - lib/ace/static.rb
99
99
  - lib/ace/version.rb
100
+ - project_generator/content/.gitignore
101
+ - project_generator/content/Gemfile
102
+ - project_generator/content/LICENSE.rbt
103
+ - project_generator/content/README.textile.rbt
104
+ - project_generator/content/app/.gitignore
105
+ - project_generator/content/boot.rb
106
+ - project_generator/content/config.ru
107
+ - project_generator/content/config.yml.rbt
108
+ - project_generator/content/content/assets/css/.gitignore
109
+ - project_generator/content/content/assets/img/.gitignore
110
+ - project_generator/content/content/assets/js/.gitignore
111
+ - project_generator/content/content/index.html.haml
112
+ - project_generator/content/content/robots.txt
113
+ - project_generator/content/layouts/base.html.haml.rbt
114
+ - project_generator/content/rules.rb
115
+ - project_generator/content/tasks.rb
100
116
  - project_generator/metadata.yml
101
117
  - project_generator/postprocess.rb
102
118
  - project_generator/setup.rb
@@ -105,10 +121,7 @@ has_rdoc: true
105
121
  homepage: http://github.com/botanicus/ace
106
122
  licenses: []
107
123
 
108
- post_install_message: "[\e[32mVersion 0.3\e[0m] Added LazyRendering mixin.\n\
109
- [\e[32mVersion 0.3\e[0m] Added SassFilter.\n\
110
- [\e[32mVersion 0.3\e[0m] Added PygmentsFilter for syntax highlighting.\n\
111
- [\e[32mVersion 0.3\e[0m] Added Static class for copying static files.\n"
124
+ post_install_message:
112
125
  rdoc_options: []
113
126
 
114
127
  require_paths:
@@ -128,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
141
  requirements: []
129
142
 
130
143
  rubyforge_project: ace
131
- rubygems_version: 1.5.3
144
+ rubygems_version: 1.6.2
132
145
  signing_key:
133
146
  specification_version: 3
134
147
  summary: Ace is highly flexible static pages generator with template inheritance.