test_ids 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32e0f28dcb31510be128dc89738ae51f437217bc
4
- data.tar.gz: 3cbdd628afd3537d092e2ef60518a45342367e63
3
+ metadata.gz: 8e249266baf4396291cc0f319a287fa71642187b
4
+ data.tar.gz: 89704013f2853841006b8cf657be0f74d84017c0
5
5
  SHA512:
6
- metadata.gz: 86e9efb2f2b12789ace7a19180235128c926faff668483ce1c359aa1d6133aa85df2a0b018f0355f268c49fd3bb8001bdb5410ceb5ef1cd4354fbff997be23ac
7
- data.tar.gz: b5edb4c6e60077a18ef9e1d5d4b26f2970c4c0ab236e2fb269f4bcfcaec36a1c7838124ba94d9b8eb4a9110890b19b590d3cad8d120ae3927711ce647437140a
6
+ metadata.gz: 5fe7c17bd3cbe77917de7bbca0dc219e10ecf9acda0b79eca340f3745b42dc69e771f549cc09f2eb5f82ff6741979257071f5051f62f28000d01bc5b5e145382
7
+ data.tar.gz: 2011b621e23bd29a5651802cb591e32d194d298e441d1a1382e2fb341cf9f6e6177a11cda281467c4601a517b618855f59c9dfcc61664bf0a9b9393d2068e3f4
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module TestIds
2
2
  MAJOR = 0
3
3
  MINOR = 3
4
- BUGFIX = 0
4
+ BUGFIX = 1
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -103,16 +103,6 @@ module TestIds
103
103
 
104
104
  private
105
105
 
106
- def publish?
107
- git? && config.on_completion == :publish
108
- end
109
-
110
- def git?
111
- if config.repo
112
- !!(config.repo =~ /\.git$/)
113
- end
114
- end
115
-
116
106
  # Returns the next available bin in the pool, if they have all been given out
117
107
  # the one that hasn't been used for the longest time will be given out
118
108
  def allocate_bin
data/lib/test_ids.rb CHANGED
@@ -57,7 +57,7 @@ module TestIds
57
57
  @git_initialized ||= begin
58
58
  if repo
59
59
  @git = Git.new(local: git_database_dir, remote: repo)
60
- git.get_lock if on_completion == :save
60
+ git.get_lock if publish?
61
61
  end
62
62
  true
63
63
  end
@@ -66,7 +66,7 @@ module TestIds
66
66
  # Returns a full path to the database file for the given id, returns nil if
67
67
  # git storage has not been enabled
68
68
  def database_file(id)
69
- if repo && on_completion == :save
69
+ if repo
70
70
  if id == :not_specified
71
71
  f = 'store.json'
72
72
  else
@@ -103,38 +103,33 @@ module TestIds
103
103
  @repo
104
104
  end
105
105
 
106
- # Returns what should be done with the database for the given configuration
107
- # at the end, :save (the default) or :discard.
108
- #
109
- # If a repo has not been specified, then this attribute has no effect and the
110
- # data will always be discarded.
111
- def on_completion
112
- @on_completion || :save
106
+ def publish?
107
+ @publish ? @publish == :save : true
113
108
  end
114
109
 
115
- def on_completion=(val)
116
- return if @on_completion && @on_completion == val
117
- if @on_completion && @on_completion != val
118
- fail 'You can only use a single setting for on_completion per program generation run'
110
+ def publish=(val)
111
+ return if @publish && publish? == val
112
+ if @publish && publish? != val
113
+ fail 'You can only use a single setting for publish per program generation run'
119
114
  end
120
115
  if @configuration
121
- fail 'TestIds.on_completion must be set before creating the first configuration'
116
+ fail 'TestIds.publish must be set before creating the first configuration'
122
117
  end
123
- unless %w(save discard).include?(val.to_s)
124
- fail 'on_completion must be set to either :save or :discard'
118
+ unless [true, false].include?(val)
119
+ fail 'TestIds.publish must be set to either true or false'
125
120
  end
126
- @on_completion = val.to_sym
121
+ @publish = val ? :save : :dont_save
127
122
  end
128
123
 
129
124
  private
130
125
 
131
126
  def on_origen_shutdown
132
- unless testing?
133
- if repo && on_completion == :save
127
+ if !testing? && @configuration
128
+ if repo
134
129
  @configuration.each do |id, config|
135
130
  config.allocator.save
136
131
  end
137
- git.publish
132
+ git.publish if publish?
138
133
  end
139
134
  end
140
135
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_ids
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-20 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen