guard-staticmatic 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in guard-staticmatic.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Miha Rebernik
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Guard::Staticmatic
2
+
3
+ Use this gem to monitor a staticmatic directory and run staticmatic build on it when files change.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'guard-staticmatic'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install guard-staticmatic
18
+
19
+ ## Usage
20
+
21
+ Add a sample guard instruction to your Guardfile with:
22
+
23
+ $ bundle exec guard init staticmatic
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
32
+
33
+ ## Author
34
+
35
+ Miha Rebernik <miha@rebernik.info>
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ # require 'guard-staticmatic/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "guard-staticmatic"
8
+ gem.version = "0.0.1"
9
+ gem.authors = ["Miha Rebernik"]
10
+ gem.email = ["miha@rebernik.info"]
11
+ gem.description = "Watches for changes in a staticmatic directory and fires build when they happen."
12
+ gem.summary = "Guard plugin for compiling staticmatic websites."
13
+ gem.homepage = "https://github.com/mihar/guard-staticmatic"
14
+
15
+ gem.add_dependency 'guard', '>= 1.5.0'
16
+ gem.add_dependency 'staticmatic', '~> 0.11.1'
17
+ # You should beware that staticmatic is not compatible with 0.12 series of compass.
18
+ # gem.add_dependency 'compass', '0.11.7'
19
+
20
+ gem.files = `git ls-files`.split($/)
21
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
22
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
23
+ gem.require_paths = ["lib"]
24
+ end
@@ -0,0 +1,72 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+
4
+ module Guard
5
+ class Staticmatic < Guard
6
+
7
+ # Initialize a Guard.
8
+ # @param [Array<Guard::Watcher>] watchers the Guard file watchers
9
+ # @param [Hash] options the custom Guard options
10
+ def initialize(watchers = [], options = {})
11
+ super watchers, options
12
+ @options = {
13
+ :bundler => File.exist?("#{Dir.pwd}/Gemfile")
14
+ }.merge(options)
15
+ end
16
+
17
+ # Call once when Guard starts. Please override initialize method to init stuff.
18
+ # @raise [:task_has_failed] when start has failed
19
+ def start
20
+ true
21
+ end
22
+
23
+ # Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
24
+ # @raise [:task_has_failed] when stop has failed
25
+ def stop
26
+ true
27
+ end
28
+
29
+ # Called when `reload|r|z + enter` is pressed.
30
+ # This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
31
+ # @raise [:task_has_failed] when reload has failed
32
+ def reload
33
+ true
34
+ end
35
+
36
+ # Called when just `enter` is pressed
37
+ # This method should be principally used for long action like running all specs/tests/...
38
+ # @raise [:task_has_failed] when run_all has failed
39
+ def run_all
40
+ system build_command
41
+ end
42
+
43
+ # Called on file(s) modifications that the Guard watches.
44
+ # @param [Array<String>] paths the changes files or paths
45
+ # @raise [:task_has_failed] when run_on_change has failed
46
+ def run_on_changes(paths)
47
+ system build_command
48
+ end
49
+
50
+ # Called on file(s) deletions that the Guard watches.
51
+ # @param [Array<String>] paths the deleted files or paths
52
+ # @raise [:task_has_failed] when run_on_change has failed
53
+ def run_on_removals(paths)
54
+ true
55
+ end
56
+
57
+ private
58
+
59
+ def build_command
60
+ staticmatic_root = if @options[:input]
61
+ @options[:input]
62
+ else
63
+ '.'
64
+ end
65
+
66
+ cmds = []
67
+ cmds << "bundle exec" if @options[:bundler]
68
+ cmds << "staticmatic build #{staticmatic_root}"
69
+ cmds.join(" ")
70
+ end
71
+ end
72
+ end
Binary file
@@ -0,0 +1,5 @@
1
+ guard 'staticmatic' do #, :input => "..." do
2
+ watch(%r{^config/.*})
3
+ watch(%r{^src/.*})
4
+ watch(%r{^site/.*})
5
+ end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module Staticmatic
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-staticmatic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Miha Rebernik
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: guard
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.5.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.5.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: staticmatic
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.11.1
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.11.1
46
+ description: Watches for changes in a staticmatic directory and fires build when they
47
+ happen.
48
+ email:
49
+ - miha@rebernik.info
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - LICENSE.txt
57
+ - README.md
58
+ - Rakefile
59
+ - guard-staticmatic.gemspec
60
+ - lib/guard/staticmatic.rb
61
+ - lib/guard/staticmatic/.DS_Store
62
+ - lib/guard/staticmatic/templates/Guardfile
63
+ - lib/guard/staticmatic/version.rb
64
+ homepage: https://github.com/mihar/guard-staticmatic
65
+ licenses: []
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 1.8.21
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Guard plugin for compiling staticmatic websites.
88
+ test_files: []