proforma 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: 2fd1263c98986b0fe066881b0707f68a32b8c75262d40f4a1fb2da89b3caa1d3
4
- data.tar.gz: 3fa0bee1c0ad96a6dfa8843fd419b9fbdfd4e199257746fd8e5729a6f8f1c44f
3
+ metadata.gz: c260f1210b23a42c9252116430e3993d63416d5c43e5e93e9bf1f6e3483ed550
4
+ data.tar.gz: 6fca2c4ab0df35f25bb3fc820cc086bdd13938b60a6d8964266d18ea3bb3a3d4
5
5
  SHA512:
6
- metadata.gz: 1767931c31dc9c6cefae98b1e44e5c0726c21cc7a582ca9a69e547fdc70831a1d39a021d3d018c7caadd282715c95af8ba95f92daeb873551863824d9ca8e74a
7
- data.tar.gz: 69eca8215670ca19c8c33d1d9b3cbd3bf3cdae4fe0f8c2bfc564443cfe2858e5678fa9600292529f8c17e989b0c02b285ddb67f31a2acc166d7f1ba40b65446d
6
+ metadata.gz: 0ef5837dd2296c4fcd60957157a0ac5b9c916c1b8eb8aa1d9e65e3cb5546c58fe25a0bc908c366fdcedc09da42de63bd23f830cb659f38b303d6394e0d9a0f87
7
+ data.tar.gz: f26bf7b4a7c0a6313ddfde158b09d6fd1f15294e228712cfdea3a16a4cceeafff7fc0a3545fbb27eec0c8c265582ea4f865ef68d2e5c80271919a325246bf33a
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  *.gem
3
3
  /tmp
4
4
  /coverage
5
+ /pkg
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
+ # 1.0.2 (May 3rd, 2019)
2
+
3
+ * Updated acts_as_hashable dependency and removed extracted classes in favor of acts_as_hashable.
4
+
1
5
  # 1.0.1 (April 24th, 2019)
2
6
 
3
- * Image and aggregation property values should resolve to nil
7
+ * Image and aggregation values should resolve to nil when property is blank.
4
8
 
5
9
  # 1.0.0 (April 24th, 2019)
6
10
 
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at oss@bluemarblepayroll.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile.lock CHANGED
@@ -1,15 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- proforma (1.0.1)
5
- acts_as_hashable (~> 1)
4
+ proforma (1.0.2)
5
+ acts_as_hashable (~> 1, >= 1.1.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- acts_as_hashable (1.0.5)
10
+ acts_as_hashable (1.1.0)
11
11
  ansi (1.5.0)
12
12
  ast (2.4.0)
13
+ byebug (11.0.1)
13
14
  coderay (1.1.2)
14
15
  diff-lcs (1.3)
15
16
  docile (1.3.1)
@@ -49,7 +50,11 @@ GEM
49
50
  pry (0.12.2)
50
51
  coderay (~> 1.1.0)
51
52
  method_source (~> 0.9.0)
53
+ pry-byebug (3.7.0)
54
+ byebug (~> 11.0)
55
+ pry (~> 0.10)
52
56
  rainbow (3.0.0)
57
+ rake (10.5.0)
53
58
  rb-fsevent (0.10.3)
54
59
  rb-inotify (0.9.10)
55
60
  ffi (>= 0.5.0, < 2)
@@ -95,7 +100,9 @@ PLATFORMS
95
100
  DEPENDENCIES
96
101
  guard-rspec (~> 4.7)
97
102
  proforma!
98
- pry (~> 0)
103
+ pry
104
+ pry-byebug (~> 3)
105
+ rake (~> 10.0)
99
106
  rspec (~> 3.8)
100
107
  rubocop (~> 0.63.1)
101
108
  simplecov (~> 0.16.1)
data/Guardfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- guard :rspec, cmd: 'bundle exec rspec' do
3
+ guard :rspec, cmd: 'DISABLE_SIMPLECOV=true bundle exec rspec --format=documentation' do
4
4
  require 'guard/rspec/dsl'
5
5
  dsl = Guard::RSpec::Dsl.new(self)
6
6
 
data/README.md CHANGED
@@ -316,14 +316,16 @@ Note: ensure you have proper authorization before trying to publish new versions
316
316
  After code changes have successfully gone through the Pull Request review process then the following steps should be followed for publishing new versions:
317
317
 
318
318
  1. Merge Pull Request into master
319
- 2. Update ```lib/proforma/version.rb``` using [semantic versioning](https://semver.org/)
320
- 3. Install dependencies: ```bundle```
321
- 4. Update ```CHANGELOG.md``` with release notes
319
+ 2. Update `lib/proforma/version.rb` using [semantic versioning](https://semver.org/)
320
+ 3. Install dependencies: `bundle`
321
+ 4. Update `CHANGELOG.md` with release notes
322
322
  5. Commit & push master to remote and ensure CI builds master successfully
323
- 6. Build the project locally: `gem build proforma`
324
- 7. Publish package to RubyGems: `gem push proforma-X.gem` where X is the version to push
325
- 8. Tag master with new version: `git tag <version>`
326
- 9. Push tags remotely: `git push origin --tags`
323
+ 6. Run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
324
+
325
+
326
+ ## Code of Conduct
327
+
328
+ Everyone interacting in this codebase, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/bluemarblepayroll/proforma/blob/master/CODE_OF_CONDUCT.md).
327
329
 
328
330
  ## License
329
331
 
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/lib/proforma.rb CHANGED
@@ -15,13 +15,11 @@ require 'stringio'
15
15
  require_relative 'proforma/compiling'
16
16
  require_relative 'proforma/document'
17
17
  require_relative 'proforma/hash_evaluator'
18
- require_relative 'proforma/hash_refinements'
19
18
  require_relative 'proforma/model_factory'
20
19
  require_relative 'proforma/modeling'
21
20
  require_relative 'proforma/plain_text_renderer'
22
21
  require_relative 'proforma/prototype'
23
22
  require_relative 'proforma/template'
24
- require_relative 'proforma/type_factory'
25
23
 
26
24
  # The top-level API that should be seen as the main entry point into this library.
27
25
  module Proforma
@@ -12,29 +12,26 @@ require_relative 'modeling'
12
12
  module Proforma
13
13
  # This class serves as a singleton that can make Proforma::Modeling components.
14
14
  class ModelFactory
15
- REGISTRY = {
16
- 'Banner': Modeling::Banner,
17
- 'Collection': Modeling::Collection,
18
- 'DataTable': Modeling::DataTable,
19
- 'Grouping': Modeling::Grouping,
20
- 'Header': Modeling::Header,
21
- 'Pane': Modeling::Pane,
22
- 'Separator': Modeling::Separator,
23
- 'Spacer': Modeling::Spacer,
24
- 'Table': Modeling::Table,
25
- 'Text': Modeling::Text
26
- }.freeze
27
-
28
- class << self
29
- extend Forwardable
30
-
31
- def_delegators :factory, :array, :make
32
-
33
- private
34
-
35
- def factory
36
- @factory ||= TypeFactory.new(REGISTRY)
37
- end
38
- end
15
+ acts_as_hashable_factory
16
+
17
+ register 'Banner', Modeling::Banner
18
+
19
+ register 'Collection', Modeling::Collection
20
+
21
+ register 'DataTable', Modeling::DataTable
22
+
23
+ register 'Grouping', Modeling::Grouping
24
+
25
+ register 'Header', Modeling::Header
26
+
27
+ register 'Pane', Modeling::Pane
28
+
29
+ register 'Separator', Modeling::Separator
30
+
31
+ register 'Spacer', Modeling::Spacer
32
+
33
+ register 'Table', Modeling::Table
34
+
35
+ register 'Text', Modeling::Text
39
36
  end
40
37
  end
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Proforma
11
- VERSION = '1.0.1'
11
+ VERSION = '1.0.2'
12
12
  end
data/proforma.gemspec CHANGED
@@ -23,10 +23,12 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.required_ruby_version = '>= 2.3.8'
25
25
 
26
- s.add_dependency('acts_as_hashable', '~>1')
26
+ s.add_dependency('acts_as_hashable', '~>1', '>=1.1.0')
27
27
 
28
28
  s.add_development_dependency('guard-rspec', '~>4.7')
29
- s.add_development_dependency('pry', '~>0')
29
+ s.add_development_dependency('pry')
30
+ s.add_development_dependency('pry-byebug', '~> 3')
31
+ s.add_development_dependency 'rake', '~> 10.0'
30
32
  s.add_development_dependency('rspec', '~> 3.8')
31
33
  s.add_development_dependency('rubocop', '~>0.63.1')
32
34
  s.add_development_dependency('simplecov', '~>0.16.1')
data/spec/spec_helper.rb CHANGED
@@ -8,13 +8,18 @@
8
8
  #
9
9
 
10
10
  require 'yaml'
11
-
12
11
  require 'pry'
12
+ require 'pry-byebug'
13
+
14
+ unless ENV['DISABLE_SIMPLECOV'] == 'true'
15
+ require 'simplecov'
16
+ require 'simplecov-console'
13
17
 
14
- require 'simplecov'
15
- require 'simplecov-console'
16
- SimpleCov.formatter = SimpleCov::Formatter::Console
17
- SimpleCov.start
18
+ SimpleCov.formatter = SimpleCov::Formatter::Console
19
+ SimpleCov.start do
20
+ add_filter %r{\A/spec/}
21
+ end
22
+ end
18
23
 
19
24
  require './lib/proforma'
20
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proforma
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-25 00:00:00.000000000 Z
11
+ date: 2019-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_hashable
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.1.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.1.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: guard-rspec
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +48,44 @@ dependencies:
42
48
  name: pry
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - "~>"
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - "~>"
58
+ - - ">="
53
59
  - !ruby/object:Gem::Version
54
60
  version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: pry-byebug
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '3'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '10.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '10.0'
55
89
  - !ruby/object:Gem::Dependency
56
90
  name: rspec
57
91
  requirement: !ruby/object:Gem::Requirement
@@ -126,11 +160,13 @@ files:
126
160
  - ".ruby-version"
127
161
  - ".travis.yml"
128
162
  - CHANGELOG.md
163
+ - CODE_OF_CONDUCT.md
129
164
  - Gemfile
130
165
  - Gemfile.lock
131
166
  - Guardfile
132
167
  - LICENSE
133
168
  - README.md
169
+ - Rakefile
134
170
  - bin/console
135
171
  - bin/render
136
172
  - lib/proforma.rb
@@ -140,7 +176,6 @@ files:
140
176
  - lib/proforma/compiling/counter.rb
141
177
  - lib/proforma/document.rb
142
178
  - lib/proforma/hash_evaluator.rb
143
- - lib/proforma/hash_refinements.rb
144
179
  - lib/proforma/model_factory.rb
145
180
  - lib/proforma/modeling.rb
146
181
  - lib/proforma/modeling/banner.rb
@@ -166,7 +201,6 @@ files:
166
201
  - lib/proforma/plain_text_renderer.rb
167
202
  - lib/proforma/prototype.rb
168
203
  - lib/proforma/template.rb
169
- - lib/proforma/type_factory.rb
170
204
  - lib/proforma/version.rb
171
205
  - proforma.gemspec
172
206
  - spec/fixtures/bringing_it_all_together.txt
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Copyright (c) 2019-present, Blue Marble Payroll, LLC
5
- #
6
- # This source code is licensed under the MIT license found in the
7
- # LICENSE file in the root directory of this source tree.
8
- #
9
-
10
- module Proforma
11
- # Let's provide a refinenment instead of monkey-patching Hash. That way we can stop
12
- # polluting other libraries and internalize our specific needs.
13
- module HashRefinements
14
- refine Hash do
15
- def symbolize_keys
16
- map { |k, v| [k.to_sym, v] }.to_h
17
- end
18
- end
19
- end
20
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Copyright (c) 2019-present, Blue Marble Payroll, LLC
5
- #
6
- # This source code is licensed under the MIT license found in the
7
- # LICENSE file in the root directory of this source tree.
8
- #
9
-
10
- module Proforma
11
- # A TypeFactory object understands how to build objects using a special designated '$type' key.
12
- class TypeFactory
13
- using HashRefinements
14
-
15
- DEFAULT_TYPE_KEY = :type
16
-
17
- attr_reader :registry, :type_key
18
-
19
- def initialize(registry = {}, type_key = DEFAULT_TYPE_KEY)
20
- @registry = registry.symbolize_keys
21
- @type_key = type_key
22
-
23
- freeze
24
- end
25
-
26
- def array(objects = [])
27
- objects = objects.is_a?(Hash) ? [objects] : Array(objects)
28
-
29
- objects.map do |object|
30
- object.is_a?(Hash) ? make(object) : object
31
- end
32
- end
33
-
34
- def make(config = {})
35
- config = (config || {}).symbolize_keys
36
- type = config[type_key].to_s.to_sym
37
- object_class = registry[type]
38
-
39
- raise ArgumentError, "cannot find section from type: #{type}" unless object_class
40
-
41
- config_without_type = config.reject { |k| k == type_key }
42
-
43
- object_class.new(config_without_type)
44
- end
45
- end
46
- end