rdm 0.4.2 → 0.4.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 396c2803b01c338a4c6297bc2f2a5df629d96a9b
4
- data.tar.gz: 45f399f0dd90357c6754fc9c35562b7fc3375b45
3
+ metadata.gz: 83bd9b5b0c49c3d089749d9477dce36de86f5b14
4
+ data.tar.gz: 4e5cfeb3b965d86b46fa90deaf7796640328133b
5
5
  SHA512:
6
- metadata.gz: f65d094c45b7e596bf7bd7950e6a3fa8c167171db762e4e060080f5907c9ad47b4ed0c820951e7f11bac00266634b302b16673e4fc11d246065064c17957f9ab
7
- data.tar.gz: f584ad64900d94cc77e4596245ff006d5a1560f8d77cb2076de5199798bc20e59ea88c911a4f8c2234abdcb44968eded70a4d592e85e51c74b0378689e872b3c
6
+ metadata.gz: 6451ce0cb4b6bbe08cb412bed7928c43556160f85af7bd8968b7ec5caa75e0b9ffa2953360f2e20fd86664b84b32388f1ab0c74c48984eb45d7c378523c25986
7
+ data.tar.gz: b36fe34e37cd30435db7ec20fef64023d1b6fca1c04102d42bf46e96bdca8305f0d95fc054cf7f7221ed5c8c54265e0df30c19b9813b7e1d74441757c90fd051
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rdm (0.4.2)
4
+ rdm (0.4.3)
5
5
  activesupport
6
6
  commander (~> 4.4)
7
7
 
data/lib/rdm.rb CHANGED
@@ -101,5 +101,13 @@ module Rdm
101
101
 
102
102
  @root
103
103
  end
104
+
105
+ def root_dir
106
+ if !root
107
+ raise ArgumentError, "Rdm.root is not initialized. Run Rdm.root(ANY_PROJECT_FILE_PATH) to init it"
108
+ end
109
+
110
+ File.dirname(root)
111
+ end
104
112
  end
105
113
  end
@@ -3,15 +3,15 @@ module Rdm::SpecRunner
3
3
  path: nil,
4
4
  package: nil,
5
5
  spec_matcher: nil,
6
- show_missing_packages: nil,
7
- skipped_packages: []
6
+ show_missing_packages: true,
7
+ skip_ignored_packages: false
8
8
  )
9
9
  Rdm::SpecRunner::Runner.new(
10
10
  path: path,
11
11
  package: package,
12
12
  spec_matcher: spec_matcher,
13
13
  show_missing_packages: show_missing_packages,
14
- skipped_packages: skipped_packages
14
+ skip_ignored_packages: skip_ignored_packages
15
15
  ).run
16
16
  end
17
17
  end
@@ -1,4 +1,6 @@
1
1
  class Rdm::SpecRunner::Runner
2
+ RUNIGNORE_PATH = 'tests/.runignore'.freeze
3
+
2
4
  attr_accessor :no_specs_packages
3
5
  attr_accessor :prepared_command_params
4
6
  attr_accessor :command
@@ -7,22 +9,26 @@ class Rdm::SpecRunner::Runner
7
9
  package: nil,
8
10
  spec_matcher: nil,
9
11
  path: nil,
10
- show_missing_packages: nil,
11
- skipped_packages: []
12
+ show_missing_packages: true,
13
+ skip_ignored_packages: false
12
14
  )
13
15
  @package = package,
14
16
  @spec_matcher = spec_matcher.to_s
15
17
  @no_specs_packages = []
16
- @skipped_packages = skipped_packages
17
18
  @path = path
18
19
  @run_all = @package.nil?
19
20
  @show_missing_packages = show_missing_packages
21
+ @skip_ignored_packages = skip_ignored_packages
22
+ @skipped_packages = []
20
23
  end
21
24
 
22
25
  def run
23
26
  prepare!
24
27
  check_input_params!
25
28
  display_missing_specs if @show_missing_packages
29
+ display_ignored_specs if @skip_ignored_packages
30
+ print_message view.specs_header_message if @show_missing_packages || @skip_ignored_packages
31
+
26
32
  execute_command
27
33
  end
28
34
 
@@ -109,6 +115,25 @@ class Rdm::SpecRunner::Runner
109
115
  end
110
116
 
111
117
  def prepare_command_for_packages(packages_command_params)
118
+ if @skip_ignored_packages
119
+ runignore_path = File.expand_path(File.join(Rdm.root_dir, RUNIGNORE_PATH))
120
+ package_list = Rdm::SourceParser.read_and_init_source(Rdm.root).packages.keys
121
+
122
+ skipped_package_list = File.read(runignore_path)
123
+ .lines
124
+ .map(&:strip)
125
+ .reject(&:empty?) rescue []
126
+
127
+ @skipped_packages = skipped_package_list.reject {|line| !package_list.include?(line)}
128
+ invalid_ignore_packages = skipped_package_list - @skipped_packages
129
+
130
+ if !invalid_ignore_packages.empty?
131
+ puts "WARNING: #{RUNIGNORE_PATH} contains invalid package names: #{invalid_ignore_packages.inspect}"
132
+ end
133
+ else
134
+ @skipped_packages = []
135
+ end
136
+
112
137
  packages_command_params
113
138
  .select { |cmd_params| cmd_params.spec_count > 0 }
114
139
  .reject { |cmd_params| @skipped_packages.include?(cmd_params.package_name) }
@@ -118,15 +143,15 @@ class Rdm::SpecRunner::Runner
118
143
  end
119
144
 
120
145
  def display_missing_specs
121
- unless no_specs_packages.empty?
146
+ if !no_specs_packages.empty?
122
147
  print_message view.missing_specs_message(no_specs_packages)
123
148
  end
149
+ end
124
150
 
125
- unless @skipped_packages.empty?
151
+ def display_ignored_specs
152
+ if !@skipped_packages.empty?
126
153
  print_message view.skipping_specs_message(@skipped_packages)
127
154
  end
128
-
129
- print_message view.specs_header_message
130
155
  end
131
156
 
132
157
  def execute_command
@@ -19,7 +19,8 @@ begin
19
19
  Rdm::SpecRunner.run(
20
20
  package: package,
21
21
  path: PATH,
22
- show_missing_packages: false
22
+ skip_ignored_packages: false,
23
+ show_missing_packages: true
23
24
  )
24
25
  end
25
26
 
@@ -15,8 +15,7 @@
15
15
  ENV['RUBY_ENV'] = 'test'
16
16
  require 'rdm'
17
17
 
18
- runignore_path = File.expand_path(File.join(File.dirname(Rdm.root(__FILE__)), '.runignore'))
19
- skipped_packages = File.open(runignore_path).each_line.inject([]) { |all, line| all.push(line.chomp!) }
18
+ Rdm.root(__FILE__)
20
19
 
21
20
  if ENV['TEST_RUN']
22
21
  require 'minitest/autorun'
@@ -36,7 +35,7 @@ else
36
35
  package: ARGV.clone.first,
37
36
  spec_matcher: ARGV.clone.last,
38
37
  path: File.expand_path(__FILE__),
39
- skipped_packages: skipped_packages,
38
+ skip_ignored_packages: true,
40
39
  show_missing_packages: true
41
40
  )
42
41
  end
@@ -1,3 +1,3 @@
1
1
  module Rdm
2
- VERSION = '0.4.2'.freeze
2
+ VERSION = '0.4.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Droid Labs