guard-rna 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/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +17 -0
- data/Guardfile +11 -0
- data/LICENSE +22 -0
- data/README.md +39 -0
- data/Rakefile +7 -0
- data/lib/guard/rna.rb +51 -0
- data/lib/guard/rna/templates/Guardfile +3 -0
- data/lib/guard/version.rb +3 -0
- data/rna.gemspec +20 -0
- data/spec/rna_spec.rb +30 -0
- data/spec/spec_helper.rb +14 -0
- metadata +99 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in guard-cloudformation.gemspec
|
4
|
+
gemspec :development_group => :test
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem "rake"
|
8
|
+
gem "rspec"
|
9
|
+
gem "travis-lint"
|
10
|
+
end
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem "growl"
|
14
|
+
gem "guard-bundler"
|
15
|
+
gem "guard-rspec"
|
16
|
+
gem "rb-fsevent"
|
17
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
guard "bundler" do
|
2
|
+
watch("Gemfile")
|
3
|
+
watch(/^.+\.gemspec/)
|
4
|
+
end
|
5
|
+
|
6
|
+
guard "rspec", :version => 2, :cli=> "--format nested" do
|
7
|
+
watch(%r{^spec/.+_spec\.rb$})
|
8
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
9
|
+
watch("spec/spec_helper.rb") { "spec" }
|
10
|
+
watch(%r{^spec/support/(.+)\.rb$}) { |m| "spec" }
|
11
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Tung Nguyen
|
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,39 @@
|
|
1
|
+
# Guard::Cloudformation
|
2
|
+
|
3
|
+
[![Build History][2]][1] [![Dependency Status][4]][3]
|
4
|
+
|
5
|
+
[1]: http://travis-ci.org/tongueroo/guard-cloudformation
|
6
|
+
[2]: https://secure.travis-ci.org/tongueroo/guard-cloudformation.png?branch=master
|
7
|
+
[3]: https://gemnasium.com/tongueroo/guard-cloudformation
|
8
|
+
[4]: https://gemnasium.com/tongueroo/guard-cloudformation.png
|
9
|
+
|
10
|
+
Guard::Cloudformation automatically runs validates cloud formation templates via cfn-validate-template.
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Please be sure to AWS cfn cli tools install:
|
15
|
+
|
16
|
+
$ brew install aws-cfn-tools
|
17
|
+
|
18
|
+
Please be sure to have [Guard](https://github.com/guard/guard) installed before continuing.
|
19
|
+
|
20
|
+
Install the gem:
|
21
|
+
|
22
|
+
$ gem install guard-cloudformation
|
23
|
+
|
24
|
+
Add the guard-cloudformation definition to your Guardfile by running this command:
|
25
|
+
|
26
|
+
$ guard init cloudformation
|
27
|
+
|
28
|
+
## Options
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
:all_on_start => false # Whether to run validate all Cloudformation templates on start up
|
32
|
+
# default: true
|
33
|
+
|
34
|
+
:templates_path => "." # The path(s) to your Cloudformation templates
|
35
|
+
# default: ["templates"]
|
36
|
+
|
37
|
+
:notification => false # Whether to display notifications after the validation is done running
|
38
|
+
# default: true
|
39
|
+
```
|
data/Rakefile
ADDED
data/lib/guard/rna.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require "guard"
|
2
|
+
require "guard/guard"
|
3
|
+
require "colorize"
|
4
|
+
|
5
|
+
module Guard
|
6
|
+
class Rna < Guard
|
7
|
+
|
8
|
+
# Initialize a Guard.
|
9
|
+
# @param [Array<Guard::Watcher>] watchers the Guard file watchers
|
10
|
+
# @param [Hash] options the custom Guard options
|
11
|
+
def initialize(watchers = [], options = {})
|
12
|
+
super
|
13
|
+
@results = {}
|
14
|
+
@options = {
|
15
|
+
:all_on_start => true,
|
16
|
+
:templates_path => "templates",
|
17
|
+
:notification => true,
|
18
|
+
}.merge(@options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Call once when Guard starts. Please override initialize method to init stuff.
|
22
|
+
# @raise [:task_has_failed] when start has failed
|
23
|
+
def start
|
24
|
+
run_all if @options[:all_on_start]
|
25
|
+
end
|
26
|
+
|
27
|
+
# Called when just `enter` is pressed
|
28
|
+
# This method should be principally used for long action like running all specs/tests/...
|
29
|
+
# @raise [:task_has_failed] when run_all has failed
|
30
|
+
def run_all
|
31
|
+
run!
|
32
|
+
end
|
33
|
+
|
34
|
+
# Called on file(s) modifications that the Guard watches.
|
35
|
+
# @param [Array<String>] paths the changes files or paths
|
36
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
37
|
+
def run_on_change(paths)
|
38
|
+
run!
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def run!
|
44
|
+
throw :task_has_failed unless command
|
45
|
+
end
|
46
|
+
|
47
|
+
def command
|
48
|
+
system("rna build")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/rna.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/guard/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Tung Nguyen"]
|
6
|
+
gem.email = ["tongueroo@gmail.com"]
|
7
|
+
gem.description = %q{Guard::Rna automatically builds node.json files.}
|
8
|
+
gem.summary = %q{Guard::Rna automatically builds node.json files.}
|
9
|
+
gem.homepage = ""
|
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-rna"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Guard::RNA_VERSION
|
17
|
+
|
18
|
+
gem.add_dependency "colorize"
|
19
|
+
gem.add_dependency "guard"
|
20
|
+
end
|
data/spec/rna_spec.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "guard/rna"
|
3
|
+
|
4
|
+
module Guard
|
5
|
+
describe Rna do
|
6
|
+
before { Notifier.stub(:notify) }
|
7
|
+
|
8
|
+
it { should be_a_kind_of ::Guard::Guard }
|
9
|
+
|
10
|
+
describe "#run_all" do
|
11
|
+
subject { guard.run_all }
|
12
|
+
let(:guard) { described_class.new [], :notification => notification }
|
13
|
+
let(:notification) { false }
|
14
|
+
let(:command) { mock "command" }
|
15
|
+
|
16
|
+
it "runs return true rna command runs successfully" do
|
17
|
+
guard.stub(:command).and_return(true)
|
18
|
+
guard.should_receive(:command).exactly(1).times
|
19
|
+
subject
|
20
|
+
end
|
21
|
+
|
22
|
+
it "runs return false rna command runs unsuccessfully" do
|
23
|
+
guard.stub(:command).and_return(false)
|
24
|
+
expect { subject }.to throw_symbol(:task_has_failed)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "rspec/autorun"
|
3
|
+
|
4
|
+
ENV["GUARD_ENV"] = "test"
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |file| require file }
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
config.run_all_when_everything_filtered = true
|
13
|
+
config.filter_run :focus
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-rna
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tung Nguyen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: colorize
|
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
|
+
description: Guard::Rna automatically builds node.json files.
|
47
|
+
email:
|
48
|
+
- tongueroo@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- .gitignore
|
54
|
+
- .rspec
|
55
|
+
- .travis.yml
|
56
|
+
- Gemfile
|
57
|
+
- Guardfile
|
58
|
+
- LICENSE
|
59
|
+
- README.md
|
60
|
+
- Rakefile
|
61
|
+
- lib/guard/rna.rb
|
62
|
+
- lib/guard/rna/templates/Guardfile
|
63
|
+
- lib/guard/version.rb
|
64
|
+
- rna.gemspec
|
65
|
+
- spec/rna_spec.rb
|
66
|
+
- spec/spec_helper.rb
|
67
|
+
homepage: ''
|
68
|
+
licenses: []
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
hash: 2134589624167509573
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
hash: 2134589624167509573
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 1.8.24
|
94
|
+
signing_key:
|
95
|
+
specification_version: 3
|
96
|
+
summary: Guard::Rna automatically builds node.json files.
|
97
|
+
test_files:
|
98
|
+
- spec/rna_spec.rb
|
99
|
+
- spec/spec_helper.rb
|