staticmatic3 2.1.9
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.
- checksums.yaml +7 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +43 -0
- data/LICENSE +20 -0
- data/README.md +154 -0
- data/Rakefile +45 -0
- data/VERSION.yml +5 -0
- data/bin/staticmatic +142 -0
- data/lib/staticmatic.rb +22 -0
- data/lib/staticmatic/ambiguous_template_error.rb +19 -0
- data/lib/staticmatic/base.rb +149 -0
- data/lib/staticmatic/compass.rb +5 -0
- data/lib/staticmatic/compass/app_integration.rb +21 -0
- data/lib/staticmatic/compass/configuration_defaults.rb +44 -0
- data/lib/staticmatic/compass/installer.rb +15 -0
- data/lib/staticmatic/configuration.rb +56 -0
- data/lib/staticmatic/deployers/aws-s3.rb +108 -0
- data/lib/staticmatic/deployers/config/amazon.yml +7 -0
- data/lib/staticmatic/error.rb +17 -0
- data/lib/staticmatic/helpers.rb +12 -0
- data/lib/staticmatic/helpers/assets_helper.rb +116 -0
- data/lib/staticmatic/helpers/current_path_helper.rb +22 -0
- data/lib/staticmatic/helpers/form_helper.rb +23 -0
- data/lib/staticmatic/helpers/render_helper.rb +14 -0
- data/lib/staticmatic/helpers/tag_helper.rb +35 -0
- data/lib/staticmatic/helpers/url_helper.rb +59 -0
- data/lib/staticmatic/mixins/build.rb +41 -0
- data/lib/staticmatic/mixins/helpers.rb +15 -0
- data/lib/staticmatic/mixins/render.rb +110 -0
- data/lib/staticmatic/mixins/rescue.rb +12 -0
- data/lib/staticmatic/mixins/server.rb +7 -0
- data/lib/staticmatic/mixins/setup.rb +16 -0
- data/lib/staticmatic/server.rb +87 -0
- data/lib/staticmatic/template_error.rb +44 -0
- data/lib/staticmatic/templates/rescues/default.haml +7 -0
- data/lib/staticmatic/templates/rescues/template.haml +18 -0
- data/spec/base_spec.rb +13 -0
- data/spec/compass_integration_spec.rb +28 -0
- data/spec/helpers/asset_helper_spec.rb +41 -0
- data/spec/helpers/custom_helper_spec.rb +17 -0
- data/spec/render_spec.rb +44 -0
- data/spec/rescue_spec.rb +36 -0
- data/spec/sandbox/test_site/config/compass.rb +1 -0
- data/spec/sandbox/test_site/config/site.rb +0 -0
- data/spec/sandbox/test_site/site/sub_folder/another_sub_folder/index.html +1 -0
- data/spec/sandbox/test_site/site/sub_folder/another_sub_folder/index.html.html +1 -0
- data/spec/sandbox/test_site/site/sub_folder/index.html +1 -0
- data/spec/sandbox/test_site/src/_helpers/application_helper.rb +5 -0
- data/spec/sandbox/test_site/src/_layouts/alternate_layout.haml +3 -0
- data/spec/sandbox/test_site/src/_layouts/default.haml +7 -0
- data/spec/sandbox/test_site/src/_layouts/projects.haml +1 -0
- data/spec/sandbox/test_site/src/_partials/menu.haml +1 -0
- data/spec/sandbox/test_site/src/_partials/partial_with_error.haml +1 -0
- data/spec/sandbox/test_site/src/hello_world.erb +1 -0
- data/spec/sandbox/test_site/src/index.haml +5 -0
- data/spec/sandbox/test_site/src/layout_test.haml +2 -0
- data/spec/sandbox/test_site/src/page_one.haml +3 -0
- data/spec/sandbox/test_site/src/page_two.haml +2 -0
- data/spec/sandbox/test_site/src/page_with_error.haml +5 -0
- data/spec/sandbox/test_site/src/page_with_partial_error.haml +3 -0
- data/spec/sandbox/test_site/src/stylesheets/application.sass +5 -0
- data/spec/sandbox/test_site/src/stylesheets/css_with_error.sass +5 -0
- data/spec/sandbox/test_site/src/stylesheets/nested/a_nested_stylesheet.sass +0 -0
- data/spec/sandbox/test_site/src/stylesheets/partials/_forms.sass +2 -0
- data/spec/sandbox/test_site/src/stylesheets/sassy.scss +12 -0
- data/spec/server_spec.rb +11 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/template_error_spec.rb +23 -0
- data/staticmatic.gemspec +158 -0
- data/staticmatic3.gemspec +164 -0
- data/website/Gemfile +1 -0
- data/website/config/site.rb +17 -0
- data/website/site/docs/compass_integration.html +70 -0
- data/website/site/docs/getting_started.html +49 -0
- data/website/site/docs/helpers.html +22 -0
- data/website/site/images/bycurve21.gif +0 -0
- data/website/site/images/curve21.jpg +0 -0
- data/website/site/images/homepage-build.jpg +0 -0
- data/website/site/images/homepage-previewing.jpg +0 -0
- data/website/site/images/homepage-templating.jpg +0 -0
- data/website/site/stylesheets/ie.css +5 -0
- data/website/site/stylesheets/print.css +372 -0
- data/website/site/stylesheets/screen.css +488 -0
- data/website/src/helpers/content_helper.rb +10 -0
- data/website/src/layouts/default.haml +15 -0
- data/website/src/pages/development.haml +9 -0
- data/website/src/pages/docs/_menu.haml +4 -0
- data/website/src/pages/docs/_requires_prerelease.haml +4 -0
- data/website/src/pages/docs/compass_integration.haml +54 -0
- data/website/src/pages/docs/getting_started.haml +31 -0
- data/website/src/pages/docs/helpers.haml +1 -0
- data/website/src/pages/index.haml +27 -0
- data/website/src/stylesheets/_base.scss +43 -0
- data/website/src/stylesheets/_defaults.scss +260 -0
- data/website/src/stylesheets/ie.scss +10 -0
- data/website/src/stylesheets/print.scss +33 -0
- data/website/src/stylesheets/screen.scss +73 -0
- metadata +285 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f20894987a8edc7a4db791b667b917753b74167a80135781a46cbcdfb7e8361e
|
4
|
+
data.tar.gz: 14e642857be092e253d1eb222b30e035374b8b5e9f001760cff5876520a184d8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 86bfccaad8517e7609344faec6cc071cdef2554499459356f1289f44862aadd587acbf330f66cba4dd324319d10351e410d7ba23c532040b75ebc18a4b13c5df
|
7
|
+
data.tar.gz: 2c125a57f804ca51f4dca380bde5024101c39ae20282195d6d4b45b7d9558bf2ba097d31ce0c6b90eab14f7984a226fb6692d4faaa329480465e75ddecda410b
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "haml", "~> 3.1"
|
4
|
+
gem "sass", "~> 3.1"
|
5
|
+
gem "tilt", ">= 1.3"
|
6
|
+
gem "compass", "~> 0.12.1"
|
7
|
+
|
8
|
+
gem "rack", ">= 1.0"
|
9
|
+
gem "thor", ">=0.14.6"
|
10
|
+
gem "aws-s3"
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem "bundler", "~> 1.0"
|
14
|
+
gem "jeweler", "~> 1.6"
|
15
|
+
gem "rspec", "~> 1.3.1"
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
aws-s3 (0.6.2)
|
5
|
+
builder
|
6
|
+
mime-types
|
7
|
+
xml-simple
|
8
|
+
builder (3.0.0)
|
9
|
+
chunky_png (1.2.5)
|
10
|
+
compass (0.12.1)
|
11
|
+
chunky_png (~> 1.2)
|
12
|
+
fssm (>= 0.2.7)
|
13
|
+
sass (~> 3.1)
|
14
|
+
fssm (0.2.8.1)
|
15
|
+
git (1.2.5)
|
16
|
+
haml (3.1.4)
|
17
|
+
jeweler (1.6.4)
|
18
|
+
bundler (~> 1.0)
|
19
|
+
git (>= 1.2.5)
|
20
|
+
rake
|
21
|
+
mime-types (1.16)
|
22
|
+
rack (1.2.1)
|
23
|
+
rake (0.9.2)
|
24
|
+
rspec (1.3.1)
|
25
|
+
sass (3.1.7)
|
26
|
+
thor (0.14.6)
|
27
|
+
tilt (1.3.3)
|
28
|
+
xml-simple (1.0.14)
|
29
|
+
|
30
|
+
PLATFORMS
|
31
|
+
ruby
|
32
|
+
|
33
|
+
DEPENDENCIES
|
34
|
+
aws-s3
|
35
|
+
bundler (~> 1.0)
|
36
|
+
compass (~> 0.12.1)
|
37
|
+
haml (~> 3.1)
|
38
|
+
jeweler (~> 1.6)
|
39
|
+
rack (>= 1.0)
|
40
|
+
rspec (~> 1.3.1)
|
41
|
+
sass (~> 3.1)
|
42
|
+
thor (>= 0.14.6)
|
43
|
+
tilt (>= 1.3)
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (C) 2009 Stephen Bartholomew
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
# StaticMatic: Build and Deploy
|
2
|
+
|
3
|
+
1: Build static websites using modern dynamic tools:
|
4
|
+
|
5
|
+
- [Haml](http://haml-lang.com/)
|
6
|
+
- [Sass](http://sass-lang.com/)
|
7
|
+
- [Coffeescript](http://jashkenas.github.com/coffee-script/)
|
8
|
+
- [Compass](compass-style.org)
|
9
|
+
- [Amazon S3 Websites](http://aws.typepad.com/aws/2011/02/host-your-static-website-on-amazon-s3.html)
|
10
|
+
- [And many, many more!](https://github.com/rtomayko/tilt#readme)
|
11
|
+
|
12
|
+
2: Deploy to Amazon S3:
|
13
|
+
|
14
|
+
$ staticmatic s3_deploy
|
15
|
+
|
16
|
+
3: Profit (due to low hosting fees :P)
|
17
|
+
|
18
|
+
## In other words:
|
19
|
+
|
20
|
+
StaticMatic build StaticMatic deploy
|
21
|
+
src/ ==> build/ ==> mywebsite.com/
|
22
|
+
index.haml ==> index.html ==> index.html
|
23
|
+
style.sass ==> style.css ==> style.css
|
24
|
+
js/ ==> js/ ==> js/
|
25
|
+
app.coffee ==> app.js ==> app.js
|
26
|
+
img/ ==> img/ ==> img/
|
27
|
+
logo.png ==> logo.png ==> logo.png
|
28
|
+
|
29
|
+
# Getting Started
|
30
|
+
|
31
|
+
$ gem install staticmatic2
|
32
|
+
|
33
|
+
## Quick Start
|
34
|
+
|
35
|
+
Setup a new project:
|
36
|
+
|
37
|
+
$ staticmatic init my-project
|
38
|
+
|
39
|
+
This will give you a basic skeleton:
|
40
|
+
|
41
|
+
my-project/
|
42
|
+
src/
|
43
|
+
_layouts/
|
44
|
+
default.haml
|
45
|
+
_partials/
|
46
|
+
example.haml
|
47
|
+
index.haml
|
48
|
+
|
49
|
+
Preview your static website:
|
50
|
+
|
51
|
+
$ cd my-project
|
52
|
+
$ staticmatic preview
|
53
|
+
Site root is: .
|
54
|
+
StaticMatic Preview Server
|
55
|
+
Ctrl+C to exit
|
56
|
+
...
|
57
|
+
|
58
|
+
Visit http://localhost:4000 to view your website in action.
|
59
|
+
|
60
|
+
To build & convert your haml/sass/whatever files into plain html, css, and javascript:
|
61
|
+
|
62
|
+
$ staticmatic build
|
63
|
+
|
64
|
+
This will convert everything into a freshly generated `build/` folder, 100% static.
|
65
|
+
|
66
|
+
If you have an [Amazon S3 account](http://aws.amazon.com/s3/) and want to deploy to your bucket, run the following command:
|
67
|
+
|
68
|
+
# NOTE: You must be in the root folder of your project
|
69
|
+
$ staticmatic s3_deploy
|
70
|
+
|
71
|
+
If you haven't deployed your current project to Amazon yet, it will prompt you to create a config file. Edit this file to include your credentials, run the command again, and you're set.
|
72
|
+
|
73
|
+
## Super Special Awesome Quick Start Booster
|
74
|
+
|
75
|
+
Want to use a [Javascript App Starter](https://github.com/mindeavor/staticmatic-js-app-starter) or a skeleton of your own? Check this out!
|
76
|
+
|
77
|
+
$ staticmatic add js-app git://github.com/mindeavor/staticmatic-js-app-starter.git
|
78
|
+
$ staticmatic init my-new-project --skeleton=js-app
|
79
|
+
|
80
|
+
The first line stores a named reference to a repository of your choosing. You only need to do this once.
|
81
|
+
|
82
|
+
The second line clones the referenced repository into a freshly created `my-new-project` folder, as well as removes the `.git/` folder so you can do your own `git init`. Convenient!
|
83
|
+
|
84
|
+
## Special Folders
|
85
|
+
|
86
|
+
<my-project>/
|
87
|
+
src/
|
88
|
+
_helpers/
|
89
|
+
_layouts/
|
90
|
+
_partials/
|
91
|
+
|
92
|
+
- The `_helpers` folder is where you place your custom Haml helpers
|
93
|
+
|
94
|
+
- The `_layouts` folder is where layout files will be searched for. These files must contain a `yield` statement.
|
95
|
+
|
96
|
+
- The `_partials` folder is the last place partial files will be searched for. Any partial in this folder should not be prefixed with an underscore _
|
97
|
+
|
98
|
+
*USEFUL:* Any file or folder prefixed with an underscore _ will not be copied into the generated `site/` folder, nor will they be converted by haml, coffeescript, etc
|
99
|
+
|
100
|
+
## Partials
|
101
|
+
|
102
|
+
Partials are searched for in the following order:
|
103
|
+
|
104
|
+
- The file's current directory (the file must be prefixed with an underscore in this case)
|
105
|
+
- `src/_partials/`
|
106
|
+
|
107
|
+
Examples:
|
108
|
+
|
109
|
+
# Searches for the default rendering engine file type (by default, it is haml)
|
110
|
+
= partial 'sidebar'
|
111
|
+
|
112
|
+
# Equivalent to the above statement
|
113
|
+
= partial 'sidebar.haml'
|
114
|
+
|
115
|
+
# Directly inserts html file
|
116
|
+
= partial 'help-content.html'
|
117
|
+
|
118
|
+
# Use your own directory structure
|
119
|
+
= partial 'blog-content/2011/vacation.markdown'
|
120
|
+
|
121
|
+
## Anti-Cache
|
122
|
+
|
123
|
+
Force the browser to ignore its cache whenever you damn well feel like it:
|
124
|
+
|
125
|
+
# Creates a query string based on the current unix time
|
126
|
+
stylesheets :menu, :form, :qstring => true
|
127
|
+
|
128
|
+
<link href="/css/menu.css?_=1298789103" media="all" rel="stylesheet" type="text/css"/>
|
129
|
+
<link href="/css/form.css?_=1298789103" media="all" rel="stylesheet" type="text/css"/>
|
130
|
+
|
131
|
+
|
132
|
+
# Or, use your own qstring
|
133
|
+
javascripts :app, :qstring => '2.0.6'
|
134
|
+
|
135
|
+
<script language="javascript" src="js/app.js?_=2.0.6" type="text/javascript"></script>
|
136
|
+
|
137
|
+
## SSL support
|
138
|
+
|
139
|
+
To enable SSL support, add the following lines to configuration/site.rb file:
|
140
|
+
|
141
|
+
require 'webrick/https'
|
142
|
+
configuration.ssl_enable = true
|
143
|
+
configuration.ssl_private_key_path = "/path/to/key.pem"
|
144
|
+
configuration.ssl_certificate_path = "/path/to/cert.pem"
|
145
|
+
|
146
|
+
# Roadmap / TODO list
|
147
|
+
|
148
|
+
- Fix slowness of executable (built on [Thor](https://github.com/wycats/thor); maybe reconsider?)
|
149
|
+
- Create a cache that monitors what files have changed in between Amazon S3 uploads to reduce unnecessary uploads
|
150
|
+
- Integrate sprockets both for building and for previewing (probably as an option flag)
|
151
|
+
- Change rendering and yielding syntax to rails syntax
|
152
|
+
- Create a command that converts a staticmatic project to a rails project
|
153
|
+
|
154
|
+
[](http://coderwall.com/mindeavor)
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
|
12
|
+
# require 'rake'
|
13
|
+
require 'jeweler'
|
14
|
+
require 'spec/rake/spectask'
|
15
|
+
require File.expand_path("../lib/staticmatic", __FILE__)
|
16
|
+
|
17
|
+
Jeweler::Tasks.new do |gem|
|
18
|
+
gem.name = "staticmatic2"
|
19
|
+
gem.email = "gilbertbgarza@gmail.com"
|
20
|
+
gem.license = "MIT"
|
21
|
+
gem.summary = "Build Amazon S3 static websites using modern dynamic tools"
|
22
|
+
gem.homepage = "http://github.com/mindeavor/staticmatic2"
|
23
|
+
gem.executables = "staticmatic"
|
24
|
+
gem.authors = ["Stephen Bartholomew", "Gilbert B Garza"]
|
25
|
+
|
26
|
+
gem.description = <<-EOF
|
27
|
+
StaticMatic helps you quickly create maintainable Amazon S3 static websites using
|
28
|
+
tools such as Haml and Sass.
|
29
|
+
|
30
|
+
Quickly deploy to services such as Amazon S3 in a single command.
|
31
|
+
EOF
|
32
|
+
|
33
|
+
gem.rubyforge_project = "staticmatic2"
|
34
|
+
|
35
|
+
gem.files.include "[A-Z]*", "{bin,lib,spec}/**/*"
|
36
|
+
gem.files.exclude "spec/sandbox/tmp", "spec/sandbox/test_site/site/*"
|
37
|
+
end
|
38
|
+
|
39
|
+
Jeweler::RubygemsDotOrgTasks.new
|
40
|
+
|
41
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
42
|
+
spec.libs << 'lib' << 'spec'
|
43
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
44
|
+
# spec.spec_opts = ['--options', 'spec/spec.opts']
|
45
|
+
end
|
data/VERSION.yml
ADDED
data/bin/staticmatic
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'pathname'
|
4
|
+
require 'thor'
|
5
|
+
|
6
|
+
$lib_dir = Pathname.new(__FILE__).realpath.dirname.join('../lib/staticmatic').to_s
|
7
|
+
|
8
|
+
Dir[File.join $lib_dir,'deployers','*.rb'].each do |deployer|
|
9
|
+
require deployer
|
10
|
+
end
|
11
|
+
|
12
|
+
# Skeletons directly taken from Monk (https://github.com/monkrb/monk). Thanks Monk!
|
13
|
+
class StaticExe < Thor
|
14
|
+
include Thor::Actions
|
15
|
+
|
16
|
+
[:skip, :pretend, :force, :quiet].each do |task|
|
17
|
+
class_options.delete task
|
18
|
+
end
|
19
|
+
|
20
|
+
# functions related to initializing a project
|
21
|
+
|
22
|
+
desc "init", "Initialize a static directory structure"
|
23
|
+
method_option :skeleton, :type => :string, :aliases => "-s"
|
24
|
+
def init(target = ".")
|
25
|
+
clone(source(options[:skeleton] || "default") || options[:skeleton], target) ?
|
26
|
+
cleanup(target) :
|
27
|
+
say_status(:error, clone_error(target))
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "show NAME", "Display the repository address for NAME"
|
31
|
+
def show(name)
|
32
|
+
say_status name, source(name) || "repository not found"
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "list", "Lists the configured repositories"
|
36
|
+
def list
|
37
|
+
sm_config.keys.sort.each do |key|
|
38
|
+
show(key)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "add NAME REPOSITORY", "Add the repository to the configuration file"
|
43
|
+
def add(name, repository)
|
44
|
+
sm_config[name] = repository
|
45
|
+
write_sm_config_file
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "rm NAME", "Remove the repository from the configuration file"
|
49
|
+
def rm(name)
|
50
|
+
sm_config.delete(name)
|
51
|
+
write_sm_config_file
|
52
|
+
end
|
53
|
+
|
54
|
+
# Previewing and building an existing project
|
55
|
+
|
56
|
+
desc "preview DIRECTORY", "Start a web server to preview your project"
|
57
|
+
def preview(directory = '.')
|
58
|
+
say 'Launching preview server...', :cyan
|
59
|
+
require $lib_dir
|
60
|
+
staticmatic = StaticMatic::Base.new(directory)
|
61
|
+
$:.push File.join(directory, "lib")
|
62
|
+
staticmatic.run('preview')
|
63
|
+
end
|
64
|
+
|
65
|
+
desc "build DIRECTORY", "Build your project into a freshly generated build/ folder"
|
66
|
+
def build(directory = '.')
|
67
|
+
say 'Building website...', :cyan
|
68
|
+
require $lib_dir
|
69
|
+
staticmatic = StaticMatic::Base.new(directory, :build)
|
70
|
+
$:.push File.join(directory, "lib")
|
71
|
+
staticmatic.run('build')
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def lib_path(*paths)
|
77
|
+
File.join(File.dirname(__FILE__) + '/../lib/staticmatic', *paths)
|
78
|
+
end
|
79
|
+
|
80
|
+
def site_path(directory,*paths)
|
81
|
+
File.join(directory, 'build', *paths)
|
82
|
+
end
|
83
|
+
|
84
|
+
def build_files(directory)
|
85
|
+
Dir[site_path(directory,'**/*')].reject {|file| File.directory? file}
|
86
|
+
end
|
87
|
+
|
88
|
+
def clone(source, target)
|
89
|
+
if Dir["#{target}/*"].empty?
|
90
|
+
say_status :fetching, source
|
91
|
+
system "git clone -q --depth 1 #{source} #{target}"
|
92
|
+
$?.success?
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def cleanup(target)
|
97
|
+
inside(target) { remove_file ".git" }
|
98
|
+
say_status :initialized, target
|
99
|
+
end
|
100
|
+
|
101
|
+
def source(name = "default")
|
102
|
+
sm_config[name]
|
103
|
+
end
|
104
|
+
|
105
|
+
def sm_config_file
|
106
|
+
@sm_config_file ||= File.join(sm_home, ".staticmatic")
|
107
|
+
end
|
108
|
+
|
109
|
+
def sm_config
|
110
|
+
@sm_config ||= begin
|
111
|
+
write_sm_config_file unless File.exists?(sm_config_file)
|
112
|
+
YAML.load_file(sm_config_file)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def write_sm_config_file
|
117
|
+
remove_file(sm_config_file, :verbose => false)
|
118
|
+
create_file(sm_config_file, nil, :verbose => false) do
|
119
|
+
config = @sm_config || { "default" => "git://github.com/mindeavor/staticmatic-basic.git" }
|
120
|
+
config.to_yaml
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def self.source_root
|
125
|
+
"."
|
126
|
+
end
|
127
|
+
|
128
|
+
def clone_error(target)
|
129
|
+
"Couldn't clone repository into target directory '#{target}'. " +
|
130
|
+
"You must have git installed and the target directory must be empty."
|
131
|
+
end
|
132
|
+
|
133
|
+
def sm_home
|
134
|
+
ENV["STATICMATIC_HOME"] || File.join(Thor::Util.user_home)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
if File.exists?("Thorfile")
|
139
|
+
load("Thorfile")
|
140
|
+
end
|
141
|
+
|
142
|
+
StaticExe.start
|
data/lib/staticmatic.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'compass'
|
3
|
+
require 'haml'
|
4
|
+
require 'sass'
|
5
|
+
require 'sass/plugin'
|
6
|
+
require 'tilt'
|
7
|
+
require 'rack'
|
8
|
+
require 'rack/handler/webrick'
|
9
|
+
require 'cgi'
|
10
|
+
require 'fileutils'
|
11
|
+
|
12
|
+
|
13
|
+
module StaticMatic
|
14
|
+
end
|
15
|
+
|
16
|
+
["render", "build", "setup", "server", "helpers", "rescue"].each do |mixin|
|
17
|
+
require File.join(File.dirname(__FILE__), "staticmatic", "mixins", mixin)
|
18
|
+
end
|
19
|
+
|
20
|
+
["base", "configuration", "error", "server", "helpers", "template_error", "ambiguous_template_error", "compass"].each do |lib|
|
21
|
+
require File.join(File.dirname(__FILE__), "staticmatic", lib)
|
22
|
+
end
|