jslint_on_rails 1.0.3 → 1.0.4

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/lib/jslint.rb CHANGED
@@ -1,3 +1,7 @@
1
1
  require 'jslint/errors'
2
2
  require 'jslint/utils'
3
3
  require 'jslint/lint'
4
+
5
+ if defined?(Rails) && Rails::VERSION::MAJOR == 3
6
+ require 'jslint/railtie'
7
+ end
@@ -0,0 +1 @@
1
+ require 'jslint'
data/spec/lint_spec.rb CHANGED
@@ -141,6 +141,15 @@ describe JSLint::Lint do
141
141
  file_list(lint).should == [@files[0], @files[2]]
142
142
  end.should_not raise_error
143
143
  end
144
+
145
+ it "should ignore empty files" do
146
+ File.open("test/empty.js", "w") { |f| f.write("") }
147
+ File.open("test/full.js", "w") { |f| f.write("qqq") }
148
+
149
+ lint = JSLint::Lint.new :paths => ['test/*.js']
150
+ file_list(lint).should_not include(File.expand_path("test/empty.js"))
151
+ file_list(lint).should include(File.expand_path("test/full.js"))
152
+ end
144
153
  end
145
154
 
146
155
  end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+ require 'jslint/railtie'
3
+
4
+ describe JSLint::Railtie do
5
+ before :all do
6
+ File.open(JSLint::DEFAULT_CONFIG_FILE, "w") { |f| f.write "foo" }
7
+ JSLint.config_path = "custom_config.yml"
8
+ end
9
+
10
+ before :each do
11
+ File.delete(JSLint.config_path) if File.exist?(JSLint.config_path)
12
+ end
13
+
14
+ describe "create_example_config" do
15
+ it "should create a config file if it doesn't exist" do
16
+ JSLint::Railtie.create_example_config
17
+
18
+ File.exist?(JSLint.config_path).should be_true
19
+ File.read(JSLint.config_path).should == "foo"
20
+ end
21
+
22
+ it "should not do anything if config already exists" do
23
+ File.open(JSLint.config_path, "w") { |f| f.write "bar" }
24
+
25
+ JSLint::Railtie.create_example_config
26
+
27
+ File.exist?(JSLint.config_path).should be_true
28
+ File.read(JSLint.config_path).should == "bar"
29
+ end
30
+ end
31
+ end
data/spec/spec_helper.rb CHANGED
@@ -6,3 +6,16 @@ module JSLint::Utils
6
6
  def self.xprint(x) ; end
7
7
  def self.xputs(x) ; end
8
8
  end
9
+
10
+ module Rails
11
+ class Railtie
12
+ def self.rake_tasks
13
+ end
14
+ end
15
+ end
16
+
17
+ module FileUtils
18
+ def copy(*args)
19
+ cp(*args)
20
+ end
21
+ end
data/spec/utils_spec.rb CHANGED
@@ -97,14 +97,14 @@ describe JSLint::Utils do
97
97
 
98
98
  it "should copy default config to config_path" do
99
99
  JSLint.config_path = "newfile.yml"
100
- File.should_receive(:copy).with(JSLint::DEFAULT_CONFIG_FILE, "newfile.yml")
100
+ FileUtils.should_receive(:copy).with(JSLint::DEFAULT_CONFIG_FILE, "newfile.yml")
101
101
  JSLint::Utils.copy_config_file
102
102
  end
103
103
 
104
104
  it "should not overwrite the file if it exists" do
105
105
  JSLint.config_path = "newfile2.yml"
106
106
  File.open("newfile2.yml", "w") { |f| f.write("qwe") }
107
- File.should_not_receive(:copy)
107
+ FileUtils.should_not_receive(:copy)
108
108
  JSLint::Utils.copy_config_file
109
109
  end
110
110
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jslint_on_rails
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 3
9
- version: 1.0.3
9
+ - 4
10
+ version: 1.0.4
10
11
  platform: ruby
11
12
  authors:
12
13
  - Jakub Suder
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-06-11 00:00:00 +02:00
18
+ date: 2010-12-05 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -29,19 +30,24 @@ extra_rdoc_files: []
29
30
  files:
30
31
  - MIT-LICENSE
31
32
  - README.markdown
33
+ - Changelog.markdown
32
34
  - Gemfile
35
+ - Gemfile.lock
33
36
  - Rakefile
34
37
  - lib/jslint/config/jslint.yml
35
38
  - lib/jslint/errors.rb
36
39
  - lib/jslint/lint.rb
37
40
  - lib/jslint/rails.rb
41
+ - lib/jslint/railtie.rb
38
42
  - lib/jslint/tasks.rb
39
43
  - lib/jslint/utils.rb
40
44
  - lib/jslint/vendor/jslint.js
41
45
  - lib/jslint/vendor/rhino.jar
42
46
  - lib/jslint/vendor/test.jar
43
47
  - lib/jslint.rb
48
+ - lib/jslint_on_rails.rb
44
49
  - spec/lint_spec.rb
50
+ - spec/railtie_spec.rb
45
51
  - spec/spec_helper.rb
46
52
  - spec/utils_spec.rb
47
53
  has_rdoc: true
@@ -58,6 +64,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - ">="
60
66
  - !ruby/object:Gem::Version
67
+ hash: 3
61
68
  segments:
62
69
  - 0
63
70
  version: "0"
@@ -66,6 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
73
  requirements:
67
74
  - - ">="
68
75
  - !ruby/object:Gem::Version
76
+ hash: 3
69
77
  segments:
70
78
  - 0
71
79
  version: "0"