devtools 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/Gemfile +0 -2
  4. data/README.md +2 -2
  5. data/circle.yml +1 -1
  6. data/config/devtools.yml +2 -0
  7. data/config/flay.yml +2 -2
  8. data/config/flog.yml +1 -1
  9. data/config/mutant.yml +2 -0
  10. data/config/reek.yml +7 -12
  11. data/devtools.gemspec +20 -18
  12. data/lib/devtools.rb +34 -83
  13. data/lib/devtools/config.rb +76 -55
  14. data/lib/devtools/flay.rb +94 -0
  15. data/lib/devtools/project.rb +28 -105
  16. data/lib/devtools/project/initializer.rb +2 -12
  17. data/lib/devtools/project/initializer/rake.rb +9 -7
  18. data/lib/devtools/project/initializer/rspec.rb +28 -55
  19. data/lib/devtools/rake/flay.rb +126 -0
  20. data/lib/devtools/spec_helper.rb +1 -3
  21. data/shared/spec/shared/abstract_type_behavior.rb +0 -2
  22. data/shared/spec/shared/command_method_behavior.rb +0 -2
  23. data/shared/spec/shared/each_method_behaviour.rb +0 -2
  24. data/shared/spec/shared/hash_method_behavior.rb +0 -2
  25. data/shared/spec/shared/idempotent_method_behavior.rb +0 -2
  26. data/shared/spec/support/ice_nine_config.rb +0 -2
  27. data/spec/integration/devtools/rake/flay/verify_spec.rb +164 -0
  28. data/spec/spec_helper.rb +2 -8
  29. data/spec/unit/devtools/config/yardstick_spec.rb +17 -0
  30. data/spec/unit/devtools/config_spec.rb +78 -0
  31. data/spec/unit/devtools/flay/file_list/call_spec.rb +19 -0
  32. data/spec/unit/devtools/flay/scale/flay_report_spec.rb +17 -0
  33. data/spec/unit/devtools/flay/scale/measure_spec.rb +43 -0
  34. data/spec/unit/devtools/project/initializer/rake_spec.rb +21 -0
  35. data/spec/unit/devtools/project/initializer/rspec_spec.rb +52 -0
  36. data/spec/unit/devtools/project_spec.rb +34 -0
  37. data/spec/unit/devtools_spec.rb +14 -0
  38. data/tasks/metrics/ci.rake +1 -3
  39. data/tasks/metrics/coverage.rake +0 -2
  40. data/tasks/metrics/flay.rake +6 -33
  41. data/tasks/metrics/flog.rake +0 -2
  42. data/tasks/metrics/mutant.rake +31 -39
  43. data/tasks/metrics/reek.rake +0 -2
  44. data/tasks/metrics/rubocop.rake +0 -2
  45. data/tasks/metrics/yardstick.rake +0 -14
  46. data/tasks/spec.rake +0 -2
  47. data/tasks/yard.rake +0 -2
  48. metadata +96 -31
  49. data/.travis.yml +0 -15
  50. data/TODO +0 -0
  51. data/bin/devtools +0 -18
  52. data/default/config/devtools.yml +0 -2
  53. data/default/config/flay.yml +0 -3
  54. data/default/config/flog.yml +0 -2
  55. data/default/config/mutant.yml +0 -3
  56. data/default/config/reek.yml +0 -103
  57. data/default/config/rubocop.yml +0 -91
  58. data/default/config/yardstick.yml +0 -2
  59. data/lib/devtools/platform.rb +0 -118
  60. data/lib/devtools/site.rb +0 -41
  61. data/lib/devtools/site/initializer.rb +0 -57
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- bundler_args: --without yard guard benchmarks
4
- script: "bundle exec rake ci"
5
- rvm:
6
- - '2.1'
7
- - '2.2'
8
- - rbx
9
- matrix:
10
- include:
11
- - rvm: jruby
12
- env: JRUBY_OPTS="$JRUBY_OPTS --debug --2.0"
13
- allow_failures:
14
- - rvm: jruby
15
- - rvm: rbx
data/TODO DELETED
File without changes
data/bin/devtools DELETED
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require 'bundler'
5
-
6
- Bundler.setup
7
-
8
- require 'devtools'
9
-
10
- command = ARGV.first
11
-
12
- case command
13
- when 'init' then Devtools.init
14
- when 'sync' then Devtools.sync
15
- when 'update' then Devtools.update
16
- else
17
- puts 'command not supported'
18
- end
@@ -1,2 +0,0 @@
1
- ---
2
- unit_test_timeout: 0.1
@@ -1,3 +0,0 @@
1
- ---
2
- threshold: 0
3
- total_score: 0
@@ -1,2 +0,0 @@
1
- ---
2
- threshold: 0
@@ -1,3 +0,0 @@
1
- ---
2
- name: your_lib
3
- namespace: YourLib
@@ -1,103 +0,0 @@
1
- ---
2
- Attribute:
3
- enabled: true
4
- exclude: []
5
- BooleanParameter:
6
- enabled: true
7
- exclude: []
8
- ClassVariable:
9
- enabled: true
10
- exclude: []
11
- ControlParameter:
12
- enabled: true
13
- exclude: []
14
- DataClump:
15
- enabled: true
16
- exclude: []
17
- max_copies: 2
18
- min_clump_size: 2
19
- DuplicateMethodCall:
20
- enabled: true
21
- exclude: []
22
- max_calls: 1
23
- allow_calls: []
24
- FeatureEnvy:
25
- enabled: true
26
- exclude: []
27
- IrresponsibleModule:
28
- enabled: true
29
- exclude: []
30
- LongParameterList:
31
- enabled: true
32
- exclude: []
33
- max_params: 2
34
- overrides:
35
- initialize:
36
- max_params: 3
37
- LongYieldList:
38
- enabled: true
39
- exclude: []
40
- max_params: 2
41
- NestedIterators:
42
- enabled: true
43
- exclude: []
44
- max_allowed_nesting: 1
45
- ignore_iterators: []
46
- NilCheck:
47
- enabled: true
48
- exclude: []
49
- RepeatedConditional:
50
- enabled: true
51
- exclude: []
52
- max_ifs: 1
53
- TooManyInstanceVariables:
54
- enabled: true
55
- exclude: []
56
- max_instance_variables: 3
57
- TooManyMethods:
58
- enabled: true
59
- exclude: []
60
- max_methods: 10
61
- TooManyStatements:
62
- enabled: true
63
- exclude:
64
- - each
65
- max_statements: 2
66
- UncommunicativeMethodName:
67
- enabled: true
68
- exclude: []
69
- reject:
70
- - !ruby/regexp /^[a-z]$/
71
- - !ruby/regexp /[0-9]$/
72
- - !ruby/regexp /[A-Z]/
73
- accept: []
74
- UncommunicativeModuleName:
75
- enabled: true
76
- exclude: []
77
- reject:
78
- - !ruby/regexp /^.$/
79
- - !ruby/regexp /[0-9]$/
80
- accept: []
81
- UncommunicativeParameterName:
82
- enabled: true
83
- exclude: []
84
- reject:
85
- - !ruby/regexp /^.$/
86
- - !ruby/regexp /[0-9]$/
87
- - !ruby/regexp /[A-Z]/
88
- accept: []
89
- UncommunicativeVariableName:
90
- enabled: true
91
- exclude: []
92
- reject:
93
- - !ruby/regexp /^.$/
94
- - !ruby/regexp /[0-9]$/
95
- - !ruby/regexp /[A-Z]/
96
- accept: []
97
- UnusedParameters:
98
- enabled: true
99
- exclude: []
100
- UtilityFunction:
101
- enabled: true
102
- exclude: []
103
- max_helper_calls: 0
@@ -1,91 +0,0 @@
1
- AllCops:
2
- Includes:
3
- - '**/*.rake'
4
- - 'Gemfile'
5
- Excludes:
6
- - '**/vendor/**'
7
- - '**/benchmarks/**'
8
-
9
- # Avoid parameter lists longer than five parameters.
10
- ParameterLists:
11
- Max: 3
12
- CountKeywordArgs: true
13
-
14
- # Limit method length
15
- MethodLength:
16
- CountComments: false
17
- Max: 10
18
-
19
- # Avoid more than `Max` levels of nesting.
20
- BlockNesting:
21
- Max: 3
22
-
23
- # Align with the style guide.
24
- CollectionMethods:
25
- PreferredMethods:
26
- collect: 'map'
27
- inject: 'reduce'
28
- find: 'detect'
29
- find_all: 'select'
30
-
31
- # Do not force public/protected/private keyword to be indented at the same
32
- # level as the def keyword. My personal preference is to outdent these keywords
33
- # because I think when scanning code it makes it easier to identify the
34
- # sections of code and visually separate them. When the keyword is at the same
35
- # level I think it sort of blends in with the def keywords and makes it harder
36
- # to scan the code and see where the sections are.
37
- AccessModifierIndentation:
38
- Enabled: false
39
-
40
- # Limit line length
41
- LineLength:
42
- Max: 79
43
-
44
- # Disable documentation checking until a class needs to be documented once
45
- Documentation:
46
- Enabled: false
47
-
48
- # Do not always use &&/|| instead of and/or.
49
- AndOr:
50
- Enabled: false
51
-
52
- # Do not favor modifier if/unless usage when you have a single-line body
53
- IfUnlessModifier:
54
- Enabled: false
55
-
56
- # Allow case equality operator (in limited use within the specs)
57
- CaseEquality:
58
- Enabled: false
59
-
60
- # Constants do not always have to use SCREAMING_SNAKE_CASE
61
- ConstantName:
62
- Enabled: false
63
-
64
- # Not all trivial readers/writers can be defined with attr_* methods
65
- TrivialAccessors:
66
- Enabled: false
67
-
68
- # Do not prefer do/end over {} for multiline blocks
69
- Blocks:
70
- Enabled: false
71
-
72
- # Allow empty lines around body
73
- EmptyLinesAroundBody:
74
- Enabled: false
75
-
76
- # Prefer String#% over Kernel#sprintf
77
- FormatString:
78
- Enabled: false
79
-
80
- # Use square brackets for literal Array objects
81
- PercentLiteralDelimiters:
82
- PreferredDelimiters:
83
- '%': ()
84
- '%i': '[]'
85
- '%q': ()
86
- '%Q': ()
87
- '%r': '{}'
88
- '%s': ()
89
- '%w': '[]'
90
- '%W': '[]'
91
- '%x': ()
@@ -1,2 +0,0 @@
1
- ---
2
- threshold: 100
@@ -1,118 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Devtools
4
-
5
- # Provides methods to determine the ruby platform
6
- module Platform
7
-
8
- DEFAULT_RVM_NAME = 'mri'.freeze
9
-
10
- # Return Ruby engine string
11
- #
12
- # @return [String]
13
- #
14
- # @api private
15
- def ruby_engine
16
- @ruby_engine ||= (defined?(RUBY_ENGINE) && RUBY_ENGINE || 'ruby').freeze
17
- end
18
-
19
- # Return RVM name
20
- #
21
- # @return [String]
22
- #
23
- # @api private
24
- def rvm_name
25
- @rvm_name ||= begin
26
- engine = ruby_engine
27
- engine == 'ruby' ? DEFAULT_RVM_NAME : engine
28
- end
29
- end
30
-
31
- # Return RVM string
32
- #
33
- # @return [String]
34
- #
35
- # @api private
36
- def rvm
37
- @rvm ||= "#{rvm_name}-#{RUBY_VERSION}".freeze
38
- end
39
-
40
- # Test for being executed under JRuby
41
- #
42
- # @return [true]
43
- # if running under JRuby
44
- #
45
- # @return [false]
46
- # otherwise
47
- #
48
- # @api private
49
- def jruby?
50
- ruby_engine == 'jruby'
51
- end
52
-
53
- # Test for being executed under rbx
54
- #
55
- # @return [true]
56
- # if running under rbx
57
- #
58
- # @return [false]
59
- # otherwise
60
- #
61
- # @api private
62
- def rbx?
63
- ruby_engine == 'rbx'
64
- end
65
-
66
- # Test for being executed under rubies with a JIT
67
- #
68
- # @return [true]
69
- # if running under JRuby or rbx
70
- #
71
- # @return [false]
72
- # otherwise
73
- #
74
- # @api private
75
- def jit?
76
- jruby? || rbx?
77
- end
78
-
79
- # Test for 1.8 mode
80
- #
81
- # @return [true]
82
- # if running under 1.8.x
83
- #
84
- # @return [false]
85
- # otherwise
86
- #
87
- # @api private
88
- def ruby18?
89
- RUBY_VERSION.start_with?('1.8.')
90
- end
91
-
92
- # Test for 1.9 mode
93
- #
94
- # @return [true]
95
- # if running under 1.9.x
96
- #
97
- # @return [false]
98
- # otherwise
99
- #
100
- # @api private
101
- def ruby19?
102
- RUBY_VERSION.start_with?('1.9.')
103
- end
104
-
105
- # Test for 2.0 mode
106
- #
107
- # @return [true]
108
- # if running under 2.0.x
109
- #
110
- # @return [false]
111
- # otherwise
112
- #
113
- # @api private
114
- def ruby20?
115
- RUBY_VERSION.start_with?('2.0.')
116
- end
117
- end # module Platform
118
- end # module Devtools
data/lib/devtools/site.rb DELETED
@@ -1,41 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Devtools
4
-
5
- # Encapsulates a specific {Project} devtools is used for
6
- class Site
7
-
8
- attr_reader :root
9
-
10
- attr_reader :project
11
-
12
- def initialize(project)
13
- @project = project
14
- @root = project.root
15
- end
16
-
17
- # Initialize project and load shared specs
18
- #
19
- # Expects to be called from $application_root/spec/spec_helper.rb
20
- #
21
- # @return [self]
22
- #
23
- # @api private
24
- def init_spec_helper
25
- Project::Initializer::Rspec.call(project)
26
- self
27
- end
28
-
29
- # Initialize devtools using default config
30
- #
31
- # @return [undefined]
32
- #
33
- # @api private
34
- def init
35
- Initializer.call(self)
36
- puts 'Run bundle install to complete the devtools installation'
37
- self
38
- end
39
-
40
- end # class Site
41
- end # module Devtools
@@ -1,57 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Devtools
4
- class Site
5
-
6
- # Supports initializing new projects with a Rakefile
7
- class Initializer
8
-
9
- def self.call(root)
10
- new(root).call
11
- end
12
-
13
- attr_reader :site
14
-
15
- attr_reader :root
16
-
17
- attr_reader :config_dir
18
-
19
- def initialize(site)
20
- @site = site
21
- @root = site.root
22
- config_dir = @root.join(DEFAULT_CONFIG_DIR_NAME).tap(&:mkpath)
23
- @config_dir = config_dir.parent
24
- end
25
-
26
- # Init devtools using default config
27
- #
28
- # @return [undefined]
29
- #
30
- # @api public
31
- def call
32
- FileUtils.cp_r(DEFAULT_CONFIG_PATH, config_dir)
33
-
34
- site.sync
35
- init_rakefile
36
-
37
- self
38
- end
39
-
40
- private
41
-
42
- # Initialize the Rakefile
43
- #
44
- # @return [undefined]
45
- #
46
- # @api private
47
- def init_rakefile
48
- rakefile = root.join(RAKE_FILE_NAME)
49
- return if rakefile.file? && rakefile.read.include?(INIT_RAKE_TASKS)
50
- rakefile.open('a') do |file|
51
- file << ANNOTATION_WRAPPER % [REQUIRE, INIT_RAKE_TASKS].join("\n")
52
- end
53
- end
54
-
55
- end # class Initializer
56
- end # class Site
57
- end # module Devtools