mango 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -2
- data/.rvmrc +1 -0
- data/.yardopts +1 -3
- data/{CHANGES.mdown → CHANGES.md} +40 -0
- data/Gemfile.lock +35 -23
- data/LICENSE +1 -1
- data/{README.mdown → README.md} +38 -27
- data/Rakefile +0 -13
- data/lib/mango.rb +5 -0
- data/lib/mango/application.rb +361 -129
- data/lib/mango/content_page.rb +89 -115
- data/lib/mango/core_ext/string.rb +16 -0
- data/lib/mango/core_ext/uri.rb +14 -0
- data/lib/mango/dependencies.rb +5 -4
- data/lib/mango/flavored_markdown.rb +7 -0
- data/lib/mango/rack/debugger.rb +20 -0
- data/lib/mango/runner.rb +33 -50
- data/lib/mango/templates/.gitignore +0 -1
- data/lib/mango/templates/Gemfile +1 -1
- data/lib/mango/templates/content/index.erb +6 -0
- data/lib/mango/templates/themes/default/javascripts/timer.coffee +6 -0
- data/lib/mango/templates/themes/default/public/javascripts/fireworks.js +0 -0
- data/lib/mango/templates/themes/default/public/{styles → stylesheets}/fireworks.css +0 -0
- data/lib/mango/templates/themes/default/public/{styles → stylesheets}/reset.css +0 -2
- data/lib/mango/templates/themes/default/{styles → stylesheets}/screen.sass +0 -2
- data/lib/mango/templates/themes/default/views/layout.haml +5 -5
- data/lib/mango/templates/themes/default/views/page.haml +1 -3
- data/lib/mango/version.rb +1 -1
- data/mango.gemspec +12 -10
- data/spec/fixture/content/engines/erb.erb +7 -0
- data/spec/fixture/content/engines/haml.haml +4 -4
- data/spec/fixture/content/engines/liquid.liquid +7 -0
- data/spec/fixture/content/engines/markdown.markdown +0 -6
- data/spec/fixture/content/engines/md.md +0 -6
- data/spec/fixture/content/engines/mkd.mkd +1 -0
- data/spec/fixture/content/page_with_missing_view.haml +2 -2
- data/spec/fixture/content/page_with_unregistered_view.haml +4 -0
- data/spec/fixture/content/view_engines/erb.haml +4 -0
- data/spec/fixture/content/view_engines/liquid.haml +4 -0
- data/spec/fixture/themes/default/javascripts/override.coffee +1 -0
- data/spec/fixture/themes/default/javascripts/siblings.coffee +7 -0
- data/spec/fixture/themes/default/javascripts/songs/happy.coffee +5 -0
- data/spec/fixture/themes/default/public/404.html +11 -0
- data/spec/fixture/themes/default/public/javascripts/econ.js +8 -0
- data/spec/fixture/themes/default/public/javascripts/math/opposite.js +6 -0
- data/spec/fixture/themes/default/public/javascripts/override.js +1 -0
- data/spec/fixture/themes/default/public/root.js +5 -0
- data/spec/fixture/themes/default/public/{styles → stylesheets}/override.css +0 -0
- data/spec/fixture/themes/default/public/{styles → stylesheets}/reset.css +0 -0
- data/spec/fixture/themes/default/public/{styles → stylesheets}/subfolder/another.css +0 -0
- data/spec/fixture/themes/default/security_hole.js +1 -0
- data/spec/fixture/themes/default/{styles → stylesheets}/override.sass +0 -0
- data/spec/fixture/themes/default/{styles/screen.sass → stylesheets/sass.sass} +4 -2
- data/spec/fixture/themes/default/stylesheets/scss.scss +19 -0
- data/spec/fixture/themes/default/{styles → stylesheets}/subfolder/screen.sass +0 -2
- data/spec/fixture/themes/default/views/404.erb +11 -0
- data/spec/fixture/themes/default/views/404.haml +1 -0
- data/spec/fixture/themes/default/views/404.liquid +11 -0
- data/spec/fixture/themes/default/views/layout.erb +10 -0
- data/spec/fixture/themes/default/views/layout.haml +1 -1
- data/spec/fixture/themes/default/views/layout.liquid +10 -0
- data/spec/fixture/themes/default/views/page.erb +7 -0
- data/spec/fixture/themes/default/views/page.haml +3 -1
- data/spec/fixture/themes/default/views/page.liquid +7 -0
- data/spec/lib/application/routing_content_pages_spec.rb +298 -21
- data/spec/lib/application/routing_javascript_templates_spec.rb +278 -0
- data/spec/lib/application/routing_not_found_spec.rb +254 -0
- data/spec/lib/application/routing_public_files_spec.rb +9 -8
- data/spec/lib/application/{routing_style_sheets_spec.rb → routing_stylesheet_templates_spec.rb} +61 -24
- data/spec/lib/application_spec.rb +31 -2
- data/spec/lib/content_page/initializing_spec.rb +399 -126
- data/spec/lib/content_page_spec.rb +23 -19
- data/spec/lib/core_ext/string_spec.rb +12 -0
- data/spec/lib/core_ext/uri_spec.rb +42 -0
- data/spec/lib/dependencies_spec.rb +0 -1
- data/spec/lib/flavored_markdown_spec.rb +18 -3
- data/spec/lib/runner_spec.rb +40 -39
- data/spec/lib/version_spec.rb +4 -4
- metadata +145 -64
- data/lib/mango/templates/content/index.md +0 -5
- data/lib/mango/templates/themes/default/public/javascripts/timer.js +0 -5
- data/spec/fixture/content/engines/mdown.mdown +0 -7
- data/spec/lib/content_page/finding_spec.rb +0 -213
data/lib/mango/content_page.rb
CHANGED
@@ -1,18 +1,15 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "haml"
|
3
|
+
require "english"
|
5
4
|
require "yaml"
|
6
5
|
|
7
6
|
module Mango
|
8
7
|
# `ContentPage` is a **model** class. An instance of `ContentPage` is the representation of a
|
9
8
|
# single content file. The primary responsiblity of `ContentPage` is to manage the conversion of
|
10
|
-
# user-generated data into HTML. It accomplishes this task by utilizing
|
11
|
-
# engines
|
12
|
-
# valid HTML.
|
9
|
+
# user-generated data into markup like HTML. It accomplishes this task by utilizing a variety of
|
10
|
+
# content engines.
|
13
11
|
#
|
14
|
-
# `ContentPage`
|
15
|
-
# Each component is defined within a single content file.
|
12
|
+
# A `ContentPage` file contains **a body** and possibly **a header**.
|
16
13
|
#
|
17
14
|
# ### Example content file
|
18
15
|
#
|
@@ -31,163 +28,140 @@ module Mango
|
|
31
28
|
# Mangos aside, let's bring attention to a few important facets of this example and content files
|
32
29
|
# in general.
|
33
30
|
#
|
34
|
-
# 1.
|
35
|
-
# 2.
|
36
|
-
# 3. The body comes second, nestled comfortably below the
|
37
|
-
# 4.
|
38
|
-
# 5. The
|
39
|
-
# as Markdown.
|
31
|
+
# 1. A content page is stored as file on disk. Here, the file name is `mango_poem.markdown`.
|
32
|
+
# 2. The header is defined first, embedded within triple-dashed ("---") dividers.
|
33
|
+
# 3. The body comes second, nestled comfortably below the header.
|
34
|
+
# 4. The header is composed of key-value attribute pairs in [YAML](http://www.yaml.org/) format.
|
35
|
+
# 5. The file's extension signals that the body should treated as Markdown.
|
40
36
|
#
|
41
|
-
# ### The
|
42
|
-
#
|
43
|
-
# The body of a content file may be written using one of the following human-friendly formats:
|
44
|
-
#
|
45
|
-
# * [Markdown](http://daringfireball.net/projects/markdown/syntax) extended with
|
46
|
-
# `Mango::FlavoredMarkdown`
|
47
|
-
# * [Haml](http://haml-lang.com/)
|
48
|
-
#
|
49
|
-
# The content file's extension determines the body's formatting. For a complete list of content
|
50
|
-
# file formats and their extensions, see `Mango::ContentPage::CONTENT_ENGINES`
|
37
|
+
# ### The Header
|
51
38
|
#
|
52
|
-
#
|
53
|
-
# Once in that scope, the instance can convert its body to HTML with the `#to_html` method:
|
39
|
+
# The header is composed of key-value attribute pairs in [YAML](http://www.yaml.org/) format.
|
54
40
|
#
|
55
|
-
#
|
41
|
+
# Each `ContentPage` instance is passed into their body and view templates as the `page` local
|
42
|
+
# variable. For example, this is how to access the header attributes of a content page inside an
|
43
|
+
# ERB template:
|
56
44
|
#
|
57
|
-
#
|
45
|
+
# <h1><%= page.title %></h1>
|
58
46
|
#
|
59
|
-
#
|
47
|
+
# ### The Body
|
60
48
|
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# the
|
49
|
+
# The body of a content file can be written in many human and designer friendly formats. It's the
|
50
|
+
# content file's extension that determines the format, and therefore, the template engine used to
|
51
|
+
# convert the body into markup like HTML. For a list of supported content page template engines,
|
52
|
+
# and their formats, see `Mango::ContentPage::TEMPLATE_ENGINES`.
|
64
53
|
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
54
|
+
# Each `ContentPage` instance is passed into their body and view templates as the `page` local
|
55
|
+
# variable. For example, this is how to access the raw data, unrendered body, and rendered
|
56
|
+
# content of a content page inside an ERB template:
|
68
57
|
#
|
69
|
-
#
|
58
|
+
# <p><%= page.data %></p>
|
59
|
+
# <p><%= page.body %></p>
|
60
|
+
# <p><%= page.content %></p>
|
70
61
|
#
|
71
|
-
#
|
62
|
+
# ### The View Attribute and Template
|
72
63
|
#
|
73
|
-
#
|
64
|
+
# Each `ContentPage` instance has a `view` attribute, even if one is not explicitly declared in
|
65
|
+
# the content file. This attribute is essential as it guides the `Mango::Application` to render
|
66
|
+
# the correct view template file. The default view template file name is defined by
|
67
|
+
# `Mango::ContentPage::DEFAULT_ATTRIBUTES`.
|
74
68
|
#
|
75
|
-
#
|
69
|
+
# When declaring an explicit view template, the relative file name is required. For example,
|
70
|
+
# given the following content page:
|
76
71
|
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
72
|
+
# ---
|
73
|
+
# view: blog.haml
|
74
|
+
# ---
|
80
75
|
#
|
81
|
-
#
|
82
|
-
#
|
76
|
+
# The `Mango::Application` will attempt to render the content page within the `blog.haml` view
|
77
|
+
# template if it exists in the `Mango::Application.settings.views` directory. The supported view
|
78
|
+
# template engines are defined by `Mango::Application::VIEW_TEMPLATE_ENGINES`.
|
83
79
|
#
|
84
|
-
# @see
|
80
|
+
# @see FlavoredMarkdown
|
81
|
+
# @see Application::VIEW_TEMPLATE_ENGINES
|
85
82
|
#
|
86
83
|
class ContentPage
|
87
|
-
|
84
|
+
# @see http://goo.gl/z2Zzk
|
85
|
+
class InvalidHeaderError < RuntimeError; end
|
88
86
|
|
89
|
-
#
|
90
|
-
|
91
|
-
|
92
|
-
|
87
|
+
# Supported content page template engines
|
88
|
+
TEMPLATE_ENGINES = {
|
89
|
+
Tilt::BlueClothTemplate => :markdown,
|
90
|
+
Tilt::HamlTemplate => :haml,
|
91
|
+
Tilt::ERBTemplate => :erb,
|
92
|
+
Tilt::LiquidTemplate => :liquid
|
93
93
|
}
|
94
94
|
|
95
|
-
# Default
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
:content_engine => :markdown
|
95
|
+
# Default key-value attribute pairs
|
96
|
+
DEFAULT_ATTRIBUTES = {
|
97
|
+
"engine" => TEMPLATE_ENGINES.key(:markdown),
|
98
|
+
"view" => "page.haml"
|
100
99
|
}
|
101
100
|
|
102
|
-
#
|
103
|
-
|
104
|
-
# `Hash`
|
101
|
+
# Contains the engine, data, body, content, view, and any header key-value pairs
|
102
|
+
# @return [Hash]
|
105
103
|
attr_reader :attributes
|
106
|
-
|
107
|
-
attr_reader :body
|
108
|
-
# `Symbol`
|
109
|
-
attr_reader :content_engine
|
104
|
+
alias :to_liquid :attributes
|
110
105
|
|
111
106
|
# Creates a new instance by extracting the body and attributes from raw data. Any extracted
|
112
107
|
# components found are merged with their defaults.
|
113
108
|
#
|
114
|
-
# @param [String] data
|
115
109
|
# @param [Hash] options
|
116
|
-
# @option options [
|
110
|
+
# @option options [String] :data Contains a body and possibly a YAML header
|
111
|
+
# @option options [Symbol] :engine See `TEMPLATE_ENGINES` and `DEFAULT_ATTRIBUTES["engine"]`
|
112
|
+
# @raise [ArgumentError] Raised when registered content engine cannot be found
|
113
|
+
# @raise [InvalidHeaderError] Raised when YAML header is invalid
|
117
114
|
#
|
118
|
-
def initialize(
|
119
|
-
|
120
|
-
|
115
|
+
def initialize(options = {})
|
116
|
+
data = options[:data] || ""
|
117
|
+
engine = options[:engine] || DEFAULT_ATTRIBUTES["engine"]
|
121
118
|
|
122
|
-
|
123
|
-
|
124
|
-
@body = self.data[($1.size + $2.size)..-1]
|
125
|
-
else
|
126
|
-
@attributes = DEFAULT[:attributes]
|
127
|
-
@body = self.data || DEFAULT[:body]
|
119
|
+
unless TEMPLATE_ENGINES.include?(engine)
|
120
|
+
raise ArgumentError, "Cannot find registered content engine -- #{engine}"
|
128
121
|
end
|
129
|
-
end
|
130
122
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
def self.find_by_path(path_without_extension)
|
139
|
-
CONTENT_ENGINES.each_pair do |content_engine, extensions|
|
140
|
-
extensions.each do |extension|
|
141
|
-
path = "#{path_without_extension}.#{extension}"
|
142
|
-
return new(File.read(path), :content_engine => content_engine) if File.exist?(path)
|
123
|
+
@attributes = DEFAULT_ATTRIBUTES.dup
|
124
|
+
|
125
|
+
@attributes["body"] = if data =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
126
|
+
begin
|
127
|
+
header = YAML.load($1) || {}
|
128
|
+
rescue Exception => e
|
129
|
+
raise InvalidHeaderError, e.message
|
143
130
|
end
|
144
|
-
end
|
145
131
|
|
146
|
-
|
147
|
-
|
132
|
+
begin
|
133
|
+
@attributes.merge!(header)
|
134
|
+
rescue
|
135
|
+
raise InvalidHeaderError, "Cannot parse header -- #{header.inspect}"
|
136
|
+
end
|
148
137
|
|
149
|
-
|
150
|
-
#
|
151
|
-
# @raise [RuntimeError] Raised when content engine is unknown
|
152
|
-
# @return [String] HTML from the conversion
|
153
|
-
#
|
154
|
-
def to_html
|
155
|
-
case content_engine
|
156
|
-
when :markdown
|
157
|
-
BlueCloth.new(Mango::FlavoredMarkdown.shake(body)).to_html
|
158
|
-
when :haml
|
159
|
-
Haml::Engine.new(body).to_html
|
138
|
+
$POSTMATCH
|
160
139
|
else
|
161
|
-
|
140
|
+
data
|
162
141
|
end
|
163
|
-
end
|
164
142
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
# @content_page.attributes["view"] #=> "blog.haml"
|
170
|
-
# @content_page.view #=> :blog
|
171
|
-
#
|
172
|
-
# @return [Symbol] The view template's base file name.
|
173
|
-
#
|
174
|
-
def view
|
175
|
-
File.basename(attributes["view"].to_s, '.*').to_sym
|
143
|
+
FlavoredMarkdown.shake!(@attributes["body"]) if engine == TEMPLATE_ENGINES.key(:markdown)
|
144
|
+
@attributes.merge!("engine" => engine, "data" => data, "content" => nil)
|
145
|
+
|
146
|
+
@attributes["content"] = engine.new { @attributes["body"] }.render(nil, :page => self)
|
176
147
|
end
|
177
148
|
|
149
|
+
private
|
150
|
+
|
178
151
|
# Adds syntactic suger for reading attributes.
|
179
152
|
#
|
180
153
|
# @example
|
181
|
-
#
|
154
|
+
# page.title == page.attributes["title"]
|
182
155
|
#
|
183
156
|
# @param [Symbol] method_name
|
157
|
+
# @param [Array] args
|
158
|
+
# @param [Proc] block
|
184
159
|
# @raise [NoMethodError] Raised when there is no method name key in attributes
|
185
160
|
# @return [Object] Value of the method name attribute
|
186
161
|
#
|
187
|
-
def method_missing(method_name)
|
162
|
+
def method_missing(method_name, *args, &block)
|
188
163
|
key = method_name.to_s
|
189
164
|
attributes.has_key?(key) ? attributes[key] : super
|
190
165
|
end
|
191
|
-
|
192
166
|
end
|
193
167
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Extentions to the core `String` class
|
4
|
+
#
|
5
|
+
class String
|
6
|
+
# Convert a file name to a Sinatra-compliant template name
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# "blog.haml".templatize #=> :blog
|
10
|
+
#
|
11
|
+
# @return [Symbol] A Sinatra-compliant template name
|
12
|
+
#
|
13
|
+
def templatize
|
14
|
+
File.basename(self, '.*').to_sym
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Extentions to the core `URI` module
|
4
|
+
#
|
5
|
+
module URI
|
6
|
+
# Given a URI path, determine whether or no it looks like a directory path
|
7
|
+
#
|
8
|
+
# @param [String] uri_path
|
9
|
+
# @return [Boolean] `true` if the path is empty or has a trailing `/`, otherwise `false`
|
10
|
+
#
|
11
|
+
def self.directory?(uri_path)
|
12
|
+
uri_path.empty? || uri_path[-1] == "/"
|
13
|
+
end
|
14
|
+
end
|
data/lib/mango/dependencies.rb
CHANGED
@@ -15,11 +15,11 @@ module Mango
|
|
15
15
|
# developer-friendly warnings from rescued `LoadError` exceptions raised by missing
|
16
16
|
# development RubyGem dependencies.
|
17
17
|
#
|
18
|
-
# @example Simple usage with the
|
18
|
+
# @example Simple usage with the rspec-core gem
|
19
19
|
# Mango::Dependencies.warn_at_exit
|
20
20
|
# begin
|
21
|
-
# require "
|
22
|
-
#
|
21
|
+
# require "rspec/core/rake_task"
|
22
|
+
# RSpec::Core::RakeTask.new(:spec)
|
23
23
|
# rescue LoadError => e
|
24
24
|
# Mango::Dependencies.create_warning_for(e)
|
25
25
|
# end
|
@@ -27,12 +27,13 @@ module Mango
|
|
27
27
|
# @see Mango::Dependencies.create_warning_for
|
28
28
|
# @see Mango::Dependencies.warn_at_exit
|
29
29
|
module Dependencies
|
30
|
+
# A short list of supported Ruby versions
|
30
31
|
SUPPORTED_RUBY_VERSIONS = ["1.9.2"]
|
31
32
|
|
33
|
+
# Maps file names to gem name
|
32
34
|
FILE_NAME_TO_GEM_NAME = {
|
33
35
|
:"rack/test" => :"rack-test",
|
34
36
|
:"rspec/core/rake_task" => :"rspec-core",
|
35
|
-
:"yard/sinatra" => :"yard-sinatra"
|
36
37
|
}
|
37
38
|
|
38
39
|
# Checks that the version of the current Ruby process matches the one of the
|
@@ -78,5 +78,12 @@ module Mango
|
|
78
78
|
text
|
79
79
|
end
|
80
80
|
|
81
|
+
# Destructively replaces the value of `text` with a shake of `FlavoredMarkdown` text
|
82
|
+
#
|
83
|
+
# @param [String] text
|
84
|
+
# @see FlavoredMarkdown.shake
|
85
|
+
def self.shake!(text)
|
86
|
+
text.replace shake(text)
|
87
|
+
end
|
81
88
|
end
|
82
89
|
end
|
data/lib/mango/rack/debugger.rb
CHANGED
@@ -1,7 +1,21 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
module Mango
|
3
|
+
# TOOD: Remove namespace
|
4
|
+
#
|
3
5
|
module Rack
|
6
|
+
# A Rack Middleware class that enables `ruby-debug` which allows the interception of `debugger`
|
7
|
+
# breakpoints.
|
8
|
+
#
|
9
|
+
# @see http://www.sinatrarb.com/intro#Rack%20Middleware
|
10
|
+
# @see http://railscasts.com/episodes/54-debugging-with-ruby-debug
|
11
|
+
#
|
4
12
|
class Debugger
|
13
|
+
# Given a `Mango::Application`, enable `ruby-debug` when creating a new instance of `Debugger`.
|
14
|
+
#
|
15
|
+
# @param [Mango::Application] app
|
16
|
+
# @param [Kernel] kernel Useful for testing
|
17
|
+
# @param [String] ruby_version TODO: Remove parameter
|
18
|
+
#
|
5
19
|
def initialize(app, kernel = Kernel, ruby_version = RUBY_VERSION)
|
6
20
|
@app = app
|
7
21
|
kernel.require "ruby-debug"
|
@@ -14,6 +28,12 @@ module Mango
|
|
14
28
|
puts "=> With RubyGems, use 'gem install #{gem_name}' to install the library."
|
15
29
|
end
|
16
30
|
|
31
|
+
# Given a Rack environment, simply invoke the `Mango::Application` with the environment
|
32
|
+
# and return the response without modification.
|
33
|
+
#
|
34
|
+
# @param [Hash] env
|
35
|
+
# @return [Array]
|
36
|
+
#
|
17
37
|
def call(env)
|
18
38
|
@app.call(env)
|
19
39
|
end
|
data/lib/mango/runner.rb
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
require "thor"
|
3
3
|
|
4
4
|
module Mango
|
5
|
+
# `Mango::Runner` is a `Thor` class and is used in combination with the `bin/mango` executable.
|
6
|
+
#
|
7
|
+
# @see https://github.com/wycats/thor/wiki
|
8
|
+
#
|
5
9
|
class Runner < Thor
|
6
10
|
include Thor::Actions
|
7
11
|
|
@@ -10,91 +14,70 @@ module Mango
|
|
10
14
|
source_root File.expand_path("templates", File.dirname(__FILE__))
|
11
15
|
|
12
16
|
desc "create /path/to/your/app", "Creates a new Mango application at the specified path"
|
13
|
-
|
14
|
-
|
17
|
+
# Creates a new Mango application at the specified path
|
18
|
+
# @param [String] path
|
19
|
+
def create(path)
|
20
|
+
self.destination_root = path
|
15
21
|
|
16
22
|
copy_file(".gitignore")
|
17
23
|
copy_file("config.ru")
|
18
24
|
copy_file("Gemfile")
|
19
25
|
copy_file("README.md")
|
20
26
|
|
21
|
-
|
22
|
-
|
27
|
+
copy_content
|
28
|
+
copy_themes
|
23
29
|
end
|
24
30
|
|
25
31
|
###############################################################################################
|
26
32
|
|
27
33
|
protected
|
28
34
|
|
29
|
-
def
|
30
|
-
|
31
|
-
empty_directory(content_root)
|
32
|
-
|
33
|
-
copy_file("content/index.md")
|
35
|
+
def copy_content
|
36
|
+
copy_file("content/index.erb")
|
34
37
|
end
|
35
38
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
empty_directory(default_root)
|
42
|
-
|
43
|
-
build_public_path default_root
|
44
|
-
build_styles_path default_root
|
45
|
-
build_views_path default_root
|
39
|
+
def copy_themes
|
40
|
+
copy_javascript_templates
|
41
|
+
copy_public_files
|
42
|
+
copy_stylesheet_templates
|
43
|
+
copy_view_templates
|
46
44
|
end
|
47
45
|
|
48
46
|
###############################################################################################
|
49
47
|
|
50
|
-
|
51
|
-
|
52
|
-
def build_public_path(destination)
|
53
|
-
public_root = File.join(destination, "public")
|
54
|
-
empty_directory(public_root)
|
55
|
-
|
48
|
+
def copy_public_files
|
56
49
|
create_file("themes/default/public/favicon.ico")
|
57
50
|
copy_file("themes/default/public/robots.txt")
|
58
51
|
|
59
|
-
|
60
|
-
|
61
|
-
|
52
|
+
copy_image_files
|
53
|
+
copy_javascript_files
|
54
|
+
copy_stylesheet_files
|
62
55
|
end
|
63
56
|
|
64
|
-
def
|
65
|
-
public_images_root = File.join(destination, "images")
|
66
|
-
empty_directory(public_images_root)
|
67
|
-
|
57
|
+
def copy_image_files
|
68
58
|
copy_file("themes/default/public/images/particles.gif")
|
69
59
|
end
|
70
60
|
|
71
|
-
def
|
72
|
-
public_javascripts_root = File.join(destination, "javascripts")
|
73
|
-
empty_directory(public_javascripts_root)
|
74
|
-
|
61
|
+
def copy_javascript_files
|
75
62
|
copy_file("themes/default/public/javascripts/fireworks.js")
|
76
|
-
copy_file("themes/default/public/javascripts/timer.js")
|
77
63
|
end
|
78
64
|
|
79
|
-
def
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
copy_file("themes/default/public/styles/fireworks.css")
|
84
|
-
copy_file("themes/default/public/styles/reset.css")
|
65
|
+
def copy_stylesheet_files
|
66
|
+
copy_file("themes/default/public/stylesheets/fireworks.css")
|
67
|
+
copy_file("themes/default/public/stylesheets/reset.css")
|
85
68
|
end
|
86
69
|
|
87
|
-
|
88
|
-
styles_root = File.join(destination, "styles")
|
89
|
-
empty_directory(styles_root)
|
70
|
+
###############################################################################################
|
90
71
|
|
91
|
-
|
72
|
+
def copy_javascript_templates
|
73
|
+
copy_file("themes/default/javascripts/timer.coffee")
|
92
74
|
end
|
93
75
|
|
94
|
-
def
|
95
|
-
|
96
|
-
|
76
|
+
def copy_stylesheet_templates
|
77
|
+
copy_file("themes/default/stylesheets/screen.sass")
|
78
|
+
end
|
97
79
|
|
80
|
+
def copy_view_templates
|
98
81
|
copy_file("themes/default/views/404.haml")
|
99
82
|
copy_file("themes/default/views/layout.haml")
|
100
83
|
copy_file("themes/default/views/page.haml")
|