guard-jslint-on-rails-for-1.1.1 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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-jslint-on-rails.gemspec
4
+ gemspec
@@ -0,0 +1,49 @@
1
+ Guard::JslintOnRails
2
+ =============
3
+
4
+ Guard plugin to verify that Javascript files comply with [JSLint](http://www.jslint.com/) validations.
5
+
6
+
7
+ Install
8
+ -------
9
+
10
+ Install and configure the [JSLint on Rails](https://github.com/psionides/jslint_on_rails) gem.
11
+
12
+ Install the gem:
13
+
14
+ $ gem install guard-jslint-on-rails
15
+
16
+ Add it to your Gemfile (inside development group):
17
+
18
+ ``` ruby
19
+ gem 'guard-jslint-on-rails'
20
+ ```
21
+
22
+ Add guard definition to your Guardfile by running this command:
23
+
24
+ $ guard init jslint-on-rails
25
+
26
+ Configuration
27
+ -------------
28
+
29
+ ``` ruby
30
+ # Guardfile
31
+ guard 'jslint-on-rails' do
32
+ # watch for changes to application javascript files
33
+ watch(%r{^app/assets/javascripts/.*\.js$})
34
+ # watch for changes to the JSLint configuration
35
+ watch('config/jslint.yml')
36
+ end
37
+ ```
38
+
39
+ ### Optional Configuration Settings
40
+
41
+ ```ruby
42
+ # Guardfile
43
+ guard 'jslint-on-rails', :config => '/path/to/jslint.yml' do
44
+ end
45
+
46
+ :config - path to jslint.yml config file. default is config/jslint.yml
47
+ ```
48
+
49
+ Please read [Guard doc](https://github.com/guard/guard#readme) for more information about the Guardfile DSL.
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "guard/jslint-on-rails"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "guard-jslint-on-rails-for-1.1.1"
7
+ s.version = Guard::JslintOnRails::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Ryan Sonnek", "Max Edmands"]
10
+ s.email = ["ryan@codecrate.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Guard Javascript changes to ensure JSLint complience}
13
+ s.description = %q{Guard Javascript changes to ensure JSLint complience}
14
+
15
+ s.rubyforge_project = "guard-jslint-on-rails"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency 'guard', '>= 0.4.0'
23
+ s.add_dependency 'jslint_on_rails', '>= 1.0.6'
24
+ s.add_development_dependency(%q<rake>, ['0.9.2.2'])
25
+
26
+ end
@@ -0,0 +1,48 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+ require 'guard/notifier'
4
+ require 'jslint'
5
+
6
+ module Guard
7
+ class JslintOnRails < Guard
8
+ VERSION = '0.2.0'
9
+
10
+ def initialize(watchers=[], options={})
11
+ super
12
+ @config_path = File.join(Dir.pwd, options[:config_path] || 'config/jslint.yml')
13
+ end
14
+
15
+ def start
16
+ UI.info "Guard::JsLintOnRails started using config: #{@config_path}"
17
+ end
18
+
19
+ def run_on_changes(paths)
20
+ error = nil
21
+ begin
22
+ output = capture_output do
23
+ lint = ::JSLint::Lint.new(
24
+ :paths => paths,
25
+ :config_path => @config_path
26
+ )
27
+ lint.run
28
+ end
29
+ rescue ::JSLint::LintCheckFailure => e
30
+ error = e
31
+ end
32
+ Notifier.notify((error ? 'failed' : 'passed'), :title => 'JSLint results', :image => (error ? :failed : :success))
33
+ true
34
+ end
35
+
36
+ private
37
+ def capture_output
38
+ out = StringIO.new
39
+ $stdout = out
40
+ $stderr = out
41
+ yield
42
+ return out
43
+ ensure
44
+ $stderr = STDERR
45
+ $stdout = STDOUT
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,8 @@
1
+ # verify that application Javascript files are lintable
2
+ # see https://github.com/psionides/jslint_on_rails
3
+ guard 'jslint-on-rails' do
4
+ # watch for changes to application javascript files
5
+ watch(%r{^app/assets/javascripts/.*\.js$})
6
+ # watch for changes to the JSLint configuration
7
+ watch('config/jslint.yml')
8
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-jslint-on-rails-for-1.1.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ryan Sonnek
9
+ - Max Edmands
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-06-14 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: guard
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.4.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 0.4.0
31
+ - !ruby/object:Gem::Dependency
32
+ name: jslint_on_rails
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: 1.0.6
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.6
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.2.2
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - '='
61
+ - !ruby/object:Gem::Version
62
+ version: 0.9.2.2
63
+ description: Guard Javascript changes to ensure JSLint complience
64
+ email:
65
+ - ryan@codecrate.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - .gitignore
71
+ - Gemfile
72
+ - README.md
73
+ - Rakefile
74
+ - guard-jslint-on-rails.gemspec
75
+ - lib/guard/jslint-on-rails.rb
76
+ - lib/guard/jslint-on-rails/templates/Guardfile
77
+ homepage: ''
78
+ licenses: []
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project: guard-jslint-on-rails
97
+ rubygems_version: 1.8.24
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: Guard Javascript changes to ensure JSLint complience
101
+ test_files: []