guard-phpmd 0.0.1

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/.gitignore ADDED
@@ -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-node-jshint.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 - 2011 Patrik Henningsson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Guard::PHPMD
2
+
3
+ This guard will run [PHP Mess Detector](http://phpmd.org) for you automatically when files are modified.
4
+
5
+ ## Install
6
+
7
+ Make sure you have [guard](http://github.com/guard/guard) and [phpmd](http://phpmd.org/download/index.html) installed.
8
+
9
+ Install the gem with:
10
+
11
+ gem install guard-phpmd
12
+
13
+ Or add it to your Gemfile:
14
+
15
+ gem 'guard-phpmd'
16
+
17
+ And then add a basic setup to your Guardfile:
18
+
19
+ guard init phpmd
20
+
21
+ ## Options
22
+
23
+ * `:path # default => "."`
24
+
25
+ Set the working directory (useful when using relative paths used in the rules file)
26
+
27
+ * `:rules # default => "pmd-rules.xml"`
28
+
29
+ Path to the rules file.
30
+
31
+ ### Example
32
+
33
+ guard 'phpmd', :path => 'path/to/PHPMD', :rules => 'path/to/pmd-rules.xml' do
34
+ watch(%r{.*\.php$})
35
+ end
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "guard/phpmd"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "guard-phpmd"
7
+ s.version = Guard::PHPMD::VERSION
8
+ s.authors = ["Patrik Henningsson"]
9
+ s.email = ["patrik.henningsson@gmail.com"]
10
+ s.homepage = "http://github.com/pahen/guard-phpmd"
11
+ s.summary = "Guard gem for running PHPMD"
12
+ s.description = "Guard::PHPMD automatically runs PHP Mess Detector when watched files are modified."
13
+
14
+ s.rubyforge_project = "guard-phpmd"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'guard', '>= 0.8.8'
22
+ end
@@ -0,0 +1,35 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+
4
+ module Guard
5
+ class PHPMD < Guard
6
+
7
+ VERSION = '0.0.1'
8
+
9
+ DEFAULT_OPTIONS = {
10
+ :path => '.',
11
+ :rules => 'pmd-rules.xml'
12
+ }
13
+
14
+ def initialize(watchers = [], options = {})
15
+ defaults = DEFAULT_OPTIONS.clone
16
+ @options = defaults.merge(options)
17
+ super(watchers, @options)
18
+ end
19
+
20
+ def run_on_change(paths)
21
+ @options[:rules] = File.expand_path @options[:rules]
22
+ paths.each do |path|
23
+ path = File.expand_path path
24
+ print path
25
+ Dir.chdir(@options[:path]) do
26
+ results = `phpmd #{path} text #{@options[:rules]}`
27
+ if $?.to_i > 0 then
28
+ ::Guard::Notifier.notify(results, :title => 'PHP Mess Detector', :image => :failed)
29
+ puts results
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,4 @@
1
+ # Installed by guard-phpmd
2
+ guard 'phpmd' do
3
+ watch(%r{.*\.php$})
4
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-phpmd
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Patrik Henningsson
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-02-20 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: guard
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 47
29
+ segments:
30
+ - 0
31
+ - 8
32
+ - 8
33
+ version: 0.8.8
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: Guard::PHPMD automatically runs PHP Mess Detector when watched files are modified.
37
+ email:
38
+ - patrik.henningsson@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - .gitignore
47
+ - Gemfile
48
+ - LICENSE
49
+ - README.md
50
+ - Rakefile
51
+ - guard-phpmd.gemspec
52
+ - lib/guard/phpmd.rb
53
+ - lib/guard/phpmd/templates/Guardfile
54
+ homepage: http://github.com/pahen/guard-phpmd
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ requirements: []
81
+
82
+ rubyforge_project: guard-phpmd
83
+ rubygems_version: 1.8.17
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Guard gem for running PHPMD
87
+ test_files: []
88
+