guard-rubycritic 1.2.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5237c9951bdafbeaeae849e7542530189c9541fb
4
- data.tar.gz: 15b744a8ac5387057dc8e07f792f9939cf3ba0a5
3
+ metadata.gz: a1ab4b10fb0ed3383216d12a64bfa8ea4a58a328
4
+ data.tar.gz: f8786ded7df6828ef743fb193fa0b0e75b0c974d
5
5
  SHA512:
6
- metadata.gz: 2099e1c5d1273c558725c68936afdf91a791a28927af9508d10976a96f72768ac669b63eba8cfce090e0ec1db6416e8004c28d1b31a30fc9dbdf8dd86a3cbcdd
7
- data.tar.gz: e05f1fc677eb65b03ec44676193a34d0486a698c9d054786d5e5180b8f33135a135f360480a6cc78fd35ff5931e936401fdc0c44cb5fa5389e9d6491c60ba078
6
+ metadata.gz: 9cd447522821336998a034e9dcb9cc552f9c062f9acbd5ecbc0e2389b7a83fe060b26e45246e0e5e0b34948d2b8b4772cb0b437a741d67a33aa10fcd51f09d35
7
+ data.tar.gz: d33c0b2f1a31f47ccc8e4468070a469b97ab45e745ebe72d11b91bbc9bc7e7515d5707bc1b59364b7259460f0d7d569dc4ea7542595a9d8e52ddf225cec855d8
@@ -1,7 +1,7 @@
1
1
  require "guard"
2
2
  require "guard/plugin"
3
3
  require "rubycritic"
4
- require "rubycritic/reporters/mini"
4
+ require "rubycritic/generators/html_guard_report"
5
5
 
6
6
  module Guard
7
7
 
@@ -13,6 +13,7 @@ module Guard
13
13
  #
14
14
  def start
15
15
  @rubycritic = ::Rubycritic.create
16
+ @rubycritic.extend(AdditionalMethodsForGuard)
16
17
  UI.info "Guard::Rubycritic is critiquing"
17
18
  end
18
19
 
@@ -22,10 +23,24 @@ module Guard
22
23
  # @return [Object] the task result
23
24
  #
24
25
  def run_on_changes(paths)
25
- analysed_files = @rubycritic.critique(paths)
26
- report_location = ::Rubycritic::Reporter::Mini.new(analysed_files).generate_report
26
+ report_location = report(critique(paths))
27
27
  UI.info "New critique at #{report_location}"
28
28
  end
29
+
30
+ def critique(paths)
31
+ @rubycritic.paths = paths
32
+ @rubycritic.critique
33
+ end
34
+
35
+ def report(analysed_modules)
36
+ ::Rubycritic::Generator::HtmlGuardReport.new(analysed_modules).generate_report
37
+ end
38
+ end
39
+
40
+ module AdditionalMethodsForGuard
41
+ # This is necessary to inject new paths into the RubyCritic Command class.
42
+ # Otherwise we would have to create a new class instance everytime a user changed a file.
43
+ attr_writer :paths
29
44
  end
30
45
 
31
46
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module RubycriticVersion
3
- VERSION = "1.2.0"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
@@ -0,0 +1,19 @@
1
+ require "rubycritic/generators/html/code_file"
2
+
3
+ module Rubycritic
4
+ module Generator
5
+ module Html
6
+
7
+ class CurrentCodeFile < CodeFile
8
+ def file_directory
9
+ @file_directory ||= root_directory
10
+ end
11
+
12
+ def file_name
13
+ "current_file.html"
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,30 @@
1
+ require "rubycritic/generators/html_report"
2
+ require "rubycritic/generators/html/current_code_file"
3
+
4
+ module Rubycritic
5
+ module Generator
6
+
7
+ class HtmlGuardReport < HtmlReport
8
+ def generate_report
9
+ create_directories_and_files
10
+ copy_assets_to_report_directory
11
+ report_location
12
+ end
13
+
14
+ private
15
+
16
+ def generators
17
+ file_generator
18
+ end
19
+
20
+ def file_generator
21
+ @file_generator ||= Html::CurrentCodeFile.new(@analysed_modules.first)
22
+ end
23
+
24
+ def report_location
25
+ file_generator.file_href
26
+ end
27
+ end
28
+
29
+ end
30
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-rubycritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Simoes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-05 00:00:00.000000000 Z
11
+ date: 2015-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.2'
33
+ version: '1.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.2'
40
+ version: '1.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,8 @@ files:
108
108
  - lib/guard/rubycritic.rb
109
109
  - lib/guard/rubycritic/templates/Guardfile
110
110
  - lib/guard/rubycritic/version.rb
111
+ - lib/rubycritic/generators/html/current_code_file.rb
112
+ - lib/rubycritic/generators/html_guard_report.rb
111
113
  - test/lib/guard/rubycritic/version_test.rb
112
114
  - test/test_helper.rb
113
115
  homepage: https://github.com/whitesmith/guard-rubycritic