tdreyno-staticmatic 2.1.1 → 2.1.3
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/bin/staticmatic +1 -1
- data/lib/staticmatic/autoload.rb +1 -0
- data/lib/staticmatic/base.rb +2 -2
- data/lib/staticmatic/builder.rb +1 -1
- data/lib/staticmatic/generator.rb +28 -0
- data/lib/staticmatic/previewer.rb +3 -3
- data/lib/templates/script/builder +2 -2
- data/spec/builder_spec.rb +1 -12
- metadata +2 -3
data/bin/staticmatic
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'staticmatic'
|
4
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'staticmatic')
|
5
5
|
StaticMatic::Generator.run_cli(Dir.pwd, 'staticmatic', 1, ["setup"].concat(ARGV))
|
data/lib/staticmatic/autoload.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module StaticMatic
|
2
2
|
autoload :Base, File.join(File.dirname(__FILE__), 'base')
|
3
3
|
autoload :Config, File.join(File.dirname(__FILE__), 'config')
|
4
|
+
autoload :Builder, File.join(File.dirname(__FILE__), 'builder')
|
4
5
|
autoload :Generator, File.join(File.dirname(__FILE__), 'generator')
|
5
6
|
autoload :Deprecation, File.join(File.dirname(__FILE__), 'deprecation')
|
6
7
|
autoload :Previewer, File.join(File.dirname(__FILE__), 'previewer')
|
data/lib/staticmatic/base.rb
CHANGED
@@ -56,7 +56,8 @@ module StaticMatic
|
|
56
56
|
|
57
57
|
def render(filename)
|
58
58
|
load_helpers
|
59
|
-
|
59
|
+
filename = full_template_path(filename)
|
60
|
+
output = do_render(filename)
|
60
61
|
|
61
62
|
return output if determine_format_for(filename) == :css
|
62
63
|
layout = view.instance_variable_get("@layout")
|
@@ -82,7 +83,6 @@ module StaticMatic
|
|
82
83
|
end
|
83
84
|
|
84
85
|
def do_render(filename)
|
85
|
-
filename = full_template_path(filename)
|
86
86
|
view.instance_variable_set("@current_page", filename)
|
87
87
|
view.template_format = determine_format_for(filename)
|
88
88
|
view.render_file(strip_extension(filename), true)
|
data/lib/staticmatic/builder.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'templater'
|
2
|
+
|
3
|
+
module StaticMatic
|
4
|
+
module Generator
|
5
|
+
extend Templater::Manifold
|
6
|
+
desc "Generator for streamlining staticmatic"
|
7
|
+
|
8
|
+
class StaticmaticGenerator < Templater::Generator
|
9
|
+
desc "Creates a new staticmatic scaffold."
|
10
|
+
first_argument :location, :required => true, :desc => "Project location"
|
11
|
+
|
12
|
+
def destination_root
|
13
|
+
File.expand_path(location)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.source_root
|
17
|
+
File.join(File.dirname(__FILE__), '../templates')
|
18
|
+
end
|
19
|
+
|
20
|
+
glob!
|
21
|
+
empty_directory :images, File.join("src", "images")
|
22
|
+
empty_directory :javascripts, File.join("src", "javascripts")
|
23
|
+
empty_directory :build, "build"
|
24
|
+
end
|
25
|
+
|
26
|
+
add :setup, StaticmaticGenerator
|
27
|
+
end
|
28
|
+
end
|
@@ -11,13 +11,13 @@ module StaticMatic
|
|
11
11
|
path_info = request.params[Mongrel::Const::PATH_INFO].chomp("/")
|
12
12
|
get_or_head = %w(GET HEAD).include? request.params[Mongrel::Const::REQUEST_METHOD]
|
13
13
|
|
14
|
-
if
|
14
|
+
if @staticmatic.can_render? path_info
|
15
15
|
file_ext = File.extname(path_info).gsub(/^\./, '')
|
16
16
|
file_ext = "html" if file_ext.blank?
|
17
|
-
file_name = CGI::unescape(path_info
|
17
|
+
file_name = CGI::unescape(path_info).gsub!(/^\//, '') || ''
|
18
18
|
|
19
19
|
response.start(200) do |head, out|
|
20
|
-
output =
|
20
|
+
output = @staticmatic.render(file_name)
|
21
21
|
head[Mongrel::Const::CONTENT_TYPE] = Mongrel::DirHandler::MIME_TYPES[".#{file_ext}"] || "application/octet-stream"
|
22
22
|
out.write(output || "")
|
23
23
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
-
require 'staticmatic
|
5
|
-
StaticMatic::
|
4
|
+
require 'staticmatic'
|
5
|
+
StaticMatic::Builder.run_cli(Dir.pwd, 'builder', 1, ["build"].concat(ARGV))
|
6
6
|
# find setting to always overwrite/merge
|
data/spec/builder_spec.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
#
|
8
8
|
# orig_stdout = STDOUT.dup
|
9
9
|
# STDOUT.reopen('/dev/null') # redirect stdout to /dev/null
|
10
|
-
# StaticMatic::
|
10
|
+
# StaticMatic::Builder.run_cli(File.dirname(@root_dir), 'staticmatic', 1, ["setup", File.basename(@root_dir)])
|
11
11
|
# STDOUT.reopen(orig_stdout) # restore stdout
|
12
12
|
# end
|
13
13
|
#
|
@@ -22,17 +22,6 @@
|
|
22
22
|
# FileUtils.rm_rf(@root_dir)
|
23
23
|
# end
|
24
24
|
#
|
25
|
-
# it "should create version tracking file with current build timestamp" do
|
26
|
-
# versions_file = "#{@root_dir}/builds"
|
27
|
-
# about_now = Time.now.strftime("%Y%m%d%H%M")
|
28
|
-
#
|
29
|
-
# build_site
|
30
|
-
# File.exists?(versions_file).should be_true
|
31
|
-
#
|
32
|
-
# versions = File.read(versions_file).split(/\n/)
|
33
|
-
# versions[0].should include(about_now)
|
34
|
-
# end
|
35
|
-
#
|
36
25
|
# it "should not build partial files" do
|
37
26
|
# File.open("#{@root_dir}/src/pages/_partial.html.erb", "w") do |f|
|
38
27
|
# f.puts "Test"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdreyno-staticmatic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Bartholomew
|
@@ -75,9 +75,8 @@ files:
|
|
75
75
|
- lib/staticmatic/builder.rb
|
76
76
|
- lib/staticmatic/config.rb
|
77
77
|
- lib/staticmatic/deprecation.rb
|
78
|
-
- lib/staticmatic/
|
78
|
+
- lib/staticmatic/generator.rb
|
79
79
|
- lib/staticmatic/previewer.rb
|
80
|
-
- lib/staticmatic/rescue.rb
|
81
80
|
- lib/staticmatic/actionpack_support/mime.rb
|
82
81
|
- lib/staticmatic/actionpack_support/remove_partial_benchmark.rb
|
83
82
|
- lib/staticmatic/actionpack_support/remove_controller_caching.rb
|