manageiq-cross_repo 0.3.1 → 1.0.0

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
  SHA256:
3
- metadata.gz: eda31356d4afc3ad2915a51609ccd2431966ead420b64f940f445c9bdc5c53af
4
- data.tar.gz: f4b6d4b85db8ce770949b38029cb55f67b36903e9b2f96bbf3e1cc90f16594e7
3
+ metadata.gz: ecad3c073c0e642e1b0c6acdbd4aee93ab2ee491761c6674ca8333b8ddd2b778
4
+ data.tar.gz: '0952c2b0fe57ee11a23ed5749ae3e1728e9c4eac1257e09b01edd17ac4b6b88b'
5
5
  SHA512:
6
- metadata.gz: 21d72ac24791f7f514b1ed29762b31da4545fe18f5217e6ad710dea9a82f2b676b4f9f5b58049276e4f15b935bc9c620a58afb52c83b9fb0592c56bec9638855
7
- data.tar.gz: b908ca0717197420725d5cbff74e49b2da84e7911017b2e2a085b4face3f39ae19c13810c4c4d8ebd37613958026113a60fcd43762b5865bcb30b1a74d33a918
6
+ metadata.gz: a519f48d8f113042c44c9a31a169ce415fb86b6c2ca0db0251bdda0f9a01d25bf76bb92b974054350bd800ca6f69a39ca0e3ec6fbea48c6f6142bf484b223378
7
+ data.tar.gz: b7b6e3974e05fad7c7f8d2727fc174de49329bcec10445e97089f5adc2d2d95902dffb992b46eacfbd046808022c41d991e8577254ce6beace91223308bbb211
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ManageIQ cross-repository testing framework
2
2
 
3
3
  ```
4
- Usage: manageiq-cross_repo --test-repo repo [--core-repo repo] [--gem-repos repo1 repo2 ...]
4
+ Usage: manageiq-cross_repo --test-repo repo [--repos repo1 repo2 ...]
5
5
 
6
6
  manageiq-cross_repo is a cross repository test framework for the ManageIQ project.
7
7
  Its purpose is to allow running multiple repository tests suites in the context
@@ -12,12 +12,10 @@ Options:
12
12
  -t, --test-repo=<s> This is the repository which will be tested.
13
13
  Can also be passed as a TEST_REPO environment variable.
14
14
  (default: ManageIQ/manageiq@master)
15
- -c, --core-repo=<s> Used to specify a different core branch in which plugin tests will run.
16
- If --test-repo is a plugin, defaults to ManageIQ/manageiq@master.
17
- If --test-repo is a core repo, this option is not allowed.
18
- Can also be passed as a CORE_REPO environment variable.
19
- -g, --gem-repos=<s+> Optional, a list of other plugin/gem overrides which are needed to run the tests.
20
- Can also be passed as a GEM_REPOS environment variable.
15
+ -r, --repos=<s+> Optional, a list of other repos and/or gems to override while running the tests.
16
+ If any of the repositories in the list are a core repository that will
17
+ be used as the root repository, otherwise ManageIQ/manageiq@master will be the default.
18
+ Can also be passed as a REPOS environment variable.
21
19
 
22
20
  -v, --version Print version and exit
23
21
  -h, --help Show this message
@@ -39,7 +37,7 @@ Examples:
39
37
  manageiq-cross_repo --test-repo manageiq-ui-classic
40
38
 
41
39
  # Test a plugin against a ManageIQ SHA
42
- manageiq-cross_repo --test-repo manageiq-ui-classic --core-repo manageiq@1234abcd
40
+ manageiq-cross_repo --test-repo manageiq-ui-classic --repos manageiq@1234abcd
43
41
 
44
42
  # Test a plugin branch
45
43
  manageiq-cross_repo --test-repo manageiq-ui-classic@feature
@@ -51,16 +49,16 @@ Examples:
51
49
  manageiq-cross_repo --test-repo manageiq-ui-classic#1234
52
50
 
53
51
  # Test a plugin with a set of other plugins
54
- manageiq-cross_repo --test-repo manageiq-ui-classic --gem-repos manageiq-providers-vmware@feature manageiq-content@feature
52
+ manageiq-cross_repo --test-repo manageiq-ui-classic --repos manageiq-providers-vmware@feature manageiq-content@feature
55
53
 
56
54
  # Test a plugin branch with a ManageIQ SHA and a set of other plugins
57
- manageiq-cross_repo --test-repo manageiq-ui-classic@feature --core-repo manageiq@1234abcd --gem-repos manageiq-providers-vmware@feature manageiq-content@feature
55
+ manageiq-cross_repo --test-repo manageiq-ui-classic@feature --repos manageiq@1234abcd manageiq-providers-vmware@feature manageiq-content@feature
58
56
 
59
57
  # Run core tests with ManageIQ master using a gem version
60
- manageiq-cross_repo --gem-repos johndoe/manageiq-ui-classic@feature
58
+ manageiq-cross_repo --repos johndoe/manageiq-ui-classic@feature
61
59
 
62
60
  # Run core tests for a branch and a set of gems
63
- manageiq-cross_repo --test-repo johndoe/manageiq@feature --gem-repos manageiq-providers-vmware@feature manageiq-content@feature
61
+ manageiq-cross_repo --test-repo johndoe/manageiq@feature --repos manageiq-providers-vmware@feature manageiq-content@feature
64
62
  ```
65
63
 
66
64
  ## License
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require "bundler"
3
4
  require "bundler/setup"
4
5
 
5
6
  require "manageiq-cross_repo"
6
7
  require "optimist"
7
8
 
8
9
  opts = Optimist.options do
9
- usage "--test-repo repo [--core-repo repo] [--gem-repos repo1 repo2 ...]"
10
+ usage "--test-repo repo [--repos repo1 repo2 ...]"
10
11
 
11
12
  version "v#{ManageIQ::CrossRepo::VERSION}\n"
12
13
 
@@ -23,16 +24,11 @@ opts = Optimist.options do
23
24
  Can also be passed as a TEST_REPO environment variable.
24
25
  EOS
25
26
 
26
- opt :core_repo, <<~EOS, :type => :string, :default => ENV["CORE_REPO"].presence
27
- Used to specify a different core branch in which plugin tests will run.
28
- If --test-repo is a plugin, defaults to ManageIQ/manageiq@master.
29
- If --test-repo is a core repo, this option is not allowed.
30
- Can also be passed as a CORE_REPO environment variable.
31
- EOS
32
-
33
- opt :gem_repos, <<~EOS, :type => :strings, :multi => true, :default => Array(ENV["GEM_REPOS"].presence)
34
- Optional, a list of other plugin/gem overrides which are needed to run the tests.
35
- Can also be passed as a GEM_REPOS environment variable.
27
+ opt :repos, <<~EOS, :type => :strings, :default => Array(ENV["REPOS"].presence)
28
+ Optional, a list of other repos and/or gems to override while running the tests.
29
+ If any of the repositories in the list are a core repository that will
30
+ be used as the root repository, otherwise ManageIQ/manageiq@master will be the default.
31
+ Can also be passed as a REPOS environment variable.
36
32
  EOS
37
33
 
38
34
  # Manually add these so they appear in the right order in the help output
@@ -62,7 +58,7 @@ opts = Optimist.options do
62
58
  manageiq-cross_repo --test-repo manageiq-ui-classic
63
59
 
64
60
  # Test a plugin against a ManageIQ SHA
65
- manageiq-cross_repo --test-repo manageiq-ui-classic --core-repo manageiq@1234abcd
61
+ manageiq-cross_repo --test-repo manageiq-ui-classic --repos manageiq@1234abcd
66
62
 
67
63
  # Test a plugin branch
68
64
  manageiq-cross_repo --test-repo manageiq-ui-classic@feature
@@ -74,28 +70,23 @@ opts = Optimist.options do
74
70
  manageiq-cross_repo --test-repo manageiq-ui-classic#1234
75
71
 
76
72
  # Test a plugin with a set of other plugins
77
- manageiq-cross_repo --test-repo manageiq-ui-classic --gem-repos manageiq-providers-vmware@feature manageiq-content@feature
73
+ manageiq-cross_repo --test-repo manageiq-ui-classic --repos manageiq-providers-vmware@feature manageiq-content@feature
78
74
 
79
75
  # Test a plugin branch with a ManageIQ SHA and a set of other plugins
80
- manageiq-cross_repo --test-repo manageiq-ui-classic@feature --core-repo manageiq@1234abcd --gem-repos manageiq-providers-vmware@feature manageiq-content@feature
76
+ manageiq-cross_repo --test-repo manageiq-ui-classic@feature --repos manageiq@1234abcd manageiq-providers-vmware@feature manageiq-content@feature
81
77
 
82
78
  # Run core tests with ManageIQ master using a gem version
83
- manageiq-cross_repo --gem-repos johndoe/manageiq-ui-classic@feature
79
+ manageiq-cross_repo --repos johndoe/manageiq-ui-classic@feature
84
80
 
85
81
  # Run core tests for a branch and a set of gems
86
- manageiq-cross_repo --test-repo johndoe/manageiq@feature --gem-repos manageiq-providers-vmware@feature manageiq-content@feature
82
+ manageiq-cross_repo --test-repo johndoe/manageiq@feature --repos manageiq-providers-vmware@feature manageiq-content@feature
87
83
  EOS
88
84
  end
89
85
 
90
- opts[:gem_repos] = opts[:gem_repos].flatten.flat_map { |repo| repo.split(",").map(&:strip) }
91
-
92
- if ENV["CI"] && opts[:test_repo] == "ManageIQ/manageiq@master" && opts[:core_repo].blank? && opts[:gem_repos].blank?
93
- puts "Nothing to do!"
94
- exit
95
- end
86
+ opts[:repos] = opts[:repos].flatten.flat_map { |repo| repo.split(",").map(&:strip) }
96
87
 
97
88
  begin
98
- ManageIQ::CrossRepo.run(opts[:test_repo], opts[:core_repo], opts[:gem_repos])
89
+ ManageIQ::CrossRepo.run(opts[:test_repo], opts[:repos])
99
90
  rescue ArgumentError => e
100
91
  Optimist.die e
101
92
  end
@@ -5,20 +5,21 @@ module ManageIQ::CrossRepo
5
5
  class Runner
6
6
  attr_reader :test_repo, :core_repo, :gem_repos
7
7
 
8
- def initialize(test_repo, core_repo, gem_repos)
8
+ def initialize(test_repo, repos)
9
9
  @test_repo = Repository.new(test_repo || "ManageIQ/manageiq@master")
10
+
11
+ core_repos, @gem_repos = Array(repos).collect { |repo| Repository.new(repo) }.partition(&:core?)
12
+ @core_repo = core_repos.first
13
+
10
14
  if @test_repo.core?
11
- raise ArgumentError, "You cannot pass core repo when running a core test" if core_repo.present? && core_repo != test_repo
12
- raise ArgumentError, "You must pass at least one gem repo when running a core test" if gem_repos.blank?
15
+ raise ArgumentError, "You cannot pass a different core repo when running a core test" if @core_repo.present? && @core_repo != @test_repo
13
16
 
14
17
  @core_repo = @test_repo
15
18
  else
16
- raise ArgumentError, "You must pass either a core repo or at least one gem repo when running a plugin test" if core_repo.blank? && gem_repos.blank?
19
+ raise ArgumentError, "You must pass at least one repo when running a plugin test." if repos.blank?
17
20
 
18
- @core_repo = Repository.new(core_repo || "ManageIQ/manageiq@master")
21
+ @core_repo ||= Repository.new("ManageIQ/manageiq@master")
19
22
  end
20
-
21
- @gem_repos = gem_repos.to_a.map { |repo| Repository.new(repo) }
22
23
  end
23
24
 
24
25
  def run
@@ -1,5 +1,5 @@
1
1
  module ManageIQ
2
2
  module CrossRepo
3
- VERSION = "0.3.1"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manageiq-cross_repo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Authors
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-14 00:00:00.000000000 Z
11
+ date: 2019-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake