prism_qa 0.2.1 → 0.2.2

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
- SHA1:
3
- metadata.gz: 2f7ffb6cb149a2d8fc072403214e82b01c780aff
4
- data.tar.gz: 9d602daab9d1d4325609ba94da5d59de95468a92
2
+ SHA256:
3
+ metadata.gz: 0fc3c503a5363f6fdab686018d957f2312f2b1172e2eb2287aa16c571d9a3fcf
4
+ data.tar.gz: e219b6610098b686c1db1029e8a0279ccf86353e12b5b5f8805638363dfcccda
5
5
  SHA512:
6
- metadata.gz: 9913c2894bd81a6c2dab7010a94acdffb962d56176fe4a5e4633ab6e76c88fe9f0f13cfb0d6b033ce1238b72534e1912feafbfd1f7649e65b696be182e66094e
7
- data.tar.gz: 882a08b879975b83544fd4f72ed76a0bb6caf651cf619da90fccfa009748a62911c74643b12b595db62845b1d58bfc7e6c8c7646b75e09a158dc2139b90dcbc0
6
+ metadata.gz: 05a3bdcbe63b248a9705dcd780378e1e35a53ce6f508cc6139d587ac01b49589a232ee65796d28ab6b0e8773713aefee5f1bf947070f1b9e33a9944a7c820b85
7
+ data.tar.gz: 10010fe3559c0d7cd16ddc69e1b6f89327d966d6e821a14a322954a11fdcf5ff547160bc9ff8fb36dd7fe6ad4e801b30dff81f16e26d54ffcf9d32408ae2bed1
@@ -7,7 +7,7 @@ module PrismQA
7
7
  class IncompatibilityError < TypeError; end
8
8
 
9
9
  # For reporting improper extension of the PrismQA base classes (developer error)
10
- class ImplementationError < NotImplementedError; end
10
+ class ImplementationError < RuntimeError; end
11
11
 
12
12
  # For reporting assertions that fail at runtime (logic errors in extender's code)
13
13
  class OperationalError < RuntimeError; end
@@ -14,7 +14,7 @@ def web_relative_path(web_root, base_document, child_element)
14
14
  c = File.expand_path(child_element)
15
15
  r = File.expand_path(web_root)
16
16
  unless ancestor?(r, c)
17
- fail PrismQA::OperationalError, "Child element '#{c}' is not an ancestor of the web root '#{r}'"
17
+ raise PrismQA::OperationalError, "Child element '#{c}' is not an ancestor of the web root '#{r}'"
18
18
  end
19
19
  base = Pathname.new(File.dirname(File.expand_path(base_document)))
20
20
  elem = Pathname.new c
@@ -1,18 +1,34 @@
1
1
 
2
2
  module PrismQA
3
3
 
4
- # A simple container for image information
4
+ # A simple container for image information.
5
+ # Image objects represent a path on disk, with an additional
6
+ # ID field (for cross-referencing design and app images) and
7
+ # an optional user-friendly description
5
8
  class Image
6
- attr_accessor :path # the location on disk
7
- attr_accessor :id # an application-specific unique identifier
8
- attr_accessor :description # a friendly description
9
+ # The image's location on disk
10
+ # @return [String]
11
+ attr_accessor :path
12
+
13
+ # an application-specific unique identifier
14
+ # @return [String]
15
+ attr_accessor :id
16
+
17
+ # a friendly description
18
+ # @return [String]
19
+ attr_accessor :description
9
20
  end
10
21
 
11
- # Design images may optionally specify an attribute
22
+ # Design images extend Images by optionally specifying an attribute.
23
+ # This enables different design variants to be labeled, such as
24
+ # for a modified screen size.
12
25
  class DesignImage < Image
26
+ # A design attribute of the image
27
+ # @return [String]
13
28
  attr_accessor :attribute
14
29
  end
15
30
 
16
- # App images are the same as images, but create this alias for symmetry / clarity
31
+ # App images are no different than the base class they use.
32
+ # THis class is essentially an alias for symmetry / clarity
17
33
  class AppImage < Image; end
18
34
  end
@@ -1,17 +1,20 @@
1
1
 
2
2
  module PrismQA
3
3
 
4
- # Container class for sets of images
4
+ # A container for sets of images, with basic sanity checking
5
5
  class ImageSet
6
6
 
7
- attr_reader :images # the container for all the images in the set
7
+ # The container for all the images in the set
8
+ # @return [Array] of PrismQA::Image objects
9
+ attr_reader :images
8
10
 
9
11
  def initialize
10
12
  @images = []
11
13
  @cache_valid = false # cache invalidation is so easy
12
14
  end
13
15
 
14
- # Safe way to add images to the container
16
+ # Safely add images to the container
17
+ # @param [PrismQA::Image] The image to be added
15
18
  def add(image)
16
19
  allow image
17
20
  # fix relative paths
@@ -22,6 +25,8 @@ module PrismQA
22
25
  end
23
26
 
24
27
  # Raise an error if the image is not appropriate for this type of set
28
+ # @param [PrismQA::Image] The image to be added
29
+ # @throws
25
30
  def allow(_image)
26
31
  puts " +++ If you're seeing this, #{self.class.name}.#{__method__} was not overridden"
27
32
  end
@@ -33,11 +38,11 @@ module PrismQA
33
38
 
34
39
  def allow(image)
35
40
  # Ensure that image objects have an "attribute" field, among other things
36
- fail IncompatibilityError, 'Tried to add a non- DesignImage object to a DesignImageSet' unless image.is_a? DesignImage
41
+ raise IncompatibilityError, 'Tried to add a non- DesignImage object to a DesignImageSet' unless image.is_a? DesignImage
37
42
 
38
43
  # no duplicates allowed
39
44
  if @images.map { |i| [i.id, i.attribute] }.include? [image.id, image.attribute]
40
- fail OperationalError, "Tried to add an image with duplicate ID '#{image.id}' and attribute '#{image.attribute}'"
45
+ raise OperationalError, "Tried to add an image with duplicate ID '#{image.id}' and attribute '#{image.attribute}'"
41
46
  end
42
47
  end
43
48
 
@@ -73,7 +78,7 @@ module PrismQA
73
78
 
74
79
  # if there is no attribute for this image, it should be pulled in
75
80
  # ... unless there's an exact match elsewhere in the set.
76
- next true if img.attribute.nil? unless @attributes_by_id[img.id.to_s].include? attribute
81
+ next true if img.attribute.nil? && !(@attributes_by_id[img.id.to_s].include? attribute)
77
82
 
78
83
  false
79
84
  end
@@ -89,11 +94,11 @@ module PrismQA
89
94
  def allow(image)
90
95
  # no duplicates
91
96
  if @images.map(&:id).include? image.id
92
- fail OperationalError, "Tried to add an image with duplicate ID '#{image.id}'"
97
+ raise OperationalError, "Tried to add an image with duplicate ID '#{image.id}'"
93
98
  end
94
99
 
95
100
  # App image sets don't need to worry about specific fields, but we keep it clean and symmetric.
96
- fail IncompatibilityError, 'Tried to add a DesignImage object to a non- DesignImageSet' if image.is_a? DesignImage
101
+ raise IncompatibilityError, 'Tried to add a DesignImage object to a non- DesignImageSet' if image.is_a? DesignImage
97
102
  end
98
103
 
99
104
  def cache_image_lookups
@@ -54,7 +54,7 @@ module PrismQA
54
54
  # raise an error if any problems are found
55
55
  def validate_input
56
56
  problems = test_input
57
- fail OperationalError, "Found the following problems: #{problems}" unless problems.empty?
57
+ raise OperationalError, "Found the following problems: #{problems}" unless problems.empty?
58
58
  end
59
59
 
60
60
  # render the report
@@ -15,7 +15,7 @@ module PrismQA
15
15
  def allow_path(path)
16
16
  unless @web_document_root.nil?
17
17
  unless ancestor?(@web_document_root, path)
18
- fail OperationalError, "Report #{path} is not an ancestor of the web root #{@web_document_root}"
18
+ raise OperationalError, "Report #{path} is not an ancestor of the web root #{@web_document_root}"
19
19
  end
20
20
  end
21
21
  end
@@ -40,11 +40,11 @@ module PrismQA
40
40
  end
41
41
 
42
42
  def allow_image_set(image_set)
43
- fail ImplementationError, "Got a nil DesignImageSet object; was #{self.class.name} properly extended?" if image_set.nil?
43
+ raise ImplementationError, "Got a nil DesignImageSet object; was #{self.class.name} properly extended?" if image_set.nil?
44
44
 
45
45
  # Ensure that we are only looking at design images
46
46
  unless image_set.is_a? DesignImageSet
47
- fail IncompatibilityError, 'Tried to add a non- DesignImageSet object to DesignSpectrum'
47
+ raise IncompatibilityError, 'Tried to add a non- DesignImageSet object to DesignSpectrum'
48
48
  end
49
49
  end
50
50
  end
@@ -53,10 +53,10 @@ module PrismQA
53
53
  class AppSpectrum < Spectrum
54
54
 
55
55
  def allow_image_set(image_set)
56
- fail ImplementationError, "Got a nil DesignImageSet object; was #{self.class.name} properly extended?" if image_set.nil?
56
+ raise ImplementationError, "Got a nil DesignImageSet object; was #{self.class.name} properly extended?" if image_set.nil?
57
57
 
58
58
  # Ensure that we are only looking at implementation images
59
- fail IncompatibilityError, 'Tried to add a DesignImageSet object to AppSpectrum' if image_set.is_a? DesignImageSet
59
+ raise IncompatibilityError, 'Tried to add a DesignImageSet object to AppSpectrum' if image_set.is_a? DesignImageSet
60
60
  end
61
61
 
62
62
  end
@@ -1,5 +1,5 @@
1
1
 
2
2
  # The top-level prism module
3
3
  module PrismQA
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'.freeze
5
5
  end
metadata CHANGED
@@ -1,148 +1,168 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prism_qa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Katz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-01 00:00:00.000000000 Z
11
+ date: 2018-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 1.3.6
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ~>
27
+ - - "~>"
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.3'
30
- - - '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.3.6
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ~>
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '10.0'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ~>
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '10.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rubocop
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ~>
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.31'
54
- - - '>='
53
+ version: '0.37'
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 0.31.0
56
+ version: 0.37.0
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ~>
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '0.31'
64
- - - '>='
63
+ version: '0.37'
64
+ - - ">="
65
65
  - !ruby/object:Gem::Version
66
- version: 0.31.0
66
+ version: 0.37.0
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: rspec
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - ~>
71
+ - - "~>"
72
72
  - !ruby/object:Gem::Version
73
73
  version: '3.0'
74
74
  type: :development
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - ~>
78
+ - - "~>"
79
79
  - !ruby/object:Gem::Version
80
80
  version: '3.0'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: simplecov
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - ~>
85
+ - - "~>"
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0.10'
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: 0.10.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ~>
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0.10'
98
- - - '>='
98
+ - - ">="
99
99
  - !ruby/object:Gem::Version
100
100
  version: 0.10.0
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: simplecov-json
103
103
  requirement: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - ~>
105
+ - - "~>"
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0.2'
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.2.0
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0.2'
118
- - - '>='
118
+ - - ">="
119
119
  - !ruby/object:Gem::Version
120
120
  version: 0.2.0
121
+ - !ruby/object:Gem::Dependency
122
+ name: yard
123
+ requirement: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '0.8'
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0.8'
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '0.8'
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0.8'
121
141
  - !ruby/object:Gem::Dependency
122
142
  name: markaby
123
143
  requirement: !ruby/object:Gem::Requirement
124
144
  requirements:
125
- - - ~>
145
+ - - "~>"
126
146
  - !ruby/object:Gem::Version
127
147
  version: '0.8'
128
- - - '>='
148
+ - - ">="
129
149
  - !ruby/object:Gem::Version
130
150
  version: 0.8.0
131
151
  type: :runtime
132
152
  prerelease: false
133
153
  version_requirements: !ruby/object:Gem::Requirement
134
154
  requirements:
135
- - - ~>
155
+ - - "~>"
136
156
  - !ruby/object:Gem::Version
137
157
  version: '0.8'
138
- - - '>='
158
+ - - ">="
139
159
  - !ruby/object:Gem::Version
140
160
  version: 0.8.0
141
161
  description: Prism helps you split your apps and your design document into visible
142
162
  components. Its purpose is to enable designers to be an effective part of a QA
143
163
  / Continuous Integration process.
144
164
  email:
145
- - ifreecarve@gmail.com
165
+ - ianfixes@gmail.com
146
166
  executables: []
147
167
  extensions: []
148
168
  extra_rdoc_files: []
@@ -157,7 +177,7 @@ files:
157
177
  - gem/lib/prism_qa/spectrum.rb
158
178
  - gem/lib/prism_qa/target.rb
159
179
  - gem/lib/prism_qa/version.rb
160
- homepage: http://github.com/ifreecarve/prism_qa
180
+ homepage: http://github.com/ianfixes/prism_qa
161
181
  licenses:
162
182
  - Apache 2.0
163
183
  metadata: {}
@@ -167,17 +187,17 @@ require_paths:
167
187
  - gem/lib
168
188
  required_ruby_version: !ruby/object:Gem::Requirement
169
189
  requirements:
170
- - - '>='
190
+ - - ">="
171
191
  - !ruby/object:Gem::Version
172
192
  version: '0'
173
193
  required_rubygems_version: !ruby/object:Gem::Requirement
174
194
  requirements:
175
- - - '>='
195
+ - - ">="
176
196
  - !ruby/object:Gem::Version
177
197
  version: '0'
178
198
  requirements: []
179
199
  rubyforge_project:
180
- rubygems_version: 2.4.6
200
+ rubygems_version: 2.7.4
181
201
  signing_key:
182
202
  specification_version: 4
183
203
  summary: Design QA tool