objective-ci 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/.gitignore +17 -0
  2. data/BSD-LICENSE.txt +31 -0
  3. data/GPL-LICENSE.txt +16 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +92 -0
  7. data/Rakefile +24 -0
  8. data/bin/ada_count +4 -0
  9. data/bin/asm_count +4 -0
  10. data/bin/awk_count +4 -0
  11. data/bin/break_filelist +4 -0
  12. data/bin/c_count +4 -0
  13. data/bin/cobol_count +4 -0
  14. data/bin/compute_all +4 -0
  15. data/bin/compute_sloc_lang +4 -0
  16. data/bin/count_extensions +4 -0
  17. data/bin/count_unknown_ext +4 -0
  18. data/bin/csh_count +4 -0
  19. data/bin/exp_count +4 -0
  20. data/bin/f90_count +4 -0
  21. data/bin/fortran_count +4 -0
  22. data/bin/generic_count +4 -0
  23. data/bin/get_sloc +4 -0
  24. data/bin/get_sloc_details +4 -0
  25. data/bin/haskell_count +4 -0
  26. data/bin/java_count +4 -0
  27. data/bin/jsp_count +4 -0
  28. data/bin/lex_count +4 -0
  29. data/bin/lexcount1 +4 -0
  30. data/bin/lisp_count +4 -0
  31. data/bin/make_filelists +4 -0
  32. data/bin/makefile_count +4 -0
  33. data/bin/ml_count +4 -0
  34. data/bin/modula3_count +4 -0
  35. data/bin/objc_count +4 -0
  36. data/bin/oclint-0.8 +4 -0
  37. data/bin/oclint-json-compilation-database +4 -0
  38. data/bin/oclint-xcodebuild +4 -0
  39. data/bin/pascal_count +4 -0
  40. data/bin/perl_count +4 -0
  41. data/bin/php_count +4 -0
  42. data/bin/pmd-cpd-objc +7 -0
  43. data/bin/print_sum +4 -0
  44. data/bin/python_count +4 -0
  45. data/bin/ruby_count +4 -0
  46. data/bin/sed_count +4 -0
  47. data/bin/sh_count +4 -0
  48. data/bin/show_filecount +4 -0
  49. data/bin/sloccount +4 -0
  50. data/bin/sql_count +4 -0
  51. data/bin/tcl_count +4 -0
  52. data/docs/jenkins-setup-violations.png +0 -0
  53. data/docs/jenkins-setup.jpg +0 -0
  54. data/externals/oclint/oclint-0.8 +0 -0
  55. data/externals/oclint/oclint-json-compilation-database +86 -0
  56. data/externals/oclint/oclint-xcodebuild +216 -0
  57. data/externals/pmd-cpd/ObjCLanguage-0.0.7-SNAPSHOT.jar +0 -0
  58. data/externals/pmd-cpd/pmd-4.2.5.jar +0 -0
  59. data/externals/sloccount/ada_count +27 -0
  60. data/externals/sloccount/asm_count +166 -0
  61. data/externals/sloccount/awk_count +27 -0
  62. data/externals/sloccount/break_filelist +1308 -0
  63. data/externals/sloccount/c_count +0 -0
  64. data/externals/sloccount/cobol_count +82 -0
  65. data/externals/sloccount/compute_all +87 -0
  66. data/externals/sloccount/compute_sloc_lang +66 -0
  67. data/externals/sloccount/count_extensions +56 -0
  68. data/externals/sloccount/count_unknown_ext +32 -0
  69. data/externals/sloccount/csh_count +27 -0
  70. data/externals/sloccount/exp_count +27 -0
  71. data/externals/sloccount/f90_count +81 -0
  72. data/externals/sloccount/fortran_count +83 -0
  73. data/externals/sloccount/generic_count +77 -0
  74. data/externals/sloccount/get_sloc +544 -0
  75. data/externals/sloccount/get_sloc_details +103 -0
  76. data/externals/sloccount/haskell_count +122 -0
  77. data/externals/sloccount/java_count +0 -0
  78. data/externals/sloccount/jsp_count +0 -0
  79. data/externals/sloccount/lex_count +70 -0
  80. data/externals/sloccount/lexcount1 +0 -0
  81. data/externals/sloccount/lisp_count +27 -0
  82. data/externals/sloccount/make_filelists +193 -0
  83. data/externals/sloccount/makefile_count +27 -0
  84. data/externals/sloccount/ml_count +0 -0
  85. data/externals/sloccount/modula3_count +65 -0
  86. data/externals/sloccount/objc_count +89 -0
  87. data/externals/sloccount/pascal_count +0 -0
  88. data/externals/sloccount/perl_count +147 -0
  89. data/externals/sloccount/php_count +0 -0
  90. data/externals/sloccount/print_sum +40 -0
  91. data/externals/sloccount/python_count +120 -0
  92. data/externals/sloccount/ruby_count +27 -0
  93. data/externals/sloccount/sed_count +27 -0
  94. data/externals/sloccount/sh_count +27 -0
  95. data/externals/sloccount/show_filecount +58 -0
  96. data/externals/sloccount/sloccount +258 -0
  97. data/externals/sloccount/sql_count +76 -0
  98. data/externals/sloccount/tcl_count +27 -0
  99. data/lib/objective-ci.rb +3 -0
  100. data/lib/objective_ci/ci_tasks.rb +142 -0
  101. data/lib/objective_ci/version.rb +3 -0
  102. data/objective-ci.gemspec +26 -0
  103. metadata +255 -0
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/BSD-LICENSE.txt ADDED
@@ -0,0 +1,31 @@
1
+ Copyright (c) 2002-2009, InfoEther, Inc
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are
6
+ met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+ * The end-user documentation included with the redistribution, if
14
+ any, must include the following acknowledgement:
15
+ "This product includes software developed in part by support from
16
+ the Defense Advanced Research Project Agency (DARPA)"
17
+ * Neither the name of InfoEther, LLC nor the names of its
18
+ contributors may be used to endorse or promote products derived from
19
+ this software without specific prior written permission.
20
+
21
+ Copyright (C) 2010-2013 Longyi Qi. All rights reserved.
22
+
23
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
24
+
25
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
26
+
27
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
28
+
29
+ * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
30
+
31
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/GPL-LICENSE.txt ADDED
@@ -0,0 +1,16 @@
1
+ SLOCCount
2
+ Copyright (C) 2000-2001 David A. Wheeler (dwheeler, at, dwheeler.com)
3
+
4
+ This program is free software; you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation; either version 2 of the License, or
7
+ (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program; if not, write to the Free Software
16
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in objective-ci.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Sport Ngin (http://sportngin.com)
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # ObjectiveCi
2
+
3
+ Get up and running with useful metrics for your iOS project, integrated into a CI.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'objective-ci', :git => 'https://github.com/SportNginLabs/objective-ci.git'
10
+
11
+ Retrieval from git is required, as the gem includes many binaries and jars, pushing the size up to ~70mb (too large for rubygems.org)
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+
18
+ ## Usage
19
+
20
+ In your rakefile, make a new task
21
+
22
+ ```ruby
23
+ require 'bundler/setup'
24
+ require 'objective-ci'
25
+
26
+ :namespace ci do
27
+ :task build do
28
+ # Takes care of installing pods and adding "Pods" to exclusions if Podfile is detected
29
+ objective_ci = ObjectiveCi::CiTasks.new
30
+
31
+ # Add the path of any folders/files that should not be included in the metrics
32
+ objective_ci.exclusions << "ExternalFrameworksFolder"
33
+
34
+ # Run all of the metrics on your workspace (or project)
35
+ objective_ci.build(:workspace => "iPhoneProject.xcworkspace", :scheme => "iPhoneProjectReleaseScheme")
36
+
37
+ # Or, choose which metrics you want to run on your project (or workspace)
38
+ objective_ci.lint(:project => "iPhoneProject.project", :scheme => "iPhoneProjectReleaseScheme") # Generates lint.xml
39
+ objective_ci.test_suite(:project => "iPhoneProject.project", :scheme => "iPhoneProjectReleaseScheme") # Generates test-reports/*.xml
40
+ objective_ci.lines_of_code # Generates line-count.sc
41
+ objective_ci.duplicate_code_detection # Generates duplication.xml
42
+ end
43
+ end
44
+ ```
45
+
46
+ The CI server of choice is Jenkins -- install the plugins for the metrics you plan on using.
47
+
48
+ * lint: https://wiki.jenkins-ci.org/display/JENKINS/PMD+Plugin
49
+ * lines_of_code: https://wiki.jenkins-ci.org/display/JENKINS/SLOCCount+Plugin
50
+ * duplicate_code_detection: https://wiki.jenkins-ci.org/display/JENKINS/Violations (This could technically be used for lint also, but PMD has friendlier sorting on the front-end)
51
+ * test_suite: JUNIT reporting is built into Jenkins.
52
+
53
+ In Jenkins, call the rake task and load in the generated files
54
+
55
+ ![Jenkins Screenshot](/docs/jenkins-setup.jpg)
56
+ ![Jenkins Screenshot - Violations](/docs/jenkins-setup-violations.png)
57
+
58
+ Triggering a build should now show the metrics in the build.
59
+
60
+ ### Code signing
61
+
62
+ **Make sure to import any code signing certificates into Xcode on the continuous integration server, and to keep the provisioning profiles up to date. And, most importantly, the first time your code signing certificates are used with `objective-ci`, a dialog will appear asking you to allow `xcodebuild` to access the keychain. Click `always allow`**
63
+
64
+ ## Advanced
65
+
66
+ If you peruse the binaries that `objective-ci` is using, and their documentation, you might find that you'd like to throw in some extra configurations. Go wild.
67
+
68
+ * [OCLint 0.8dev](http://docs.oclint.org/en/dev/)
69
+ * [SLOCCount](http://www.dwheeler.com/sloccount/)
70
+ * [xcodebuild](https://www.google.com/url?sa=f&rct=j&url=http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html&q=&esrc=s&ei=kB5mUvyQCbL62gWN8IGgAg&usg=AFQjCNG065ry1JvpdG4kiuAmQZTP-yotRQ)
71
+
72
+ These binaries currently support extra command-line arguments by passing in the option `:binaryname_options => "--your "options"`
73
+
74
+ For example, if you'd like to setup `OCLint` to only generate long-line warnings when lines exceed 120 characters in length, you could do
75
+ ```ruby
76
+ objective_ci = ObjectiveCi::CiTasks.new
77
+ objective_ci.build(:workspace => "FooApp.xcworkspace",
78
+ :scheme => "FooApp",
79
+ :"oclint-json-compilation-database_options" => "-rc=LONG_LINE=120")
80
+ ```
81
+
82
+ In addition to the blanketed `:binaryname_options` options, a few tasks support additional options.
83
+
84
+ * `duplicate_code` supports `:minimum_tokens`, which defaults to 100. This value will determine what the minimum amount of duplicated tokens is to constitute as a copy and paste violation.
85
+
86
+ ## Contributing
87
+
88
+ 1. Fork it
89
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
90
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
91
+ 4. Push to the branch (`git push origin my-new-feature`)
92
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ namespace :bin do
4
+ task :setup do
5
+ binaries_location = "./externals"
6
+ %W(sloccount oclint).each do |executable_dir|
7
+ executable_dir_path = "#{binaries_location}/#{executable_dir}"
8
+ binaries = Dir.entries(executable_dir_path).select {|f| !File.directory? f}
9
+ binaries.each do |binary|
10
+ contents = <<-RUBY
11
+ require 'pathname'
12
+ pn = Pathname.new(__FILE__)
13
+ opts = ARGV.join(" ")
14
+ puts `"\#{pn.dirname}/../#{executable_dir_path}/\#{pn.basename}" \#{opts}`
15
+ RUBY
16
+
17
+ gem_binary_path = "./bin/#{binary}"
18
+ File.open(gem_binary_path, 'w') { |file| file.write(contents) }
19
+ FileUtils.chmod('a+x', [gem_binary_path])
20
+ puts "#{gem_binary_path} generated"
21
+ end
22
+ end
23
+ end
24
+ end
data/bin/ada_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/asm_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/awk_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/c_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/cobol_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/compute_all ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/csh_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/exp_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/f90_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/fortran_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/generic_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/get_sloc ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/haskell_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/java_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/jsp_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/lex_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/lexcount1 ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/lisp_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/ml_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/modula3_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/objc_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/oclint-0.8 ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/oclint/#{pn.basename}" #{opts}`
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/oclint/#{pn.basename}" #{opts}`
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/oclint/#{pn.basename}" #{opts}`
data/bin/pascal_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/perl_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/php_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/pmd-cpd-objc ADDED
@@ -0,0 +1,7 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ pmd_dir = "#{pn.dirname}/.././externals/pmd-cpd"
5
+ pmd_command = %Q(java -Xmx512m -classpath "#{pmd_dir}/pmd-4.2.5.jar":"#{pmd_dir}/ObjCLanguage-0.0.7-SNAPSHOT.jar")
6
+ pmd_command += %Q( net.sourceforge.pmd.cpd.CPD --files . --language ObjectiveC --encoding UTF-8 --format net.sourceforge.pmd.cpd.XMLRenderer)
7
+ puts `#{pmd_command} #{opts}`
data/bin/print_sum ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/python_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/ruby_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/sed_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/sh_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/sloccount ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/sql_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
data/bin/tcl_count ADDED
@@ -0,0 +1,4 @@
1
+ require 'pathname'
2
+ pn = Pathname.new(__FILE__)
3
+ opts = ARGV.join(" ")
4
+ puts `"#{pn.dirname}/.././externals/sloccount/#{pn.basename}" #{opts}`
Binary file
Binary file
Binary file
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env python
2
+
3
+ import os
4
+ import platform
5
+ import json
6
+ import argparse
7
+ import re
8
+ import subprocess
9
+ import sys
10
+
11
+ OCLINT_BIN_FOLDER = os.path.dirname(os.path.abspath(__file__))
12
+ OCLINT_BIN = OCLINT_BIN_FOLDER + os.sep + "oclint"
13
+ if platform.system() == "Windows":
14
+ OCLINT_BIN += ".exe"
15
+ CURRENT_WORKING_DIRECTORY = os.getcwd()
16
+ JSON_COMPILATION_DATABASE = CURRENT_WORKING_DIRECTORY + os.sep + "compile_commands.json"
17
+
18
+ arg_parser = argparse.ArgumentParser(description='OCLint for JSON Compilation Database (compile_commands.json)')
19
+ arg_parser.add_argument("-v", action="store_true", dest="invocation", help="show invocation command with arguments")
20
+ arg_parser.add_argument('-debug', '--debug', action="store_true", dest="debug", help="invoke OCLint in debug mode")
21
+ arg_parser.add_argument('-i', '-include', '--include', action='append', dest='includes', help="extract files matching pattern")
22
+ arg_parser.add_argument('-e', '-exclude', '--exclude', action='append', dest='excludes', help="remove files matching pattern")
23
+ arg_parser.add_argument('oclint_args', nargs='*', help="arguments that are passed to OCLint invocation")
24
+ args = arg_parser.parse_args()
25
+
26
+ def get_source_path(file_attr, dir_attr):
27
+ if file_attr.startswith(os.sep):
28
+ return file_attr
29
+ elif dir_attr.endswith(os.sep):
30
+ return dir_attr + file_attr
31
+ else:
32
+ return dir_attr + os.sep + file_attr
33
+
34
+ def source_exist_at(path):
35
+ return os.path.isfile(path)
36
+
37
+ def source_list_inclusion_filter(source_list, inclusion_filter):
38
+ filtered_list = []
39
+ for path in source_list:
40
+ if re.search(inclusion_filter, path):
41
+ filtered_list.append(path)
42
+ return filtered_list
43
+
44
+ def source_list_exclusion_filter(source_list, exclusion_filter):
45
+ filtered_list = []
46
+ for path in source_list:
47
+ if not re.search(exclusion_filter, path):
48
+ filtered_list.append(path)
49
+ return filtered_list
50
+
51
+ if not source_exist_at(OCLINT_BIN):
52
+ print "Error: OCLint executable file not found."
53
+ sys.exit(99)
54
+
55
+ if not source_exist_at(JSON_COMPILATION_DATABASE):
56
+ print "Error: compile_commands.json not found at current location."
57
+ sys.exit(98)
58
+
59
+ compilation_database = json.load(open(JSON_COMPILATION_DATABASE))
60
+ source_list = []
61
+ for file_item in compilation_database:
62
+ file_path = file_item["file"]
63
+ if not platform.system() == "Windows":
64
+ file_path = get_source_path(file_item["file"], file_item["directory"])
65
+ if source_exist_at(file_path) and not file_path in source_list:
66
+ source_list.append(file_path)
67
+ if args.includes:
68
+ for inclusion_filter in args.includes:
69
+ source_list = source_list_inclusion_filter(source_list, inclusion_filter)
70
+ if args.excludes:
71
+ for exclusion_filter in args.excludes:
72
+ source_list = source_list_exclusion_filter(source_list, exclusion_filter)
73
+ source_paths = '"' + '" "'.join(source_list) + '"'
74
+ oclint_arguments = ''
75
+ if args.oclint_args:
76
+ oclint_arguments = ' ' + ' '.join(args.oclint_args)
77
+ debug_argument = ''
78
+ if args.debug:
79
+ debug_argument = ' -debug'
80
+ oclint_invocation = OCLINT_BIN + debug_argument + oclint_arguments + ' ' + source_paths
81
+ if args.invocation:
82
+ print '------------------------------ OCLint ------------------------------'
83
+ print oclint_invocation
84
+ print '--------------------------------------------------------------------'
85
+ exit_code = subprocess.call(oclint_invocation, shell=True)
86
+ sys.exit(exit_code)