mango 0.5.4 → 0.6.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.
Files changed (83) hide show
  1. data/.gitignore +1 -2
  2. data/.rvmrc +1 -0
  3. data/.yardopts +1 -3
  4. data/{CHANGES.mdown → CHANGES.md} +40 -0
  5. data/Gemfile.lock +35 -23
  6. data/LICENSE +1 -1
  7. data/{README.mdown → README.md} +38 -27
  8. data/Rakefile +0 -13
  9. data/lib/mango.rb +5 -0
  10. data/lib/mango/application.rb +361 -129
  11. data/lib/mango/content_page.rb +89 -115
  12. data/lib/mango/core_ext/string.rb +16 -0
  13. data/lib/mango/core_ext/uri.rb +14 -0
  14. data/lib/mango/dependencies.rb +5 -4
  15. data/lib/mango/flavored_markdown.rb +7 -0
  16. data/lib/mango/rack/debugger.rb +20 -0
  17. data/lib/mango/runner.rb +33 -50
  18. data/lib/mango/templates/.gitignore +0 -1
  19. data/lib/mango/templates/Gemfile +1 -1
  20. data/lib/mango/templates/content/index.erb +6 -0
  21. data/lib/mango/templates/themes/default/javascripts/timer.coffee +6 -0
  22. data/lib/mango/templates/themes/default/public/javascripts/fireworks.js +0 -0
  23. data/lib/mango/templates/themes/default/public/{styles → stylesheets}/fireworks.css +0 -0
  24. data/lib/mango/templates/themes/default/public/{styles → stylesheets}/reset.css +0 -2
  25. data/lib/mango/templates/themes/default/{styles → stylesheets}/screen.sass +0 -2
  26. data/lib/mango/templates/themes/default/views/layout.haml +5 -5
  27. data/lib/mango/templates/themes/default/views/page.haml +1 -3
  28. data/lib/mango/version.rb +1 -1
  29. data/mango.gemspec +12 -10
  30. data/spec/fixture/content/engines/erb.erb +7 -0
  31. data/spec/fixture/content/engines/haml.haml +4 -4
  32. data/spec/fixture/content/engines/liquid.liquid +7 -0
  33. data/spec/fixture/content/engines/markdown.markdown +0 -6
  34. data/spec/fixture/content/engines/md.md +0 -6
  35. data/spec/fixture/content/engines/mkd.mkd +1 -0
  36. data/spec/fixture/content/page_with_missing_view.haml +2 -2
  37. data/spec/fixture/content/page_with_unregistered_view.haml +4 -0
  38. data/spec/fixture/content/view_engines/erb.haml +4 -0
  39. data/spec/fixture/content/view_engines/liquid.haml +4 -0
  40. data/spec/fixture/themes/default/javascripts/override.coffee +1 -0
  41. data/spec/fixture/themes/default/javascripts/siblings.coffee +7 -0
  42. data/spec/fixture/themes/default/javascripts/songs/happy.coffee +5 -0
  43. data/spec/fixture/themes/default/public/404.html +11 -0
  44. data/spec/fixture/themes/default/public/javascripts/econ.js +8 -0
  45. data/spec/fixture/themes/default/public/javascripts/math/opposite.js +6 -0
  46. data/spec/fixture/themes/default/public/javascripts/override.js +1 -0
  47. data/spec/fixture/themes/default/public/root.js +5 -0
  48. data/spec/fixture/themes/default/public/{styles → stylesheets}/override.css +0 -0
  49. data/spec/fixture/themes/default/public/{styles → stylesheets}/reset.css +0 -0
  50. data/spec/fixture/themes/default/public/{styles → stylesheets}/subfolder/another.css +0 -0
  51. data/spec/fixture/themes/default/security_hole.js +1 -0
  52. data/spec/fixture/themes/default/{styles → stylesheets}/override.sass +0 -0
  53. data/spec/fixture/themes/default/{styles/screen.sass → stylesheets/sass.sass} +4 -2
  54. data/spec/fixture/themes/default/stylesheets/scss.scss +19 -0
  55. data/spec/fixture/themes/default/{styles → stylesheets}/subfolder/screen.sass +0 -2
  56. data/spec/fixture/themes/default/views/404.erb +11 -0
  57. data/spec/fixture/themes/default/views/404.haml +1 -0
  58. data/spec/fixture/themes/default/views/404.liquid +11 -0
  59. data/spec/fixture/themes/default/views/layout.erb +10 -0
  60. data/spec/fixture/themes/default/views/layout.haml +1 -1
  61. data/spec/fixture/themes/default/views/layout.liquid +10 -0
  62. data/spec/fixture/themes/default/views/page.erb +7 -0
  63. data/spec/fixture/themes/default/views/page.haml +3 -1
  64. data/spec/fixture/themes/default/views/page.liquid +7 -0
  65. data/spec/lib/application/routing_content_pages_spec.rb +298 -21
  66. data/spec/lib/application/routing_javascript_templates_spec.rb +278 -0
  67. data/spec/lib/application/routing_not_found_spec.rb +254 -0
  68. data/spec/lib/application/routing_public_files_spec.rb +9 -8
  69. data/spec/lib/application/{routing_style_sheets_spec.rb → routing_stylesheet_templates_spec.rb} +61 -24
  70. data/spec/lib/application_spec.rb +31 -2
  71. data/spec/lib/content_page/initializing_spec.rb +399 -126
  72. data/spec/lib/content_page_spec.rb +23 -19
  73. data/spec/lib/core_ext/string_spec.rb +12 -0
  74. data/spec/lib/core_ext/uri_spec.rb +42 -0
  75. data/spec/lib/dependencies_spec.rb +0 -1
  76. data/spec/lib/flavored_markdown_spec.rb +18 -3
  77. data/spec/lib/runner_spec.rb +40 -39
  78. data/spec/lib/version_spec.rb +4 -4
  79. metadata +145 -64
  80. data/lib/mango/templates/content/index.md +0 -5
  81. data/lib/mango/templates/themes/default/public/javascripts/timer.js +0 -5
  82. data/spec/fixture/content/engines/mdown.mdown +0 -7
  83. data/spec/lib/content_page/finding_spec.rb +0 -213
@@ -1,18 +1,15 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require "bluecloth"
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 3rd-party content
11
- # engines, which convert easy-to-read, easy-to-write plain text and markup into structurally
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` instances have two primary components -- **a body** and some **attributes**.
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. Content pages are stored as files on disk. Here, the file name is `mango_poem.markdown`.
35
- # 2. Attributes are defined first, embedded within triple-dashed ("---") dividers.
36
- # 3. The body comes second, nestled comfortably below the attributes header.
37
- # 4. Attributes are key-value pairs, defined with [YAML](http://www.yaml.org/) formatting.
38
- # 5. The body, in this example, is plain-text. Because of the file extension, it's interpretted
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 Body
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
- # `ContentPage` instances are expected to be passed along into the view template they define.
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
- # @content_page.to_html
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
- # ### The Attributes
45
+ # <h1><%= page.title %></h1>
58
46
  #
59
- # Attributes are key-value pairs, defined with [YAML](http://www.yaml.org/) formatting.
47
+ # ### The Body
60
48
  #
61
- # All `ContentPage` instances have a `view` attribute, even if one is not explicitly declared in
62
- # the content file. This attribute is essential as it guides the `Mango::Application` to render
63
- # the correct view template file.
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
- # When declaring an explicit view template, only the base file name is important. **It's assumed
66
- # that all view templates are in Haml format.** The default view template file name is defined
67
- # by `Mango::ContentPage::DEFAULT["attributes"]`.
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
- # Syntactic sugar has been added for accessing attribtues. For example:
58
+ # <p><%= page.data %></p>
59
+ # <p><%= page.body %></p>
60
+ # <p><%= page.content %></p>
70
61
  #
71
- # @content_page.attributes["title"]
62
+ # ### The View Attribute and Template
72
63
  #
73
- # can be shortened to
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
- # @content_page.title
69
+ # When declaring an explicit view template, the relative file name is required. For example,
70
+ # given the following content page:
76
71
  #
77
- # Again, `ContentPage` instances are expected to be passed along into the view template they
78
- # define. With a `@content_page` instance in scope, accessing attributes inside a Haml template
79
- # works like this:
72
+ # ---
73
+ # view: blog.haml
74
+ # ---
80
75
  #
81
- # %title
82
- # = @content_page.title
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 Mango::FlavoredMarkdown
80
+ # @see FlavoredMarkdown
81
+ # @see Application::VIEW_TEMPLATE_ENGINES
85
82
  #
86
83
  class ContentPage
87
- class PageNotFound < RuntimeError; end
84
+ # @see http://goo.gl/z2Zzk
85
+ class InvalidHeaderError < RuntimeError; end
88
86
 
89
- # Known content formats and their associated file extensions
90
- CONTENT_ENGINES = {
91
- :markdown => ["md", "mdown", "markdown"],
92
- :haml => ["haml"]
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 values for various accessors
96
- DEFAULT = {
97
- :attributes => { "view" => :page },
98
- :body => "",
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
- # `String`
103
- attr_reader :data
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
- # `String`
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 [Symbol] :content_engine See `CONTENT_ENGINES` and `DEFAULT[:content_engine]`
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(data, options = {})
119
- @data = data
120
- @content_engine = options.delete(:content_engine) || DEFAULT[:content_engine]
115
+ def initialize(options = {})
116
+ data = options[:data] || ""
117
+ engine = options[:engine] || DEFAULT_ATTRIBUTES["engine"]
121
118
 
122
- if self.data =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
123
- @attributes = DEFAULT[:attributes].merge(YAML.load($1) || {})
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
- # Create a new instance by searching for and reading a content file from disk. Content files
132
- # are searched consecutively until a page with known content extension is found.
133
- #
134
- # @param [String] path_without_extension
135
- # @raise [PageNotFound] Raised when a content page cannot be found
136
- # @return [ContentPage] A new instance is created and returned when found
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
- raise PageNotFound, "Unable to find content page for path -- #{path_without_extension}"
147
- end
132
+ begin
133
+ @attributes.merge!(header)
134
+ rescue
135
+ raise InvalidHeaderError, "Cannot parse header -- #{header.inspect}"
136
+ end
148
137
 
149
- # Given a content engine, converts the body to HTML.
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
- raise "Unknown content engine -- #{content_engine}"
140
+ data
162
141
  end
163
- end
164
142
 
165
- # Returns just the view template's base file name. It's assumed that all view templates are in
166
- # Haml format.
167
- #
168
- # @example
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
- # @content_page.title == @content_page.attributes["title"]
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
@@ -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 YARD gem
18
+ # @example Simple usage with the rspec-core gem
19
19
  # Mango::Dependencies.warn_at_exit
20
20
  # begin
21
- # require "yard"
22
- # YARD::Rake::YardocTask.new(:yard)
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
@@ -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
@@ -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
- def create(destination)
14
- self.destination_root = destination
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
- build_content_path
22
- build_themes_path
27
+ copy_content
28
+ copy_themes
23
29
  end
24
30
 
25
31
  ###############################################################################################
26
32
 
27
33
  protected
28
34
 
29
- def build_content_path
30
- content_root = File.join(self.destination_root, "content")
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 build_themes_path
37
- themes_root = File.join(self.destination_root, "themes")
38
- empty_directory(themes_root)
39
-
40
- default_root = File.join(themes_root, "default")
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
- protected
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
- build_public_images_path public_root
60
- build_public_javascripts_path public_root
61
- build_public_styles_path public_root
52
+ copy_image_files
53
+ copy_javascript_files
54
+ copy_stylesheet_files
62
55
  end
63
56
 
64
- def build_public_images_path(destination)
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 build_public_javascripts_path(destination)
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 build_public_styles_path(destination)
80
- public_styles_root = File.join(destination, "styles")
81
- empty_directory(public_styles_root)
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
- def build_styles_path(destination)
88
- styles_root = File.join(destination, "styles")
89
- empty_directory(styles_root)
70
+ ###############################################################################################
90
71
 
91
- copy_file("themes/default/styles/screen.sass")
72
+ def copy_javascript_templates
73
+ copy_file("themes/default/javascripts/timer.coffee")
92
74
  end
93
75
 
94
- def build_views_path(destination)
95
- views_root = File.join(destination, "views")
96
- empty_directory(views_root)
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")