wtt-core 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.bundle/config +1 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +19 -0
  5. data/.travis.yml +4 -0
  6. data/Gemfile +3 -0
  7. data/README.md +36 -0
  8. data/Rakefile +3 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +7 -0
  11. data/coverage/.last_run.json +5 -0
  12. data/coverage/.resultset.json +857 -0
  13. data/coverage/.resultset.json.lock +0 -0
  14. data/coverage/assets/0.10.0/application.css +799 -0
  15. data/coverage/assets/0.10.0/application.js +1707 -0
  16. data/coverage/assets/0.10.0/colorbox/border.png +0 -0
  17. data/coverage/assets/0.10.0/colorbox/controls.png +0 -0
  18. data/coverage/assets/0.10.0/colorbox/loading.gif +0 -0
  19. data/coverage/assets/0.10.0/colorbox/loading_background.png +0 -0
  20. data/coverage/assets/0.10.0/favicon_green.png +0 -0
  21. data/coverage/assets/0.10.0/favicon_red.png +0 -0
  22. data/coverage/assets/0.10.0/favicon_yellow.png +0 -0
  23. data/coverage/assets/0.10.0/loading.gif +0 -0
  24. data/coverage/assets/0.10.0/magnify.png +0 -0
  25. data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  26. data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  27. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  28. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  29. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  30. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  31. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  32. data/coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  33. data/coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
  34. data/coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  35. data/coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
  36. data/coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
  37. data/coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  38. data/coverage/index.html +5396 -0
  39. data/exe/wtt_cover +28 -0
  40. data/lib/wtt/core/anchor_task.rb +30 -0
  41. data/lib/wtt/core/mapper.rb +138 -0
  42. data/lib/wtt/core/matchers/exact_matcher.rb +17 -0
  43. data/lib/wtt/core/matchers/fuzzy_matcher.rb +21 -0
  44. data/lib/wtt/core/matchers/touch_matcher.rb +17 -0
  45. data/lib/wtt/core/matchers.rb +3 -0
  46. data/lib/wtt/core/meta_data.rb +42 -0
  47. data/lib/wtt/core/paths.rb +21 -0
  48. data/lib/wtt/core/selector.rb +148 -0
  49. data/lib/wtt/core/storage.rb +89 -0
  50. data/lib/wtt/core/trace_service.rb +47 -0
  51. data/lib/wtt/core/tracer.rb +95 -0
  52. data/lib/wtt/core/version.rb +8 -0
  53. data/lib/wtt/core.rb +57 -0
  54. data/lib/wtt.rb +97 -0
  55. data/wtt.gemspec +31 -0
  56. metadata +210 -0
@@ -0,0 +1,8 @@
1
+ # Top level namespace for What to Test
2
+ module WTT
3
+ # Functionality core to WTT belongs here
4
+ module Core
5
+ VERSION = '0.1.15'.freeze
6
+ end
7
+ end
8
+
data/lib/wtt/core.rb ADDED
@@ -0,0 +1,57 @@
1
+ require 'wtt/core/version'
2
+ require 'wtt/core/paths'
3
+ require 'wtt/core/storage'
4
+ require 'wtt/core/mapper'
5
+ require 'wtt/core/selector'
6
+ require 'wtt/core/meta_data'
7
+ require 'wtt/core/tracer'
8
+ require 'wtt/core/trace_service'
9
+ require 'wtt/core/anchor_task'
10
+ require 'wtt/core/matchers'
11
+ require 'rugged'
12
+
13
+
14
+ # Top level namespace for What to Test
15
+ module WTT
16
+ # Functionality core to WTT belongs here
17
+ module Core
18
+ def self.create_core_tasks
19
+ AnchorTasks.new
20
+ end
21
+
22
+ def self.anchor_drop(sha = nil)
23
+ begin
24
+ repo = Rugged::Repository.discover('.')
25
+ sha ||= repo.head.target_id
26
+
27
+ storage = WTT::Core::Storage.new repo
28
+
29
+ meta = WTT::Core::MetaData.new(storage)
30
+ meta.anchored_commit = sha
31
+ meta.write!
32
+ puts "WTT now anchored to #{sha}"
33
+ rescue Exception => ex
34
+ puts "Exception thrown while dropping anchor: #{ex.message}"
35
+ end
36
+ end
37
+
38
+
39
+ def self.anchor_raise
40
+ begin
41
+ repo = Rugged::Repository.discover('.')
42
+ storage = WTT::Core::Storage.new repo
43
+
44
+ meta = WTT::Core::MetaData.new(storage)
45
+ meta.anchored_commit = nil
46
+ meta.write!
47
+ puts 'WTT now unanchored'
48
+ rescue Exception => ex
49
+ puts "Exception thrown while raising anchor: #{ex.message}"
50
+ end
51
+ end
52
+
53
+ private
54
+
55
+
56
+ end
57
+ end
data/lib/wtt.rb ADDED
@@ -0,0 +1,97 @@
1
+ require 'wtt/core'
2
+ require 'drb/drb'
3
+
4
+ # Top level namespace for What to Test
5
+ module WTT
6
+ ENV_ACTIVE_FLAG = 'WTT_ACTIVE'.freeze
7
+ class << self
8
+ attr_accessor :trace_service, :config
9
+ end
10
+
11
+ def self.with_active_env
12
+ self.active = true
13
+ yield
14
+ self.active = false
15
+ end
16
+
17
+ def self.active=(val)
18
+ ENV[ENV_ACTIVE_FLAG] = '1' if val
19
+ ENV.delete ENV_ACTIVE_FLAG unless val
20
+ end
21
+
22
+ def self.active?
23
+ ENV[ENV_ACTIVE_FLAG] != nil
24
+ end
25
+
26
+ def self.configuration
27
+ self.config ||= Configuration.new
28
+ end
29
+
30
+ def self.configure
31
+ yield(configuration) if block_given?
32
+ self.configuration.matcher ||= touch_matcher
33
+ self.configuration.default_reject_filters if self.configuration.use_default_filters
34
+ end
35
+
36
+ def self.start_service
37
+ port = self.configuration.traced_port
38
+ if port > 0 && self.trace_service.nil?
39
+ uri = "druby://localhost:#{port}"
40
+ self.trace_service = DRb.start_service(uri, Core::TraceService.new)
41
+ end
42
+ self.trace_service
43
+ end
44
+
45
+ def self.stop_service
46
+ unless self.trace_service.nil?
47
+ DRb.remove_server(self.trace_service)
48
+ DRb.stop_service
49
+ self.trace_service = nil
50
+ end
51
+
52
+ end
53
+
54
+ def self.exact_matcher
55
+ Core::Matchers::Exact.new
56
+ end
57
+
58
+ def self.touch_matcher
59
+ Core::Matchers::Touch.new
60
+ end
61
+
62
+ def self.fuzzy_matcher(spread = 11)
63
+ Core::Matchers::Fuzzy.new(spread)
64
+ end
65
+
66
+ class Configuration
67
+ attr_accessor :traced_port
68
+ attr_accessor :reject_filters
69
+ attr_accessor :use_default_filters
70
+ attr_accessor :remotes
71
+ attr_accessor :matcher
72
+
73
+ def initialize
74
+ @traced_port = 0
75
+ @remotes = []
76
+ @reject_filters = []
77
+ @use_default_filters = true
78
+ end
79
+
80
+ def add_reject_filter(filter)
81
+ @reject_filters << filter
82
+ end
83
+
84
+ def add_remote(uri)
85
+ uri = "druby://#{uri}" unless uri.start_with?('druby://')
86
+ @remotes << uri
87
+ end
88
+
89
+
90
+ def default_reject_filters
91
+ @reject_filters.concat( [ /_spec.rb$/, # Reject spec files,
92
+ /spec\//, # Reject anything in the spec folder or below
93
+ /\/lib\/ruby\/|\/gems\/gems\/|usr\/share\/ruby\// # Reject any Ruby gem/libraries
94
+ ])
95
+ end
96
+ end
97
+ end
data/wtt.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'wtt/core/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'wtt-core'
8
+ spec.version = WTT::Core::VERSION
9
+ spec.authors = ['Donavan Stanley']
10
+ spec.email = ['dstanley@covermymeds.com']
11
+
12
+ spec.summary = 'Core functionality for What to Test'
13
+ spec.homepage = 'https://github.com/covermymeds/wtt'
14
+
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.required_ruby_version = '>= 2.0'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.10'
24
+ spec.add_development_dependency 'pry'
25
+ spec.add_development_dependency 'pry-byebug'
26
+ spec.add_development_dependency 'rspec'
27
+ spec.add_development_dependency 'simplecov'
28
+ spec.add_development_dependency 'gem-release'
29
+ spec.add_dependency 'rake', '~> 10.0'
30
+ spec.add_dependency 'rugged', '~> 0.23'
31
+ end
metadata ADDED
@@ -0,0 +1,210 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wtt-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.15
5
+ platform: ruby
6
+ authors:
7
+ - Donavan Stanley
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: gem-release
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '10.0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rugged
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.23'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.23'
125
+ description:
126
+ email:
127
+ - dstanley@covermymeds.com
128
+ executables:
129
+ - wtt_cover
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".bundle/config"
134
+ - ".rspec"
135
+ - ".rubocop.yml"
136
+ - ".travis.yml"
137
+ - Gemfile
138
+ - README.md
139
+ - Rakefile
140
+ - bin/console
141
+ - bin/setup
142
+ - coverage/.last_run.json
143
+ - coverage/.resultset.json
144
+ - coverage/.resultset.json.lock
145
+ - coverage/assets/0.10.0/application.css
146
+ - coverage/assets/0.10.0/application.js
147
+ - coverage/assets/0.10.0/colorbox/border.png
148
+ - coverage/assets/0.10.0/colorbox/controls.png
149
+ - coverage/assets/0.10.0/colorbox/loading.gif
150
+ - coverage/assets/0.10.0/colorbox/loading_background.png
151
+ - coverage/assets/0.10.0/favicon_green.png
152
+ - coverage/assets/0.10.0/favicon_red.png
153
+ - coverage/assets/0.10.0/favicon_yellow.png
154
+ - coverage/assets/0.10.0/loading.gif
155
+ - coverage/assets/0.10.0/magnify.png
156
+ - coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
157
+ - coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
158
+ - coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
159
+ - coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
160
+ - coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png
161
+ - coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
162
+ - coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
163
+ - coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
164
+ - coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png
165
+ - coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png
166
+ - coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png
167
+ - coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png
168
+ - coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png
169
+ - coverage/index.html
170
+ - exe/wtt_cover
171
+ - lib/wtt.rb
172
+ - lib/wtt/core.rb
173
+ - lib/wtt/core/anchor_task.rb
174
+ - lib/wtt/core/mapper.rb
175
+ - lib/wtt/core/matchers.rb
176
+ - lib/wtt/core/matchers/exact_matcher.rb
177
+ - lib/wtt/core/matchers/fuzzy_matcher.rb
178
+ - lib/wtt/core/matchers/touch_matcher.rb
179
+ - lib/wtt/core/meta_data.rb
180
+ - lib/wtt/core/paths.rb
181
+ - lib/wtt/core/selector.rb
182
+ - lib/wtt/core/storage.rb
183
+ - lib/wtt/core/trace_service.rb
184
+ - lib/wtt/core/tracer.rb
185
+ - lib/wtt/core/version.rb
186
+ - wtt.gemspec
187
+ homepage: https://github.com/covermymeds/wtt
188
+ licenses: []
189
+ metadata: {}
190
+ post_install_message:
191
+ rdoc_options: []
192
+ require_paths:
193
+ - lib
194
+ required_ruby_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '2.0'
199
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ requirements: []
205
+ rubyforge_project:
206
+ rubygems_version: 2.4.5
207
+ signing_key:
208
+ specification_version: 4
209
+ summary: Core functionality for What to Test
210
+ test_files: []