tdreyno-staticmatic 2.9.4 → 2.9.6
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/sm-build +2 -4
- data/bin/sm-server +1 -2
- data/lib/builder.rb +14 -10
- data/lib/generator.rb +18 -7
- data/lib/merb/init.rb +15 -15
- data/lib/merb/site.rb +2 -2
- data/lib/template/config/init.rb +7 -0
- data/lib/template/{layout → pages/layout}/site.html.haml +0 -0
- data/lib/template/stylesheets/{sass/site.sass → site.sass} +0 -0
- data/spec/fixtures/sample/pages/layout/site.html.erb +2 -2
- data/spec/fixtures/sample/{stylesheets → public/stylesheets}/static.css +0 -0
- data/spec/fixtures/sample/stylesheets/{sass/site.sass → site.sass} +0 -0
- data/spec/generator_spec.rb +3 -2
- metadata +18 -7
data/bin/sm-build
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
# Require Merb
|
|
3
4
|
require 'rubygems'
|
|
4
5
|
require 'merb-core'
|
|
5
6
|
|
|
6
7
|
# Setup Default Options
|
|
7
8
|
ARGV.push *['--pid', "/var/tmp/staticmatic.%s.pid"]
|
|
8
|
-
ARGV.push *['--
|
|
9
|
+
ARGV.push *['--environment', 'build']
|
|
9
10
|
|
|
10
11
|
# Start Merb
|
|
11
12
|
Merb.start
|
|
@@ -14,8 +15,5 @@ class MerbProxy
|
|
|
14
15
|
include Merb::Test::RequestHelper
|
|
15
16
|
end
|
|
16
17
|
|
|
17
|
-
Sass::Plugin.options = Merb::Config[:sass] if Merb::Config[:sass]
|
|
18
|
-
Sass::Plugin.update_stylesheets
|
|
19
|
-
|
|
20
18
|
require File.join(File.dirname(__FILE__), '..', 'lib', 'builder')
|
|
21
19
|
Generators.run_cli(Dir.pwd, 'sm-build', 1, %w(build --force).concat(ARGV))
|
data/bin/sm-server
CHANGED
|
@@ -5,9 +5,8 @@ require 'rubygems'
|
|
|
5
5
|
require 'merb-core'
|
|
6
6
|
|
|
7
7
|
# Setup Default Options
|
|
8
|
-
ARGV.push *['--adapter', "mongrel"]
|
|
9
8
|
ARGV.push *['--pid', "/var/tmp/staticmatic.%s.pid"]
|
|
10
|
-
ARGV.push *['--
|
|
9
|
+
ARGV.push *['--adapter', "mongrel"]
|
|
11
10
|
|
|
12
11
|
# Start Merb
|
|
13
12
|
puts "Welcome to StaticMatic"
|
data/lib/builder.rb
CHANGED
|
@@ -4,7 +4,7 @@ require 'templater'
|
|
|
4
4
|
module Generators
|
|
5
5
|
extend Templater::Manifold
|
|
6
6
|
desc "Build a staticmatic site"
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
class Builder < Templater::Generator
|
|
9
9
|
# Define source and desintation
|
|
10
10
|
def self.source_root; Dir.pwd; end
|
|
@@ -14,26 +14,30 @@ module Generators
|
|
|
14
14
|
def self.template(name, *args, &block)
|
|
15
15
|
return if args.first.include?('/layout/')
|
|
16
16
|
return if File.basename(args.first)[0,1] == '_'
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
if (args[0] === args[1])
|
|
19
19
|
args[1] = args[0].gsub(File.extname(args.first), '').gsub('pages/', '')
|
|
20
20
|
end
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
super(name, *args, &block)
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
def self.file(name, *args, &block)
|
|
26
26
|
return if args.first.include?('/sass/')
|
|
27
27
|
args[1] = args[0].gsub('pages/', '') if (args[0] === args[1])
|
|
28
28
|
super(name, *args, &block)
|
|
29
29
|
end
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
|
|
31
|
+
public_files_glob = File.join(source_root, "public", "{images,javascripts,stylesheets}", '**/*')
|
|
32
|
+
Dir[public_files_glob].each do |action|
|
|
33
|
+
next if File.directory?(action)
|
|
34
|
+
action = action.sub("#{source_root}/", '')
|
|
35
|
+
file(action.downcase.gsub(/[^a-z0-9]+/, '_').to_sym, action, action.gsub('public/', ''))
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
glob! "pages", %w(haml erb)
|
|
35
39
|
end
|
|
36
|
-
|
|
40
|
+
|
|
37
41
|
add :build, Builder
|
|
38
42
|
end
|
|
39
43
|
|
data/lib/generator.rb
CHANGED
|
@@ -2,25 +2,36 @@ require 'rubygems'
|
|
|
2
2
|
require 'templater'
|
|
3
3
|
|
|
4
4
|
module Generators
|
|
5
|
-
extend Templater::Manifold
|
|
5
|
+
extend Templater::Manifold
|
|
6
6
|
desc "Generator for streamlining staticmatic"
|
|
7
7
|
|
|
8
8
|
class NewSite < Templater::Generator
|
|
9
9
|
desc "Creates a new staticmatic scaffold."
|
|
10
10
|
first_argument :location, :required => true, :desc => "Project location"
|
|
11
|
-
|
|
11
|
+
option :rack, :as => :boolean, :default => false, :desc => 'Should generate rackup (ru) file for Passenger'
|
|
12
|
+
|
|
12
13
|
def destination_root
|
|
13
14
|
File.expand_path(location)
|
|
14
15
|
end
|
|
15
|
-
|
|
16
|
+
|
|
16
17
|
def self.source_root
|
|
17
18
|
File.join(File.dirname(__FILE__), 'template')
|
|
18
19
|
end
|
|
19
20
|
|
|
20
|
-
glob!
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
glob! :config
|
|
22
|
+
glob! :helpers
|
|
23
|
+
glob! :pages
|
|
24
|
+
glob! :public
|
|
25
|
+
glob! :stylesheets
|
|
26
|
+
|
|
27
|
+
file :config_ru, :rack => true do |file|
|
|
28
|
+
file.source = File.join(source_root, 'config.ru')
|
|
29
|
+
file.destination = 'config.ru'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
empty_directory :stylesheets, "public/stylesheets"
|
|
33
|
+
empty_directory :javascripts, "public/javascripts"
|
|
34
|
+
empty_directory :images, "public/images"
|
|
24
35
|
end
|
|
25
36
|
|
|
26
37
|
add :setup, NewSite
|
data/lib/merb/init.rb
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
dependency 'merb-helpers', ">=1.0.0"
|
|
3
|
-
dependency 'merb-haml', ">=1.0.0"
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'dependencies')
|
|
4
2
|
|
|
5
3
|
Merb::Config.use do |c|
|
|
6
4
|
c[:name] = 'sm-server'
|
|
7
5
|
c[:exception_details] = true
|
|
8
|
-
|
|
6
|
+
|
|
9
7
|
# Append random numbers to assets in dev mode, but not build mode
|
|
10
|
-
c[:reload_templates] = (Merb::Config[:
|
|
11
|
-
|
|
8
|
+
c[:reload_templates] = (Merb::Config[:environment] != 'build')
|
|
9
|
+
|
|
12
10
|
c[:reload_classes] = true
|
|
13
11
|
c[:reload_time] = 0.5
|
|
14
12
|
c[:ignore_tampered_cookies] = true
|
|
@@ -16,16 +14,18 @@ Merb::Config.use do |c|
|
|
|
16
14
|
c[:log_level] = :error
|
|
17
15
|
c[:log_stream] = STDOUT
|
|
18
16
|
c[:log_file] = nil
|
|
17
|
+
|
|
18
|
+
c[:sass] = {
|
|
19
|
+
:template_location => Merb.root / 'stylesheets',
|
|
20
|
+
:css_location => Merb.root / 'public' / 'stylesheets',
|
|
21
|
+
}
|
|
19
22
|
end
|
|
20
23
|
|
|
21
24
|
Merb.push_path(:controller, File.dirname(__FILE__))
|
|
22
25
|
Merb.push_path(:router, File.dirname(__FILE__), "router.rb")
|
|
23
|
-
Merb.push_path(:public, Merb.root, nil)
|
|
24
|
-
Merb.push_path(:stylesheet, Merb.
|
|
25
|
-
Merb.push_path(:javascript, Merb.
|
|
26
|
-
Merb.push_path(:image, Merb.
|
|
27
|
-
Merb.push_path(:view, Merb.root)
|
|
28
|
-
Merb.push_path(:helper, Merb.root / "helpers")
|
|
29
|
-
|
|
30
|
-
Merb::Plugins.config[:sass][:css_location] = Merb.dir_for(:stylesheet)
|
|
31
|
-
Merb::Plugins.config[:sass][:template_location] = Merb.dir_for(:stylesheet) / "sass"
|
|
26
|
+
Merb.push_path(:public, Merb.root / "public", nil)
|
|
27
|
+
Merb.push_path(:stylesheet, Merb.dir_for(:public) / "stylesheets", nil)
|
|
28
|
+
Merb.push_path(:javascript, Merb.dir_for(:public) / "javascripts", nil)
|
|
29
|
+
Merb.push_path(:image, Merb.dir_for(:public) / "images", nil)
|
|
30
|
+
Merb.push_path(:view, Merb.root / "pages")
|
|
31
|
+
Merb.push_path(:helper, Merb.root / "helpers")
|
data/lib/merb/site.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Intercept all requests
|
|
2
2
|
class Site < ::Merb::Controller
|
|
3
3
|
def index
|
|
4
|
-
render :template =>
|
|
4
|
+
render :template => current_page
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
override! :partial
|
|
8
8
|
def partial(template, opts={})
|
|
9
|
-
super(
|
|
9
|
+
super(template.to_s, opts)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
override! :asset_path
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Include default staticmatic init
|
|
2
|
+
require '<%= ::File.join(::File.expand_path(::File.join(source_root, '..')), 'merb', 'init') %>'
|
|
3
|
+
|
|
4
|
+
# Enable Compass
|
|
5
|
+
dependency "chriseppstein-compass", :require_as => 'compass'
|
|
6
|
+
Merb::Plugins.config[:compass][:stylesheets] = Merb.dir_for(:stylesheet)
|
|
7
|
+
Merb::Plugins.config[:compass][:compiled_stylesheets] = Merb.dir_for(:stylesheet) / "sass"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/spec/generator_spec.rb
CHANGED
|
@@ -11,7 +11,7 @@ describe "Generator" do
|
|
|
11
11
|
|
|
12
12
|
before :each do
|
|
13
13
|
init_cmd = project_file("bin", "sm-init")
|
|
14
|
-
`cd #{File.dirname(@root_dir)} && #{init_cmd} #{File.basename(@root_dir)}`
|
|
14
|
+
`cd #{File.dirname(@root_dir)} && #{init_cmd} #{File.basename(@root_dir)} --rack`
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
after :each do
|
|
@@ -21,12 +21,13 @@ describe "Generator" do
|
|
|
21
21
|
it "should copy template files" do
|
|
22
22
|
template_dir = project_file("lib", "template", "**/*")
|
|
23
23
|
Dir[template_dir].each do |f|
|
|
24
|
+
next if File.directory?(f)
|
|
24
25
|
File.exists?("#{@root_dir}/#{f.split('template/')[1]}").should be_true
|
|
25
26
|
end
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
it "should create empty directories" do
|
|
29
|
-
%w(
|
|
30
|
+
%w(stylesheets public/stylesheets public/javascripts public/images).each do |d|
|
|
30
31
|
File.exists?("#{@root_dir}/#{d}").should be_true
|
|
31
32
|
end
|
|
32
33
|
end
|
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.9.
|
|
4
|
+
version: 2.9.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen Bartholomew
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2009-04-
|
|
13
|
+
date: 2009-04-29 00:00:00 -07:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -43,6 +43,16 @@ dependencies:
|
|
|
43
43
|
- !ruby/object:Gem::Version
|
|
44
44
|
version: 1.0.5
|
|
45
45
|
version:
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: haml
|
|
48
|
+
type: :runtime
|
|
49
|
+
version_requirement:
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 2.1.0
|
|
55
|
+
version:
|
|
46
56
|
- !ruby/object:Gem::Dependency
|
|
47
57
|
name: merb-haml
|
|
48
58
|
type: :runtime
|
|
@@ -84,10 +94,11 @@ files:
|
|
|
84
94
|
- lib/merb/init.rb
|
|
85
95
|
- lib/merb/router.rb
|
|
86
96
|
- lib/merb/site.rb
|
|
97
|
+
- lib/template/config/init.rb
|
|
87
98
|
- lib/template/helpers/site_helper.rb
|
|
88
|
-
- lib/template/layout/site.html.haml
|
|
89
99
|
- lib/template/pages/index.html.haml
|
|
90
|
-
- lib/template/
|
|
100
|
+
- lib/template/pages/layout/site.html.haml
|
|
101
|
+
- lib/template/stylesheets/site.sass
|
|
91
102
|
- README.textile
|
|
92
103
|
has_rdoc: true
|
|
93
104
|
homepage: http://github.com/tdreyno/staticmatic
|
|
@@ -113,7 +124,7 @@ requirements: []
|
|
|
113
124
|
rubyforge_project:
|
|
114
125
|
rubygems_version: 1.2.0
|
|
115
126
|
signing_key:
|
|
116
|
-
specification_version:
|
|
127
|
+
specification_version: 3
|
|
117
128
|
summary: Static sites, the Merb Way
|
|
118
129
|
test_files:
|
|
119
130
|
- spec/generator_spec.rb
|
|
@@ -130,5 +141,5 @@ test_files:
|
|
|
130
141
|
- spec/fixtures/sample/pages/static.html
|
|
131
142
|
- spec/fixtures/sample/pages/services/index.html.erb
|
|
132
143
|
- spec/fixtures/sample/pages/services/web_development.html.erb
|
|
133
|
-
- spec/fixtures/sample/stylesheets/static.css
|
|
134
|
-
- spec/fixtures/sample/stylesheets/
|
|
144
|
+
- spec/fixtures/sample/public/stylesheets/static.css
|
|
145
|
+
- spec/fixtures/sample/stylesheets/site.sass
|