guard-jshint-node 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in guard-node-jshint.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 - 2011 Patrik Henningsson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Guard::JshintNode
2
+
3
+ This guard will run [JSHint](http://www.jshint.com/) for you automatically when files are modified.
4
+
5
+ ## Install
6
+
7
+ Make sure you have [guard](http://github.com/guard/guard) and [jshint](http://github.com/jshint/node-jshint) installed.
8
+
9
+ Install the gem with:
10
+
11
+ gem install guard-node-jshint
12
+
13
+ Or add it to your Gemfile:
14
+
15
+ gem 'guard-node-jshint'
16
+
17
+ And then add a basic setup to your Guardfile:
18
+
19
+ guard init node-jshint
20
+
21
+ ## Usage
22
+
23
+ For configuration example, see [example/config.json](http://github.com/jshint/node-jshint/blob/master/example/config.json) and the available [options](http://www.jshint.com/options).
24
+
25
+ ## Options
26
+
27
+ * `:config # default => "jshint-config.json"`
28
+
29
+ Specify path to config file.
30
+
31
+ * `:notify # default => true`
32
+
33
+ If Growl messages should be displayed or not.
34
+
35
+ ### Example
36
+
37
+ guard 'jshint', :config => 'path/to/config.json' do
38
+ watch(%r{^scripts\/.*\.js$})
39
+ end
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "guard/jshint-node"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "guard-jshint-node"
7
+ s.version = Guard::JshintNode::VERSION
8
+ s.authors = ["Patrik Henningsson"]
9
+ s.email = ["patrik.henningsson@gmail.com"]
10
+ s.homepage = "http://github.com/pahen/guard-jshint-node"
11
+ s.summary = "Guard gem for running JSHint"
12
+ s.description = "Guard::JshintNode automatically runs JSHint when watched files are modified."
13
+
14
+ s.rubyforge_project = "guard-jshint-node"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'guard', '>= 0.8.8'
22
+ end
@@ -0,0 +1,4 @@
1
+ # Installed by guard-jshint-node
2
+ guard 'jshint-node', :config => 'jshint-config.json' do
3
+ watch(%r{.*\.js$})
4
+ end
@@ -0,0 +1,43 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+
4
+ module Guard
5
+ class JshintNode < Guard
6
+
7
+ VERSION = '0.0.1'
8
+
9
+ DEFAULT_OPTIONS = {
10
+ :config => 'jshint-config.json',
11
+ :notify => true,
12
+ }
13
+
14
+ # Initialize a Guard.
15
+ # @param [Array<Guard::Watcher>] watchers the Guard file watchers
16
+ # @param [Hash] options the custom Guard options
17
+ def initialize(watchers = [], options = {})
18
+ defaults = DEFAULT_OPTIONS.clone
19
+ @options = defaults.merge(options)
20
+ super(watchers, @options)
21
+ end
22
+
23
+ # Called on file(s) modifications that the Guard watches.
24
+ # @param [Array<String>] paths the changes files or paths
25
+ # @raise [:task_has_failed] when run_on_change has failed
26
+ def run_on_change(paths)
27
+ paths.each do |path|
28
+ results = `jshint #{path} --config #{@options[:config]}`
29
+ if results.include? 'Lint Free!'
30
+ if options[:notify]
31
+ ::Guard::Notifier.notify('No errors found.', :title => 'JSHint', :image => :success)
32
+ end
33
+ else
34
+ if options[:notify]
35
+ ::Guard::Notifier.notify(results, :title => 'JSHint Errors', :image => :failed)
36
+ end
37
+ print results
38
+ end
39
+ end
40
+ end
41
+
42
+ end
43
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-jshint-node
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Patrik Henningsson
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-02-20 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: guard
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 47
29
+ segments:
30
+ - 0
31
+ - 8
32
+ - 8
33
+ version: 0.8.8
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: Guard::JshintNode automatically runs JSHint when watched files are modified.
37
+ email:
38
+ - patrik.henningsson@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - .gitignore
47
+ - Gemfile
48
+ - LICENSE
49
+ - README.md
50
+ - Rakefile
51
+ - guard-jshint-node.gemspec
52
+ - lib/guard/jshint-node.rb
53
+ - lib/guard/jshint-node/templates/Guardfile
54
+ homepage: http://github.com/pahen/guard-jshint-node
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ requirements: []
81
+
82
+ rubyforge_project: guard-jshint-node
83
+ rubygems_version: 1.8.17
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Guard gem for running JSHint
87
+ test_files: []
88
+