watson-ruby 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/spec/fs_spec.rb CHANGED
@@ -3,53 +3,53 @@ module Watson
3
3
  require_relative 'helper_spec'
4
4
 
5
5
  describe FS do
6
- before(:each) do
7
- silence_output
8
- end
9
-
10
- after(:each) do
11
- enable_output
12
- end
13
-
14
- describe '.check_file' do
15
- context 'blank input file' do
16
- it 'should return false' do
17
- FS.check_file('').should be_false
18
- end
19
- end
20
-
21
- context 'invalid input file' do
22
- it 'should return false' do
23
- FS.check_file('chickensoup.rb').should be_false
24
- end
25
- end
26
-
27
- context 'valid input file' do
28
- it 'should return true' do
29
- FS.check_file('spec/fs_spec.rb').should be_true
30
- end
31
- end
32
- end
33
-
34
- describe '.check_dir' do
35
- context 'blank input dir' do
36
- it 'should return false' do
37
- FS.check_dir('').should be_false
38
- end
39
- end
40
-
41
- context 'invalid input dir' do
42
- it 'should return false' do
43
- FS.check_dir('./chickensoup').should be_false
44
- end
45
- end
46
-
47
- context 'valid input dir' do
48
- it 'should return true' do
49
- FS.check_dir('spec/').should be_true
50
- end
51
- end
52
- end
6
+ before(:each) do
7
+ silence_output
8
+ end
9
+
10
+ after(:each) do
11
+ enable_output
12
+ end
13
+
14
+ describe '.check_file' do
15
+ context 'blank input file' do
16
+ it 'should return false' do
17
+ FS.check_file('').should be_false
18
+ end
19
+ end
20
+
21
+ context 'invalid input file' do
22
+ it 'should return false' do
23
+ FS.check_file('chickensoup.rb').should be_false
24
+ end
25
+ end
26
+
27
+ context 'valid input file' do
28
+ it 'should return true' do
29
+ FS.check_file('spec/fs_spec.rb').should be_true
30
+ end
31
+ end
32
+ end
33
+
34
+ describe '.check_dir' do
35
+ context 'blank input dir' do
36
+ it 'should return false' do
37
+ FS.check_dir('').should be_false
38
+ end
39
+ end
40
+
41
+ context 'invalid input dir' do
42
+ it 'should return false' do
43
+ FS.check_dir('./chickensoup').should be_false
44
+ end
45
+ end
46
+
47
+ context 'valid input dir' do
48
+ it 'should return true' do
49
+ FS.check_dir('spec/').should be_true
50
+ end
51
+ end
52
+ end
53
53
 
54
54
  end
55
55
 
data/spec/parser_spec.rb CHANGED
@@ -2,130 +2,130 @@ module Watson
2
2
  require_relative 'helper_spec'
3
3
 
4
4
  describe Parser do
5
- before(:each) do
6
- @config = Config.new
7
- @config.run
8
- @parser = Parser.new(@config)
9
- silence_output
10
- end
11
-
12
- after(:each) do
13
- @file = @config.instance_variable_get(:@rc_file)
14
- File.delete(@file) if File.exists?(@file)
15
- enable_output
16
- end
17
-
18
-
19
- describe '#get_comment_type' do
20
- context 'known extension' do
21
- it 'return correct extension (# for ruby)' do
22
- @parser.get_comment_type('lib/watson.rb').should eql '#'
23
- end
24
-
25
- it 'return correct extension (# for coffee)' do
26
- @parser.get_comment_type('lib/watson.coffee').should eql '#'
27
- end
28
-
29
- it 'return correct extension (// for c/c++)' do
30
- @parser.get_comment_type('lib/watson.cpp').should eql '//'
31
- end
32
- end
33
-
34
- context 'unknown extension' do
35
- it 'return false for unknown extension' do
36
- @parser.get_comment_type('lib/chickensoup').should be_false
37
- end
38
- end
39
- end
40
-
41
- describe '#parse_file' do
42
- context 'invalid file parse' do
43
- it 'return false on empty file input' do
44
- @parser.parse_file('').should be_false
45
- end
46
- end
47
-
48
- context 'blank file parse' do
49
- before do
50
- FileUtils.mkdir('test_dir')
51
- FileUtils.touch('test_dir/test_file')
52
- end
53
-
54
- it 'generate (blank) hash structure' do
55
- @structure = @parser.parse_file('test_dir/test_file')
56
-
57
- @structure[:relative_path].should == 'test_dir/test_file'
58
- @structure[:has_issues].should be_false
59
-
60
- @structure['fix'].should == []
61
- @structure['review'].should == []
62
- @structure['todo'].should == []
63
- end
64
-
65
- after do
66
- FileUtils.rm_rf('test_dir')
67
- end
68
- end
69
-
70
- context 'valid file parse' do
71
- before do
72
- FileUtils.mkdir('test_dir')
73
- FileUtils.cp('assets/examples/main.cpp', 'test_dir/')
74
- end
75
-
76
- it 'generate populated hash structure from file' do
77
- @structure = @parser.parse_file('test_dir/main.cpp')
78
-
79
- @structure[:relative_path].should == 'test_dir/main.cpp'
80
- @structure[:has_issues].should be_true
81
- @structure['fix'][0][:line_number].should == 16
82
- end
83
-
84
- after do
85
- FileUtils.rm_rf('test_dir')
86
- end
87
- end
88
-
89
- end
90
-
91
- describe '#parse_dir' do
92
- context 'empty dir parsing' do
93
- before do
94
- FileUtils.mkdir('test_dir')
95
- end
96
-
97
- it 'generate (blank) hash stucture' do
98
- @structure = @parser.parse_dir('test_dir/', 0)
99
-
100
- @structure[:curdir].should == 'test_dir/'
101
- @structure[:files].should == []
102
- @structure[:subdirs].should == []
103
- end
104
-
105
- after do
106
- FileUtils.rm_rf('test_dir')
107
- end
108
- end
109
-
110
- context 'single file in dir parsing' do
111
- before do
112
- FileUtils.mkdir('test_dir')
113
- FileUtils.cp('assets/examples/main.cpp', 'test_dir/')
114
- end
115
-
116
- it 'generate hash structure with parsed file' do
117
- @structure = @parser.parse_dir('test_dir/', 0)
118
- @structure[:files][0][:relative_path].should == 'test_dir/main.cpp'
119
- @structure[:files][0][:has_issues].should be_true
120
- @structure[:files][0]["fix"][0][:line_number].should == 16
121
- end
122
-
123
- after do
124
- FileUtils.rm_rf('test_dir')
125
- end
126
- end
127
-
128
- end
5
+ before(:each) do
6
+ @config = Config.new
7
+ @config.run
8
+ @parser = Parser.new(@config)
9
+ silence_output
10
+ end
11
+
12
+ after(:each) do
13
+ @file = @config.instance_variable_get(:@rc_file)
14
+ File.delete(@file) if File.exists?(@file)
15
+ enable_output
16
+ end
17
+
18
+
19
+ describe '#get_comment_type' do
20
+ context 'known extension' do
21
+ it 'return correct extension (# for ruby)' do
22
+ @parser.get_comment_type('lib/watson.rb').should eql '#'
23
+ end
24
+
25
+ it 'return correct extension (# for coffee)' do
26
+ @parser.get_comment_type('lib/watson.coffee').should eql '#'
27
+ end
28
+
29
+ it 'return correct extension (// for c/c++)' do
30
+ @parser.get_comment_type('lib/watson.cpp').should eql '//'
31
+ end
32
+ end
33
+
34
+ context 'unknown extension' do
35
+ it 'return false for unknown extension' do
36
+ @parser.get_comment_type('lib/chickensoup').should be_false
37
+ end
38
+ end
39
+ end
40
+
41
+ describe '#parse_file' do
42
+ context 'invalid file parse' do
43
+ it 'return false on empty file input' do
44
+ @parser.parse_file('').should be_false
45
+ end
46
+ end
47
+
48
+ context 'blank file parse' do
49
+ before do
50
+ FileUtils.mkdir('test_dir')
51
+ FileUtils.touch('test_dir/test_file')
52
+ end
53
+
54
+ it 'generate (blank) hash structure' do
55
+ @structure = @parser.parse_file('test_dir/test_file')
56
+
57
+ @structure[:relative_path].should == 'test_dir/test_file'
58
+ @structure[:has_issues].should be_false
59
+
60
+ @structure['fix'].should == []
61
+ @structure['review'].should == []
62
+ @structure['todo'].should == []
63
+ end
64
+
65
+ after do
66
+ FileUtils.rm_rf('test_dir')
67
+ end
68
+ end
69
+
70
+ context 'valid file parse' do
71
+ before do
72
+ FileUtils.mkdir('test_dir')
73
+ FileUtils.cp('assets/examples/main.cpp', 'test_dir/')
74
+ end
75
+
76
+ it 'generate populated hash structure from file' do
77
+ @structure = @parser.parse_file('test_dir/main.cpp')
78
+
79
+ @structure[:relative_path].should == 'test_dir/main.cpp'
80
+ @structure[:has_issues].should be_true
81
+ @structure['fix'][0][:line_number].should == 16
82
+ end
83
+
84
+ after do
85
+ FileUtils.rm_rf('test_dir')
86
+ end
87
+ end
88
+
89
+ end
90
+
91
+ describe '#parse_dir' do
92
+ context 'empty dir parsing' do
93
+ before do
94
+ FileUtils.mkdir('test_dir')
95
+ end
96
+
97
+ it 'generate (blank) hash stucture' do
98
+ @structure = @parser.parse_dir('test_dir/', 0)
99
+
100
+ @structure[:curdir].should == 'test_dir/'
101
+ @structure[:files].should == []
102
+ @structure[:subdirs].should == []
103
+ end
104
+
105
+ after do
106
+ FileUtils.rm_rf('test_dir')
107
+ end
108
+ end
109
+
110
+ context 'single file in dir parsing' do
111
+ before do
112
+ FileUtils.mkdir('test_dir')
113
+ FileUtils.cp('assets/examples/main.cpp', 'test_dir/')
114
+ end
115
+
116
+ it 'generate hash structure with parsed file' do
117
+ @structure = @parser.parse_dir('test_dir/', 0)
118
+ @structure[:files][0][:relative_path].should == 'test_dir/main.cpp'
119
+ @structure[:files][0][:has_issues].should be_true
120
+ @structure[:files][0]["fix"][0][:line_number].should == 16
121
+ end
122
+
123
+ after do
124
+ FileUtils.rm_rf('test_dir')
125
+ end
126
+ end
127
+
128
+ end
129
129
 
130
130
  end
131
131
 
data/watson.gemspec CHANGED
@@ -4,33 +4,33 @@ $:.push File.expand_path("../lib", __FILE__)
4
4
  require "watson/version"
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = 'watson-ruby'
8
- s.version = Watson::VERSION
9
- s.date = '2013-11-06'
7
+ s.name = 'watson-ruby'
8
+ s.version = Watson::VERSION
9
+ s.date = '2013-11-06'
10
10
 
11
- s.authors = ["nhmood"]
12
- s.email = 'nhmood@goosecode.com'
13
- s.homepage = 'http://goosecode.com/watson'
11
+ s.authors = ["nhmood"]
12
+ s.email = 'nhmood@goosecode.com'
13
+ s.homepage = 'http://goosecode.com/watson'
14
14
 
15
- s.summary = "an inline issue manager"
16
- s.description = "an inline issue manager with GitHub and Bitbucket support"
17
-
18
- s.license = 'MIT'
19
- s.files = `git ls-files`.split("\n").delete_if { |file| file.include?("assets/examples") }
20
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
15
+ s.summary = "an inline issue manager"
16
+ s.description = "an inline issue manager with GitHub and Bitbucket support"
17
+
18
+ s.license = 'MIT'
19
+ s.files = `git ls-files`.split("\n").delete_if { |file| file.include?("assets/examples") }
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
22
22
 
23
- s.require_paths = ["assets", "bin", "lib"]
23
+ s.require_paths = ["assets", "bin", "lib"]
24
24
 
25
- # Ruby Dependency
26
- s.required_ruby_version = '>= 2.0.0'
25
+ # Ruby Dependency
26
+ s.required_ruby_version = '>= 2.0.0'
27
27
 
28
- # Runtime Dependencies
29
- s.add_runtime_dependency 'json'
28
+ # Runtime Dependencies
29
+ s.add_runtime_dependency 'json'
30
30
 
31
- # Development Dependencies
32
- s.add_development_dependency 'rake'
33
- s.add_development_dependency 'rspec'
31
+ # Development Dependencies
32
+ s.add_development_dependency 'rake'
33
+ s.add_development_dependency 'rspec'
34
34
  end
35
35
 
36
36
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watson-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - nhmood
@@ -60,6 +60,7 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - .gitignore
63
+ - .travis.yml
63
64
  - Gemfile
64
65
  - Gemfile.lock
65
66
  - LICENSE