diff --git a/Gemfile b/Gemfile index f0ca252..b4d7a00 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,12 @@ -source :rubygems +source 'https://rubygems.org' gem 'activeresource', '~> 3.0' gem 'activesupport', '~> 3.0' gem 'hashie', "~> 1.2" group :test, :development do - gem 'rspec', '~> 2.0' + gem 'devtools', :git => 'https://github.com/datamapper/devtools.git' gem 'jeweler', "~> 1.8" - gem "simplecov", "~> 0.5", :platform => :ruby_19 gem "rcov", "~> 1.0", :platform => :ruby_18 + eval File.read('Gemfile.devtools') end diff --git a/Gemfile.devtools b/Gemfile.devtools new file mode 100644 index 0000000..0960f53 --- /dev/null +++ b/Gemfile.devtools @@ -0,0 +1,64 @@ +# encoding: utf-8 + +group :development do + gem 'rake', '~> 10.0.3' + gem 'rspec', '~> 2.13.0' + gem 'yard', '~> 0.8.5' +end + +group :yard do + gem 'kramdown', '~> 0.14.2' +end + +group :guard do + gem 'guard', '~> 1.6.2' + gem 'guard-bundler', '~> 1.0.0' + gem 'guard-rspec', '~> 2.4.1' + + # file system change event handling + gem 'rb-fchange', '~> 0.0.6', :require => false + gem 'rb-fsevent', '~> 0.9.3', :require => false + gem 'rb-inotify', '~> 0.9.0', :require => false + + gem 'listen', '~> 0.7.3' + + # notification handling + gem 'libnotify', '~> 0.8.0', :require => false + gem 'rb-notifu', '~> 0.0.4', :require => false + gem 'terminal-notifier-guard', '~> 1.5.3', :require => false +end + +group :metrics do + gem 'flay', '~> 2.1.0' + gem 'flog', '~> 3.2.2' + gem 'reek', '~> 1.3.1', :git => 'https://github.com/troessner/reek.git' + gem 'metric_fu-roodi', '~> 2.2.1' + gem 'yardstick', '~> 0.9.4' + + platforms :ruby_18, :ruby_19 do + # this indirectly depends on ffi which does not build on ruby-head + gem 'yard-spellcheck', '~> 0.1.5' + end + + platforms :mri_19, :rbx do + gem 'mutant', '~> 0.2.20' + end + + platforms :mri_19 do + gem 'simplecov', '~> 0.7.1' + end + + platforms :rbx do + gem 'pelusa', '~> 0.2.2' + end +end + +group :benchmarks do + gem 'rbench', '~> 0.2.3' +end + +platform :jruby do + group :jruby do + gem 'jruby-openssl', '~> 0.8.2' + end +end diff --git a/Gemfile.lock b/Gemfile.lock index b3d2119..88be3fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,43 +1,146 @@ +GIT + remote: https://github.com/datamapper/devtools.git + revision: f0395974dd2ba0552310921ddff83a1adb164e3d + specs: + devtools (0.0.1) + +GIT + remote: https://github.com/troessner/reek.git + revision: 271f468d18c5dafc45d1ce7ed8554a39e20bc5af + specs: + reek (1.3.1) + ruby2ruby (~> 2.0.2) + ruby_parser (~> 3.1.1) + sexp_processor + GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: - activemodel (3.2.2) - activesupport (= 3.2.2) + abstract_type (0.0.5) + backports (~> 3.0, >= 3.0.3) + activemodel (3.2.12) + activesupport (= 3.2.12) builder (~> 3.0.0) - activeresource (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - activesupport (3.2.2) + activeresource (3.2.12) + activemodel (= 3.2.12) + activesupport (= 3.2.12) + activesupport (3.2.12) i18n (~> 0.6) multi_json (~> 1.0) - builder (3.0.0) - diff-lcs (1.1.3) + adamantium (0.0.7) + backports (~> 3.0, >= 3.0.3) + ice_nine (~> 0.7.0) + backports (3.0.3) + builder (3.0.4) + coderay (1.0.9) + descendants_tracker (0.0.1) + diff-lcs (1.2.1) + equalizer (0.0.5) + adamantium (~> 0.0.6) + backports (~> 3.0, >= 3.0.3) + ffi (1.4.0) + ffi-hunspell (0.2.6) + ffi (~> 1.0) + flay (2.1.0) + ruby_parser (~> 3.0) + sexp_processor (~> 4.0) + flog (3.2.2) + ruby_parser (~> 3.1, > 3.1.0) + sexp_processor (~> 4.0) git (1.2.5) + guard (1.6.2) + listen (>= 0.6.0) + lumberjack (>= 1.0.2) + pry (>= 0.9.10) + terminal-table (>= 1.4.3) + thor (>= 0.14.6) + guard-bundler (1.0.0) + bundler (~> 1.0) + guard (~> 1.1) + guard-rspec (2.4.1) + guard (>= 1.1) + rspec (~> 2.11) hashie (1.2.0) - i18n (0.6.0) - jeweler (1.8.3) + i18n (0.6.4) + ice_nine (0.7.0) + inflecto (0.0.2) + jeweler (1.8.4) bundler (~> 1.0) git (>= 1.2.5) rake rdoc - json (1.6.5) - multi_json (1.1.0) - rake (0.9.2.2) + json (1.7.7) + kramdown (0.14.2) + libnotify (0.8.0) + ffi (>= 1.0.11) + listen (0.7.3) + lumberjack (1.0.2) + method_source (0.8.1) + metric_fu-roodi (2.2.1) + ruby_parser + multi_json (1.6.1) + mutant (0.2.20) + abstract_type (~> 0.0.3) + adamantium (~> 0.0.7) + backports (~> 3.0, >= 3.0.3) + descendants_tracker (~> 0.0.1) + diff-lcs (~> 1.2.1) + equalizer (~> 0.0.5) + ice_nine (~> 0.7.0) + inflecto (~> 0.0.2) + rspec (~> 2.13.0) + to_source (~> 0.2.19) + mutant-melbourne (2.0.3) + pelusa (0.2.2) + pry (0.9.12) + coderay (~> 1.0.5) + method_source (~> 0.8) + slop (~> 3.4) + rake (10.0.3) + rb-fchange (0.0.6) + ffi + rb-fsevent (0.9.3) + rb-inotify (0.9.0) + ffi (>= 0.5.0) + rb-notifu (0.0.4) + rbench (0.2.3) rcov (1.0.0) - rdoc (3.12) + rdoc (4.0.0) json (~> 1.4) - rspec (2.9.0) - rspec-core (~> 2.9.0) - rspec-expectations (~> 2.9.0) - rspec-mocks (~> 2.9.0) - rspec-core (2.9.0) - rspec-expectations (2.9.1) - diff-lcs (~> 1.1.3) - rspec-mocks (2.9.0) - simplecov (0.6.1) + rspec (2.13.0) + rspec-core (~> 2.13.0) + rspec-expectations (~> 2.13.0) + rspec-mocks (~> 2.13.0) + rspec-core (2.13.0) + rspec-expectations (2.13.0) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.13.0) + ruby2ruby (2.0.3) + ruby_parser (~> 3.1) + sexp_processor (~> 4.0) + ruby_parser (3.1.1) + sexp_processor (~> 4.1) + sexp_processor (4.1.5) + simplecov (0.7.1) multi_json (~> 1.0) - simplecov-html (~> 0.5.3) - simplecov-html (0.5.3) + simplecov-html (~> 0.7.1) + simplecov-html (0.7.1) + slop (3.4.3) + terminal-notifier-guard (1.5.3) + terminal-table (1.4.5) + thor (0.17.0) + to_source (0.2.20) + abstract_type (~> 0.0.5) + adamantium (~> 0.0.7) + equalizer (~> 0.0.5) + mutant-melbourne (~> 2.0.3) + yard (0.8.5.2) + yard-spellcheck (0.1.5) + ffi-hunspell (~> 0.2) + yard (~> 0.6) + yardstick (0.9.4) + backports (~> 3.0, >= 3.0.3) + yard (~> 0.8.5) PLATFORMS ruby @@ -45,8 +148,32 @@ PLATFORMS DEPENDENCIES activeresource (~> 3.0) activesupport (~> 3.0) + devtools! + flay (~> 2.1.0) + flog (~> 3.2.2) + guard (~> 1.6.2) + guard-bundler (~> 1.0.0) + guard-rspec (~> 2.4.1) hashie (~> 1.2) jeweler (~> 1.8) + jruby-openssl (~> 0.8.2) + kramdown (~> 0.14.2) + libnotify (~> 0.8.0) + listen (~> 0.7.3) + metric_fu-roodi (~> 2.2.1) + mutant (~> 0.2.20) + pelusa (~> 0.2.2) + rake (~> 10.0.3) + rb-fchange (~> 0.0.6) + rb-fsevent (~> 0.9.3) + rb-inotify (~> 0.9.0) + rb-notifu (~> 0.0.4) + rbench (~> 0.2.3) rcov (~> 1.0) - rspec (~> 2.0) - simplecov (~> 0.5) + reek (~> 1.3.1)! + rspec (~> 2.13.0) + simplecov (~> 0.7.1) + terminal-notifier-guard (~> 1.5.3) + yard (~> 0.8.5) + yard-spellcheck (~> 0.1.5) + yardstick (~> 0.9.4) diff --git a/Rakefile b/Rakefile index 0c5db8d..ba804d9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,5 @@ require 'rubygems' +require 'devtools' require 'rake' begin @@ -9,7 +10,7 @@ begin gem.description = %Q{TaskMapper provides a universal API to ticket tracking and project management systems.} gem.email = "info@hybridgroup.com" gem.homepage = "http://ticketrb.com" - gem.authors = ["kiafaldorius", "Sirupsen", "deadprogrammer"] + gem.authors = ["kiafaldorius", "Sirupsen", "deadprogrammer", "cored"] end Jeweler::GemcutterTasks.new rescue LoadError @@ -29,7 +30,7 @@ end task :default => :spec -require 'rake/rdoctask' +require 'rdoc/task' Rake::RDocTask.new do |rdoc| version = File.exist?('VERSION') ? File.read('VERSION') : "" @@ -38,3 +39,5 @@ Rake::RDocTask.new do |rdoc| rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') end + +Devtools.init_rake_tasks diff --git a/config/flay.yml b/config/flay.yml new file mode 100644 index 0000000..ed17636 --- /dev/null +++ b/config/flay.yml @@ -0,0 +1,3 @@ +--- +threshold: 11 +total_score: 103 diff --git a/config/flog.yml b/config/flog.yml new file mode 100644 index 0000000..0cbda36 --- /dev/null +++ b/config/flog.yml @@ -0,0 +1,2 @@ +--- +threshold: 9.8 diff --git a/config/mutant.yml b/config/mutant.yml new file mode 100644 index 0000000..abee832 --- /dev/null +++ b/config/mutant.yml @@ -0,0 +1,3 @@ +--- +name: taskmapper +namespace: TaskMapper diff --git a/config/roodi.yml b/config/roodi.yml new file mode 100644 index 0000000..a88a598 --- /dev/null +++ b/config/roodi.yml @@ -0,0 +1,18 @@ +--- +AbcMetricMethodCheck: { score: 11.0 } +AssignmentInConditionalCheck: { } +CaseMissingElseCheck: { } +ClassLineCountCheck: { line_count: 293 } +ClassNameCheck: { pattern: !ruby/regexp '/\A(?:[A-Z]+|Or|In|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/' } +ClassVariableCheck: { } +CyclomaticComplexityBlockCheck: { complexity: 2 } +CyclomaticComplexityMethodCheck: { complexity: 4 } +EmptyRescueBodyCheck: { } +ForLoopCheck: { } +# TODO: decrease line_count to 5 to 10 +MethodLineCountCheck: { line_count: 14 } +MethodNameCheck: { pattern: !ruby/regexp '/\A(?:[a-z\d](?:_?[a-z\d])+[?!=]?|\[\]=?|==|<=>|[+*&|-])\z/' } +ModuleLineCountCheck: { line_count: 295 } +ModuleNameCheck: { pattern: !ruby/regexp '/\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/' } +# TODO: decrease parameter_count to 2 or less +ParameterNumberCheck: { parameter_count: 3 } diff --git a/config/site.reek b/config/site.reek new file mode 100644 index 0000000..236fd1e --- /dev/null +++ b/config/site.reek @@ -0,0 +1,100 @@ +--- +UnusedParameters: + exclude: + - AQL::Node#emit +UncommunicativeParameterName: + accept: [] + exclude: [] + enabled: true + reject: + - !ruby/regexp /^.$/ + - !ruby/regexp /[0-9]$/ + - !ruby/regexp /[A-Z]/ +LargeClass: + max_methods: 10 + exclude: [] + enabled: true + max_instance_variables: 2 +UncommunicativeMethodName: + accept: [] + exclude: [] + enabled: true + reject: + - !ruby/regexp /^[a-z]$/ + - !ruby/regexp /[0-9]$/ + - !ruby/regexp /[A-Z]/ +LongParameterList: + max_params: 2 + exclude: + - AQL::Buffer#wrap_delimited # 3 params + - AQL::Buffer#binary # 3 params + enabled: true + overrides: {} +FeatureEnvy: + exclude: + - AQL::Node::Block#emit # Definitive a false positive + - AQL::Node::Call#for_argument? # Definitive a false positive + enabled: true +ClassVariable: + exclude: [] + enabled: true +BooleanParameter: + exclude: [] + enabled: true +IrresponsibleModule: + exclude: [] + enabled: true +UncommunicativeModuleName: + accept: [] + exclude: [] + enabled: true + reject: + - !ruby/regexp /^.$/ + - !ruby/regexp /[0-9]$/ +NestedIterators: + ignore_iterators: [] + exclude: [] + enabled: true + max_allowed_nesting: 1 +LongMethod: + max_statements: 5 + exclude: + - AQL::Buffer#binary # 6 statements + - AQL::Node::Operation::For#emit # 6 statements + enabled: true +Duplication: + allow_calls: [] + exclude: [] + enabled: true + max_calls: 1 +UtilityFunction: + max_helper_calls: 1 + exclude: [] + enabled: true +Attribute: + exclude: [] + enabled: false +UncommunicativeVariableName: + accept: [] + exclude: [] + enabled: true + reject: + - !ruby/regexp /^.$/ + - !ruby/regexp /[0-9]$/ + - !ruby/regexp /[A-Z]/ +SimulatedPolymorphism: + exclude: [] + enabled: true + max_ifs: 1 +DataClump: + exclude: [] + enabled: true + max_copies: 1 + min_clump_size: 3 +ControlCouple: + exclude: [] + enabled: true +LongYieldList: + max_params: 1 + exclude: [] + enabled: true diff --git a/config/yardstick.yml b/config/yardstick.yml new file mode 100644 index 0000000..a6b63e8 --- /dev/null +++ b/config/yardstick.yml @@ -0,0 +1,2 @@ +--- +threshold: 100 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9465c76..71c6e7f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,8 +2,11 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'taskmapper.rb' require 'taskmapper/dummy/dummy.rb' +require 'devtools' require 'rspec' +Devtools.init_spec_helper + RSpec.configure do |config| config.color_enabled = true end diff --git a/spec/project_spec.rb b/spec/unit/project_spec.rb similarity index 97% rename from spec/project_spec.rb rename to spec/unit/project_spec.rb index 7e474f2..15860b2 100644 --- a/spec/project_spec.rb +++ b/spec/unit/project_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path(File.dirname(__FILE__) + '/spec_helper') +require 'spec_helper' # This can also act as an example test or test skeleton for your provider. # Just replace the Dummy in @project_class and @ticket_class diff --git a/spec/taskmapper-cli_spec.rb b/spec/unit/taskmapper-cli_spec.rb similarity index 84% rename from spec/taskmapper-cli_spec.rb rename to spec/unit/taskmapper-cli_spec.rb index 90fa6ee..d88793a 100644 --- a/spec/taskmapper-cli_spec.rb +++ b/spec/unit/taskmapper-cli_spec.rb @@ -1,6 +1,6 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -require File.expand_path(File.dirname(__FILE__) + '/spec_helper') +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../..', 'lib')) +require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') require 'fileutils' @@ -8,8 +8,8 @@ # I'm not quite sure what the most effective way to test this is... describe "TaskMapper CLI" do before(:all) do - @ticket = File.expand_path(File.dirname(__FILE__) + '/../bin/tm') - @cli_dir = File.expand_path(File.dirname(__FILE__) + '/../lib/taskmapper/cli') + @ticket = File.expand_path(File.dirname(__FILE__) + '/../../bin/tm') + @cli_dir = File.expand_path(File.dirname(__FILE__) + '/../../lib/taskmapper/cli') end it "should output help if no command given" do diff --git a/spec/taskmapper-exception_spec.rb b/spec/unit/taskmapper-exception_spec.rb similarity index 99% rename from spec/taskmapper-exception_spec.rb rename to spec/unit/taskmapper-exception_spec.rb index 0b525ce..1e6a359 100644 --- a/spec/taskmapper-exception_spec.rb +++ b/spec/unit/taskmapper-exception_spec.rb @@ -1,6 +1,6 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -require File.expand_path(File.dirname(__FILE__) + '/spec_helper') +require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') require 'rubygems' require 'taskmapper' diff --git a/spec/taskmapper_spec.rb b/spec/unit/taskmapper_spec.rb similarity index 86% rename from spec/taskmapper_spec.rb rename to spec/unit/taskmapper_spec.rb index 96dcc1e..07d977a 100644 --- a/spec/taskmapper_spec.rb +++ b/spec/unit/taskmapper_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path(File.dirname(__FILE__) + '/spec_helper') +require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') # This can also act as an example test or test skeleton for your provider. # Just replace the Dummy in @project_class and @ticket_class diff --git a/spec/ticket_spec.rb b/spec/unit/ticket_spec.rb similarity index 96% rename from spec/ticket_spec.rb rename to spec/unit/ticket_spec.rb index 4687504..4067a1a 100644 --- a/spec/ticket_spec.rb +++ b/spec/unit/ticket_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path(File.dirname(__FILE__) + '/spec_helper') +require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') # This can also act as an example test or test skeleton for your provider. # Just replace the Dummy in @project_class and @ticket_class