rails-erb-lint 1.0.1 → 1.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 175bba98af77afc0ca104ed6334df3cc470e09c4
4
- data.tar.gz: cf3ffd02b5925d82aa0fcccadafdae22928541e1
3
+ metadata.gz: 51221dbedab71229da6c244a35c6744e895bd9e9
4
+ data.tar.gz: 67fbf74f18db1e5613a4f36e217ba1c2efd9cdee
5
5
  SHA512:
6
- metadata.gz: b3de7203fb952af8b4c20d157578ec1eb8e84b6690e27de690932e059d728484602592a0dc3117a4d0c0fd12cc5e569b098bcacba1d7b409fc4ce3150e33fe08
7
- data.tar.gz: ac2832e2f5eb2578f520ff7ed43db3f1f5919963571f8c82e77387afa07c89cbee9bb9e06a3a0cf949cd2ee7988a2f218cfaa2a4a1228bb99ba4ca5bfc4afeae
6
+ metadata.gz: 9405ce1ccd11738e1cf3498542c0346101937a8deb15d88f483a674be787b9d28b74c7199a0310d78e14696c0cf80048df4b635928c84e128e543af80338c7e8
7
+ data.tar.gz: f61e80a1307d4d109d2b61ddd867e8fc29ef9e366dfea694b8b1e338b04e31bb24e2d68c7d313391294dece11699f6fc04ec854eb778d34eb437e65e1e1d4084
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'gli'
3
3
  require 'action_view'
4
+ require 'find'
4
5
  require_relative '../helpers/rails_erb_check'
5
6
 
6
7
  include GLI::App
@@ -9,16 +10,28 @@ program_desc 'A simple lint tool for ERB Rails views.'
9
10
 
10
11
  desc 'Check for syntax errors on views'
11
12
  command :check do |c|
12
- c.action do |global_options,options,args|
13
+ c.action do |global_options,options|
13
14
  valid = []
14
15
  invalid = []
15
- args.each do |filepath|
16
- if RailsErbCheck.valid_syntax?(File.read(filepath))
17
- p "#{filepath} => valid"
18
- valid << filepath
16
+ erb_files = []
17
+
18
+ path = Dir.getwd
19
+ p "Checking for files in current directory: #{path}"
20
+
21
+ Find.find(path.to_s) do |f|
22
+ next if FileTest.directory?(f)
23
+ if /.*\.erb/.match(File.basename(f))
24
+ erb_files << f
25
+ end
26
+ end
27
+
28
+ erb_files.each do |f|
29
+ if RailsErbCheck.valid_syntax?(File.read(f))
30
+ p "#{f} => valid"
31
+ valid << f
19
32
  else
20
- p "#{filepath} => invalid"
21
- invalid << filepath
33
+ p "#{f} => invalid"
34
+ invalid << f
22
35
  end
23
36
  end
24
37
 
@@ -28,7 +41,7 @@ command :check do |c|
28
41
  p "Please edit #{f} and fix errors."
29
42
  end
30
43
  end
31
- abort
44
+
32
45
  end
33
46
  end
34
47
 
@@ -1,3 +1,3 @@
1
1
  module RailsErbLint
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-erb-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katherine Pe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-09 00:00:00.000000000 Z
11
+ date: 2013-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rails
56
+ name: actionpack
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='