staticise 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -22,22 +22,22 @@ GEM
22
22
  lumberjack (>= 1.0.2)
23
23
  pry (>= 0.9.10)
24
24
  thor (>= 0.14.6)
25
- guard-coffeescript (1.3.0)
25
+ guard-coffeescript (1.3.1)
26
26
  coffee-script (>= 2.2.0)
27
27
  guard (>= 1.1.0)
28
28
  guard-sass (1.2.0)
29
29
  guard (>= 1.1.0)
30
30
  sass (>= 3.1)
31
- haml (4.0.2)
31
+ haml (4.0.3)
32
32
  tilt
33
- highline (1.6.18)
33
+ highline (1.6.19)
34
34
  i18n (0.6.1)
35
35
  jeweler (1.8.4)
36
36
  bundler (~> 1.0)
37
37
  git (>= 1.2.5)
38
38
  rake
39
39
  rdoc
40
- json (1.7.7)
40
+ json (1.8.0)
41
41
  listen (1.1.3)
42
42
  rb-fsevent (>= 0.9.3)
43
43
  rb-inotify (>= 0.9)
@@ -61,7 +61,7 @@ GEM
61
61
  shoulda (3.5.0)
62
62
  shoulda-context (~> 1.0, >= 1.0.1)
63
63
  shoulda-matchers (>= 1.4.1, < 3.0)
64
- shoulda-context (1.1.1)
64
+ shoulda-context (1.1.2)
65
65
  shoulda-matchers (2.1.0)
66
66
  activesupport (>= 3.0.0)
67
67
  slop (3.4.5)
data/README.rdoc CHANGED
@@ -41,7 +41,7 @@ Then from your project root run:
41
41
 
42
42
  bundle install
43
43
  staticise init
44
- staticise watch
44
+ staticise
45
45
 
46
46
  And done, you can now start creating your static website using the power of dynamic libraries. Check the sample app here for more info https://github.com/melvinsembrano/staticise-sample
47
47
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
data/app/pages/help.html CHANGED
@@ -1,5 +1,6 @@
1
1
  <h1>
2
2
  I am a help page
3
+
3
4
  </h1>
4
5
  <p>Hello world . com</p>
5
6
  melvin
data/bin/staticise CHANGED
@@ -1,55 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
- require 'commander/import'
5
-
6
4
  $:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
7
5
  require 'staticise'
8
6
 
7
+ # require 'guard'
8
+ # require 'guard/cli'
9
+ # Guard::CLI.start
9
10
 
10
- program :name, 'staticise'
11
- program :version, '0.0.1'
12
- program :description, 'Static site generator using Haml and Coffeescript'
13
-
14
- default_command :build
15
-
16
- command :build do |c|
17
- c.syntax = 'staticise build'
18
- c.summary = 'Build all pages, js and css'
19
- c.description = 'Build all pages, js and css'
20
- c.example 'description', 'command example'
21
- c.option '--some-switch', 'Some switch that does something'
22
- c.action do |args, options|
23
- Staticise::Renderer.all
24
- end
25
- end
26
-
27
- command :init do |c|
28
- c.syntax = 'staticise init'
29
- c.summary = 'Initialize app, create initial folder structure'
30
- c.action do |args, options|
31
- Staticise::Renderer.init
32
- end
33
- end
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
- `guard start -w #{ APP_ROOT }`
45
- =begin
46
- Staticise::Renderer.all
47
-
48
- watcher = Staticise::Watcher.new(options)
49
- watcher.start
50
- =end
51
-
52
- end
53
- end
54
-
11
+ Staticise::CLI.start
55
12
 
@@ -10,7 +10,7 @@ module Guard
10
10
 
11
11
  DEFAULT_OPTIONS = {
12
12
  :output => 'public',
13
- :input => 'app/pages',
13
+ :input => 'app',
14
14
  :all_on_start => true
15
15
  }
16
16
 
@@ -18,11 +18,11 @@ module Guard
18
18
  watchers = [] if !watchers
19
19
  ::Guard::UI.info("staticise watcher #{ watchers }")
20
20
 
21
- defaults = DEFAULT_OPTIONS.clone
21
+ defaults = DEFAULT_OPTIONS.clone.merge(options)
22
22
 
23
23
  watchers << ::Guard::Watcher.new(%r{^#{ defaults[:input] }/(.+\.h[ta]ml)$})
24
24
 
25
- super(watchers, defaults.merge(options))
25
+ super(watchers, defaults)
26
26
  end
27
27
 
28
28
  def start
@@ -50,9 +50,14 @@ module Guard
50
50
  end
51
51
 
52
52
  def run_on_changes(paths)
53
+ puts paths.join(", ")
53
54
  begin
54
55
  paths.each do |f|
55
- ::Staticise::Renderer.new(f).export
56
+ if File.basename(f).start_with?("_") || f.index("layouts")
57
+ ::Staticise::Renderer.all
58
+ else
59
+ ::Staticise::Renderer.new(f).export
60
+ end
56
61
  end
57
62
  rescue Exception => e
58
63
  message = "Error compiling #{ paths.join(", ")}: #{ e.message }"
@@ -0,0 +1,54 @@
1
+ require 'guard'
2
+ require 'guard/cli'
3
+ require 'guard/staticise'
4
+
5
+ module Staticise
6
+ class CLI < ::Guard::CLI
7
+
8
+ desc 'init [GUARDS]', 'Generates a Guardfile at the current directory (if it is not already there) and adds all installed guards or the given GUARDS into it'
9
+
10
+ method_option :bare,
11
+ :type => :boolean,
12
+ :default => false,
13
+ :aliases => '-b',
14
+ :banner => 'Generate a bare Guardfile without adding any installed guard into it'
15
+
16
+ # Initializes the templates of all installed Guard plugins and adds them
17
+ # to the `Guardfile` when no Guard name is passed. When passing
18
+ # Guard plugin names it does the same but only for those Guard plugins.
19
+ #
20
+ # @see Guard::Guard.initialize_template
21
+ # @see Guard::Guard.initialize_all_templates
22
+ #
23
+ # @param [Array<String>] guard_names the name of the Guard plugins to initialize
24
+ #
25
+ def init(*guard_names)
26
+ puts "initializing..."
27
+
28
+ verify_bundler_presence
29
+
30
+ ::Guard::Guardfile.create_guardfile(:abort_on_existence => options[:bare])
31
+
32
+ return if options[:bare]
33
+
34
+ File.open('Guardfile', 'wb') do |f|
35
+
36
+ f.puts("guard 'coffeescript', :input => 'app/js', :output => 'public/js'")
37
+ f.puts("guard 'sass', :input => 'app/css', :output => 'public/css'")
38
+ f.puts("guard 'staticise', :input => 'app', :output => 'public'")
39
+
40
+ end
41
+
42
+ =begin
43
+ if guard_names.empty?
44
+ ::Guard::Guardfile.initialize_all_templates
45
+ else
46
+ guard_names.each do |guard_name|
47
+ ::Guard::Guardfile.initialize_template(guard_name)
48
+ end
49
+ end
50
+ =end
51
+
52
+ end
53
+ end
54
+ end
data/lib/staticise.rb CHANGED
@@ -9,4 +9,5 @@ LIB_ROOT = File.expand_path(File.dirname(__FILE__) + "../../")
9
9
 
10
10
  require 'staticise/renderer'
11
11
  require 'staticise/watcher'
12
+ require 'staticise/cli'
12
13
 
data/public/help.html CHANGED
@@ -44,6 +44,7 @@
44
44
 
45
45
  <h1>
46
46
  I am a help page
47
+
47
48
  </h1>
48
49
  <p>Hello world . com</p>
49
50
  melvin
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.6.0"
8
+ s.version = "0.6.1"
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-23"
12
+ s.date = "2013-05-24"
13
13
  s.description = "Static site generator using Haml and Coffescript"
14
14
  s.email = "melvinsembrano@gmail.com"
15
15
  s.executables = ["staticise"]
@@ -46,6 +46,7 @@ Gem::Specification.new do |s|
46
46
  "lib/guard/staticise.rb",
47
47
  "lib/guard/staticise/notifier.rb",
48
48
  "lib/staticise.rb",
49
+ "lib/staticise/cli.rb",
49
50
  "lib/staticise/renderer.rb",
50
51
  "lib/staticise/watcher.rb",
51
52
  "public/cat/index.html",
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.6.0
4
+ version: 0.6.1
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-23 00:00:00.000000000 Z
12
+ date: 2013-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml
@@ -240,6 +240,7 @@ files:
240
240
  - lib/guard/staticise.rb
241
241
  - lib/guard/staticise/notifier.rb
242
242
  - lib/staticise.rb
243
+ - lib/staticise/cli.rb
243
244
  - lib/staticise/renderer.rb
244
245
  - lib/staticise/watcher.rb
245
246
  - public/cat/index.html
@@ -271,7 +272,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
272
  version: '0'
272
273
  segments:
273
274
  - 0
274
- hash: 152934586633056435
275
+ hash: 3461378662497283009
275
276
  required_rubygems_version: !ruby/object:Gem::Requirement
276
277
  none: false
277
278
  requirements: