guard-tay 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +27 -0
- data/Rakefile +2 -0
- data/guard-tay.gemspec +22 -0
- data/lib/guard/tay/templates/Guardfile +7 -0
- data/lib/guard/tay/version.rb +5 -0
- data/lib/guard/tay.rb +64 -0
- metadata +108 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Thomas Rix
|
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,27 @@
|
|
1
|
+
# Guard::Tay
|
2
|
+
|
3
|
+
Lets you configure a Guard that will run [Tay](https://github.com/rixth/tay) whenever a change is detected in your extension's source.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add `gem guard-tay` to your Gemfile and run `bundle install`
|
8
|
+
|
9
|
+
## Guardfile
|
10
|
+
|
11
|
+
You can adapt your Guardfiles like you want. Please read the [Guard docs](http://github.com/guard/guard) for more info about Guardfile DSL. Only two options are supported at this stage, `:build_directory` (the subdirectory to build to) and `:tayfile` (the name of the Tayfile you want to use). The defaults are shown below.
|
12
|
+
|
13
|
+
guard :tay, :build_directory => 'build', :tayfile => 'Tayfile' do
|
14
|
+
watch(%r{^Tayfile$})
|
15
|
+
watch(%r{^lib/.+$})
|
16
|
+
watch(%r{^src/.+$})
|
17
|
+
watch(%r{^vendor/.+$})
|
18
|
+
watch(%r{^browser_modules/.+$})
|
19
|
+
end
|
20
|
+
|
21
|
+
## Contributing
|
22
|
+
|
23
|
+
1. Fork it
|
24
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
25
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
26
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
27
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/guard-tay.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/guard/tay/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Thomas Rix"]
|
6
|
+
gem.email = ["tom@rixth.org"]
|
7
|
+
gem.description = %q{Guard::Tay automatically recompiles your tay-based extensions on change}
|
8
|
+
gem.summary = %q{Guard gem for tay}
|
9
|
+
gem.homepage = "http://github.com/rixth/guard-tay"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "guard-tay"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Guard::TayVersion::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'tay'
|
19
|
+
gem.add_dependency 'guard'
|
20
|
+
|
21
|
+
gem.add_development_dependency 'rake'
|
22
|
+
end
|
data/lib/guard/tay.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/guard'
|
3
|
+
require 'tay'
|
4
|
+
require 'tay/cli/helpers'
|
5
|
+
|
6
|
+
module Guard
|
7
|
+
class Tay < Guard
|
8
|
+
include ::Tay::CLI::Helpers
|
9
|
+
|
10
|
+
def initialize(watchers = [], options = {})
|
11
|
+
options = munge_options(options)
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
##
|
16
|
+
# Run all simply recompiles all the things
|
17
|
+
def run_all
|
18
|
+
build_extension
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# Recompile the current extension when a file is changed. If the Tayfile
|
23
|
+
# was changed, validate it too.
|
24
|
+
def run_on_change(paths)
|
25
|
+
build_extension
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Recompile the current extension when a file is deleted
|
30
|
+
def run_on_deletion(paths)
|
31
|
+
build_extension
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def build_extension
|
37
|
+
begin
|
38
|
+
::Tay::Builder.new(spec, base_dir, build_dir).build!
|
39
|
+
UI.info "compiled #{spec.name} to #{build_dir}"
|
40
|
+
rescue ::Tay::InvalidSpecification => e
|
41
|
+
UI.error "invalid specification in #{tayfile_path.relative_path_from(Pathname.new(Dir.pwd))}: #{e}"
|
42
|
+
false
|
43
|
+
rescue Exception => e
|
44
|
+
UI.error "compilation of #{spec.name} failed: #{e}"
|
45
|
+
false
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# We're using Tay's CLI helpers and they expect string optiopns with
|
51
|
+
# dashes, rather than symbols and underscores. So munge!
|
52
|
+
def munge_options(options)
|
53
|
+
keys_to_munge = [:build_directory, :tayfile]
|
54
|
+
munged = {}
|
55
|
+
options.keys.each do |key|
|
56
|
+
if keys_to_munge.include?(key)
|
57
|
+
new_key = key.to_s.gsub(/_/, '-')
|
58
|
+
end
|
59
|
+
munged[new_key || key] = options[key]
|
60
|
+
end
|
61
|
+
munged
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-tay
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Thomas Rix
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: tay
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '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: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: guard
|
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'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Guard::Tay automatically recompiles your tay-based extensions on change
|
63
|
+
email:
|
64
|
+
- tom@rixth.org
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- guard-tay.gemspec
|
75
|
+
- lib/guard/tay.rb
|
76
|
+
- lib/guard/tay/templates/Guardfile
|
77
|
+
- lib/guard/tay/version.rb
|
78
|
+
homepage: http://github.com/rixth/guard-tay
|
79
|
+
licenses: []
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
hash: -1096656507221143845
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
hash: -1096656507221143845
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 1.8.24
|
105
|
+
signing_key:
|
106
|
+
specification_version: 3
|
107
|
+
summary: Guard gem for tay
|
108
|
+
test_files: []
|