staticise 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,8 +1,10 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'haml'
4
+ gem 'sass'
4
5
  gem 'coffee-script'
5
6
  gem 'commander'
7
+ gem 'listen'
6
8
 
7
9
  # Add dependencies to develop your gem here.
8
10
  # Include everything needed to run rake, tests, features, etc.
data/Gemfile.lock CHANGED
@@ -12,6 +12,7 @@ GEM
12
12
  highline (~> 1.6.11)
13
13
  execjs (1.4.0)
14
14
  multi_json (~> 1.0)
15
+ ffi (1.8.1)
15
16
  git (1.2.5)
16
17
  haml (4.0.2)
17
18
  tilt
@@ -23,10 +24,20 @@ GEM
23
24
  rake
24
25
  rdoc
25
26
  json (1.7.7)
27
+ listen (1.1.3)
28
+ rb-fsevent (>= 0.9.3)
29
+ rb-inotify (>= 0.9)
30
+ rb-kqueue (>= 0.2)
26
31
  multi_json (1.7.3)
27
32
  rake (10.0.4)
33
+ rb-fsevent (0.9.3)
34
+ rb-inotify (0.9.0)
35
+ ffi (>= 0.5.0)
36
+ rb-kqueue (0.2.0)
37
+ ffi (>= 0.5.0)
28
38
  rdoc (4.0.1)
29
39
  json (~> 1.4)
40
+ sass (3.2.9)
30
41
  shoulda (3.5.0)
31
42
  shoulda-context (~> 1.0, >= 1.0.1)
32
43
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -44,5 +55,7 @@ DEPENDENCIES
44
55
  commander
45
56
  haml
46
57
  jeweler
58
+ listen
47
59
  rdoc
60
+ sass
48
61
  shoulda
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.8
1
+ 0.5.9
data/app/css/st.sass ADDED
File without changes
data/app/css/test.sass ADDED
@@ -0,0 +1,3 @@
1
+ .test
2
+ font-size: 3px
3
+
@@ -1 +1,2 @@
1
1
  %h1 this is a footer
2
+ %p tst
@@ -0,0 +1,3 @@
1
+ <h1>
2
+ I am a Footer with pure html
3
+ </h1>
@@ -0,0 +1,4 @@
1
+ <h1>
2
+ I am a help page
3
+ </h1>
4
+ <p>Hello world . com</p>
data/app/pages/index.haml CHANGED
@@ -2,4 +2,7 @@
2
2
  %p
3
3
  Hello world, hello world...
4
4
 
5
- = partial "footer"
5
+ %h5 Footer with haml partial
6
+ = partial "footer.haml"
7
+ %h5 Footer with Html partial
8
+ = partial "footer.html"
data/app/pages/t.haml ADDED
@@ -0,0 +1 @@
1
+ melvin
data/bin/staticise CHANGED
@@ -32,4 +32,20 @@ command :init do |c|
32
32
  end
33
33
  end
34
34
 
35
+ command :watch do |c|
36
+ c.syntax = 'staticise watch [options]'
37
+ c.summary = 'Start staticise watcher'
38
+ c.option '--no-sass', 'do not include sass files'
39
+ c.option '--no-less', 'do not include less files'
40
+ c.option '--no-haml', 'do not include haml files'
41
+ c.option '--no-coffee', 'do not include coffee files'
42
+
43
+ c.action do |args, options|
44
+ Staticise::Renderer.all
45
+
46
+ watcher = Staticise::Watcher.new(options)
47
+ watcher.start
48
+ end
49
+ end
50
+
35
51
 
@@ -10,18 +10,18 @@ module Staticise
10
10
  end
11
11
 
12
12
  def render_page
13
- Haml::Engine.new(File.read(@layout)).render(self) do
14
- Haml::Engine.new(File.read(@file)).render(self)
13
+ Haml::Engine.new(read_template(@layout)).render(self) do
14
+ Haml::Engine.new(read_template(@file)).render(self)
15
15
  end
16
16
  end
17
17
 
18
18
  def partial(file, locals = {})
19
19
  if file.split("/").length > 1
20
- path = File.join(APP_ROOT, 'app', 'pages', "_#{ file.to_s }.haml")
20
+ path = File.join(APP_ROOT, 'app', 'pages', "_#{ file.to_s }")
21
21
  else
22
- path = File.join(File.dirname(@file), "_#{ file.to_s }.haml")
22
+ path = File.join(File.dirname(@file), "_#{ file.to_s }")
23
23
  end
24
- Haml::Engine.new(File.read(path)).render(self, locals)
24
+ Haml::Engine.new(read_template(path)).render(self, locals)
25
25
  end
26
26
 
27
27
  def export
@@ -56,7 +56,8 @@ module Staticise
56
56
  def self.pages
57
57
  puts "Compiling pages.."
58
58
  files = Dir.glob(File.join(APP_ROOT, 'app/pages/**/*.haml'))
59
- files.each do |f|
59
+ files << Dir.glob(File.join(APP_ROOT, 'app/pages/**/*.html'))
60
+ files.flatten.each do |f|
60
61
  self.new(f).export unless File.basename(f).start_with?("_")
61
62
  end
62
63
  return
@@ -87,6 +88,18 @@ module Staticise
87
88
 
88
89
  private
89
90
 
91
+ def read_template(file)
92
+ if File.extname(file).eql?(".html")
93
+ s = [":preserve\n"]
94
+ s << File.readlines(file).map {|l| " #{ l }"}
95
+ res = s.flatten.join
96
+ else
97
+ res = File.read(file)
98
+ end
99
+ # puts res
100
+ res
101
+ end
102
+
90
103
  def extract(file)
91
104
  @layout = File.join(APP_ROOT, "app", "layouts", "app.haml")
92
105
  @file = file
@@ -0,0 +1,63 @@
1
+ require 'fileutils'
2
+ require 'listen'
3
+
4
+ module Staticise
5
+
6
+ class Watcher
7
+ attr_accessor :no_sass, :no_less, :no_haml, :no_coffee
8
+
9
+ def initialize(options)
10
+ @no_sass = !options.no_sass.nil?
11
+ @no_less = !options.no_less.nil?
12
+ @no_haml = !options.no_haml.nil?
13
+ @no_coffee = !options.no_coffee.nil?
14
+
15
+ puts "listening now with #{ self.inspect }"
16
+
17
+ @listener = Listen.to!(File.join(APP_ROOT, 'app')) do |modified, added, removed|
18
+ process(modified)
19
+ end
20
+ end
21
+
22
+ def process(file)
23
+ if file.class.eql?(Array)
24
+ file.each {|f| process(f)}
25
+ return
26
+ end
27
+
28
+ ext = File.extname(file.to_s).downcase
29
+
30
+ case ext
31
+ when ".sass"
32
+ sass(file) unless @no_sass
33
+ when ".less"
34
+ less(file) unless @no_less
35
+ when ".haml"
36
+ haml(file) unless @no_haml
37
+ when ".coffee"
38
+ coffee(file) unless @no_coffee
39
+ else
40
+
41
+ end
42
+ end
43
+
44
+ def haml(file)
45
+ Staticise::Renderer.pages
46
+ end
47
+
48
+ def less(file)
49
+ Staticise::Renderer.styles
50
+ end
51
+
52
+ def sass(file)
53
+ puts "processing #{ file }"
54
+ ext = '.sass'
55
+ FileUtils.mkdir_p(File.join(APP_ROOT, "public", "css")) unless File.exist?(File.join(APP_ROOT, "public", "css"))
56
+ `sass #{ File.join(APP_ROOT, 'app', file) }:#{ File.join(APP_ROOT, 'public', File.dirname(file), "#{ File.basename(file, ext) }.css") }`
57
+ end
58
+
59
+ def coffee(file)
60
+ Staticise::Renderer.scripts
61
+ end
62
+ end
63
+ end
data/lib/staticise.rb CHANGED
@@ -7,4 +7,5 @@ require 'haml'
7
7
  APP_ROOT = "." #File.expand_path(File.dirname(__FILE__) + "../../")
8
8
 
9
9
  require 'staticise/renderer'
10
+ require 'staticise/watcher'
10
11
 
data/public/help.html ADDED
@@ -0,0 +1,59 @@
1
+ <!DOCTYPE html>
2
+ <html lang='en'>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <meta content='IE=Edge,chrome=1' http-equiv='X-UA-Compatible'>
6
+ <meta content='width=device-width, initial-scale=1.0' name='viewport'>
7
+ <title></title>
8
+
9
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
10
+ <!--[if lt IE 9]>
11
+
12
+ <![endif]-->
13
+
14
+ <link href='images/apple-touch-icon-144x144.png' rel='apple-touch-icon-precomposed' sizes='144x144'>
15
+ <link href='images/apple-touch-icon-114x114.png' rel='apple-touch-icon-precomposed' sizes='114x114'>
16
+ <link href='images/apple-touch-icon-72x72.png' rel='apple-touch-icon-precomposed' sizes='72x72'>
17
+ <link href='images/apple-touch-icon.png' rel='apple-touch-icon-precomposed'>
18
+ <link href='favicon.ico' rel='shortcut icon'>
19
+ </head>
20
+ <body>
21
+ <div class='navbar navbar-fixed-top'>
22
+ <div class='navbar-inner'>
23
+ <div class='container'>
24
+ <a class='btn btn-navbar' data-target='.nav-collapse' data-toggle='collapse'>
25
+ <span class='icon-bar'></span>
26
+ <span class='icon-bar'></span>
27
+ <span class='icon-bar'></span>
28
+ </a>
29
+ <a class='brand' href='/' title='Im sick of damn excel sheet'>isodes</a>
30
+ <div class='container nav-collapse'>
31
+ <ul class='nav'>
32
+ <li></li>
33
+ <li></li>
34
+ <li></li>
35
+ <li></li>
36
+ </ul>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ <div class='container content-panel'>
42
+ <div class='row'>
43
+ <div class='span12'>
44
+
45
+ <h1>&#x000A; I am a help page&#x000A;</h1>&#x000A;<p>Hello world . com</p>
46
+ </div>
47
+ </div>
48
+ <footer>
49
+ <p>&copy; melvinsembrano@gmail.com 2013</p>
50
+ </footer>
51
+ </div>
52
+ <!--
53
+ Javascripts
54
+ ==================================================
55
+ -->
56
+ <!-- Placed at the end of the document so the pages load faster -->
57
+
58
+ </body>
59
+ </html>
data/public/index.html CHANGED
@@ -46,7 +46,11 @@
46
46
  <p>
47
47
  Hello world, hello world...
48
48
  </p>
49
+ <h5>Footer with haml partial</h5>
49
50
  <h1>this is a footer</h1>
51
+ <p>tst</p>
52
+ <h5>Footer with Html partial</h5>
53
+ <h1>&#x000A; I am a Footer with pure html&#x000A;</h1>
50
54
  </div>
51
55
  </div>
52
56
  <footer>
data/public/t.html ADDED
@@ -0,0 +1,59 @@
1
+ <!DOCTYPE html>
2
+ <html lang='en'>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <meta content='IE=Edge,chrome=1' http-equiv='X-UA-Compatible'>
6
+ <meta content='width=device-width, initial-scale=1.0' name='viewport'>
7
+ <title></title>
8
+
9
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
10
+ <!--[if lt IE 9]>
11
+
12
+ <![endif]-->
13
+
14
+ <link href='images/apple-touch-icon-144x144.png' rel='apple-touch-icon-precomposed' sizes='144x144'>
15
+ <link href='images/apple-touch-icon-114x114.png' rel='apple-touch-icon-precomposed' sizes='114x114'>
16
+ <link href='images/apple-touch-icon-72x72.png' rel='apple-touch-icon-precomposed' sizes='72x72'>
17
+ <link href='images/apple-touch-icon.png' rel='apple-touch-icon-precomposed'>
18
+ <link href='favicon.ico' rel='shortcut icon'>
19
+ </head>
20
+ <body>
21
+ <div class='navbar navbar-fixed-top'>
22
+ <div class='navbar-inner'>
23
+ <div class='container'>
24
+ <a class='btn btn-navbar' data-target='.nav-collapse' data-toggle='collapse'>
25
+ <span class='icon-bar'></span>
26
+ <span class='icon-bar'></span>
27
+ <span class='icon-bar'></span>
28
+ </a>
29
+ <a class='brand' href='/' title='Im sick of damn excel sheet'>isodes</a>
30
+ <div class='container nav-collapse'>
31
+ <ul class='nav'>
32
+ <li></li>
33
+ <li></li>
34
+ <li></li>
35
+ <li></li>
36
+ </ul>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ <div class='container content-panel'>
42
+ <div class='row'>
43
+ <div class='span12'>
44
+
45
+ melvin
46
+ </div>
47
+ </div>
48
+ <footer>
49
+ <p>&copy; melvinsembrano@gmail.com 2013</p>
50
+ </footer>
51
+ </div>
52
+ <!--
53
+ Javascripts
54
+ ==================================================
55
+ -->
56
+ <!-- Placed at the end of the document so the pages load faster -->
57
+
58
+ </body>
59
+ </html>
data/staticise.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "staticise"
8
- s.version = "0.5.8"
8
+ s.version = "0.5.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Melvin Sembrano"]
12
- s.date = "2013-05-16"
12
+ s.date = "2013-05-22"
13
13
  s.description = "Static site generator using Haml and Coffescript"
14
14
  s.email = "melvinsembrano@gmail.com"
15
15
  s.executables = ["staticise"]
@@ -26,26 +26,34 @@ Gem::Specification.new do |s|
26
26
  "README.rdoc",
27
27
  "Rakefile",
28
28
  "VERSION",
29
+ "app/css/st.sass",
29
30
  "app/css/test.less",
31
+ "app/css/test.sass",
30
32
  "app/js/main.coffee",
31
33
  "app/js/plugins/a.coffee",
32
34
  "app/layouts/app.haml",
33
35
  "app/pages/_footer.haml",
36
+ "app/pages/_footer.html",
34
37
  "app/pages/cat/index.haml",
35
38
  "app/pages/dog/index.haml",
39
+ "app/pages/help.html",
36
40
  "app/pages/index.haml",
37
41
  "app/pages/lion/index.haml",
42
+ "app/pages/t.haml",
38
43
  "bin/staticise",
39
44
  "lib/staticise.rb",
40
45
  "lib/staticise/renderer.rb",
46
+ "lib/staticise/watcher.rb",
41
47
  "public/cat/index.html",
42
48
  "public/css/test.css",
43
49
  "public/dog/index.html",
50
+ "public/help.html",
44
51
  "public/index.html",
45
52
  "public/js/app.js",
46
53
  "public/js/main.js",
47
54
  "public/js/plugins/a.js",
48
55
  "public/lion/index.html",
56
+ "public/t.html",
49
57
  "staticise.gemspec",
50
58
  "test/helper.rb",
51
59
  "test/test_staticise.rb"
@@ -61,16 +69,20 @@ Gem::Specification.new do |s|
61
69
 
62
70
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
63
71
  s.add_runtime_dependency(%q<haml>, [">= 0"])
72
+ s.add_runtime_dependency(%q<sass>, [">= 0"])
64
73
  s.add_runtime_dependency(%q<coffee-script>, [">= 0"])
65
74
  s.add_runtime_dependency(%q<commander>, [">= 0"])
75
+ s.add_runtime_dependency(%q<listen>, [">= 0"])
66
76
  s.add_development_dependency(%q<shoulda>, [">= 0"])
67
77
  s.add_development_dependency(%q<rdoc>, [">= 0"])
68
78
  s.add_development_dependency(%q<bundler>, [">= 0"])
69
79
  s.add_development_dependency(%q<jeweler>, [">= 0"])
70
80
  else
71
81
  s.add_dependency(%q<haml>, [">= 0"])
82
+ s.add_dependency(%q<sass>, [">= 0"])
72
83
  s.add_dependency(%q<coffee-script>, [">= 0"])
73
84
  s.add_dependency(%q<commander>, [">= 0"])
85
+ s.add_dependency(%q<listen>, [">= 0"])
74
86
  s.add_dependency(%q<shoulda>, [">= 0"])
75
87
  s.add_dependency(%q<rdoc>, [">= 0"])
76
88
  s.add_dependency(%q<bundler>, [">= 0"])
@@ -78,8 +90,10 @@ Gem::Specification.new do |s|
78
90
  end
79
91
  else
80
92
  s.add_dependency(%q<haml>, [">= 0"])
93
+ s.add_dependency(%q<sass>, [">= 0"])
81
94
  s.add_dependency(%q<coffee-script>, [">= 0"])
82
95
  s.add_dependency(%q<commander>, [">= 0"])
96
+ s.add_dependency(%q<listen>, [">= 0"])
83
97
  s.add_dependency(%q<shoulda>, [">= 0"])
84
98
  s.add_dependency(%q<rdoc>, [">= 0"])
85
99
  s.add_dependency(%q<bundler>, [">= 0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: staticise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-16 00:00:00.000000000 Z
12
+ date: 2013-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: sass
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: coffee-script
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +75,22 @@ dependencies:
59
75
  - - ! '>='
60
76
  - !ruby/object:Gem::Version
61
77
  version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: listen
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
62
94
  - !ruby/object:Gem::Dependency
63
95
  name: shoulda
64
96
  requirement: !ruby/object:Gem::Requirement
@@ -140,26 +172,34 @@ files:
140
172
  - README.rdoc
141
173
  - Rakefile
142
174
  - VERSION
175
+ - app/css/st.sass
143
176
  - app/css/test.less
177
+ - app/css/test.sass
144
178
  - app/js/main.coffee
145
179
  - app/js/plugins/a.coffee
146
180
  - app/layouts/app.haml
147
181
  - app/pages/_footer.haml
182
+ - app/pages/_footer.html
148
183
  - app/pages/cat/index.haml
149
184
  - app/pages/dog/index.haml
185
+ - app/pages/help.html
150
186
  - app/pages/index.haml
151
187
  - app/pages/lion/index.haml
188
+ - app/pages/t.haml
152
189
  - bin/staticise
153
190
  - lib/staticise.rb
154
191
  - lib/staticise/renderer.rb
192
+ - lib/staticise/watcher.rb
155
193
  - public/cat/index.html
156
194
  - public/css/test.css
157
195
  - public/dog/index.html
196
+ - public/help.html
158
197
  - public/index.html
159
198
  - public/js/app.js
160
199
  - public/js/main.js
161
200
  - public/js/plugins/a.js
162
201
  - public/lion/index.html
202
+ - public/t.html
163
203
  - staticise.gemspec
164
204
  - test/helper.rb
165
205
  - test/test_staticise.rb
@@ -178,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
218
  version: '0'
179
219
  segments:
180
220
  - 0
181
- hash: -2632539740084124357
221
+ hash: 3417070075809130016
182
222
  required_rubygems_version: !ruby/object:Gem::Requirement
183
223
  none: false
184
224
  requirements: