billomat 0.4.1 → 1.1.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: 51765c8b9dedcc01ea242a91edbf539315979e7b50e6345384e6d1ce5cb4bd64
4
- data.tar.gz: a9eb5a65d8c55ab1b8f7cede5572608d15d19d71d4c7301715e6454486ae782e
3
+ metadata.gz: 2d9fef7b349e89c146999e6725312eabdf22fd8e75a22ca8f388329d1297f2f9
4
+ data.tar.gz: 3205b27c8a21272b9bb46cb4991a9460d36ef7a12832ae4ebaa83890ca7a83e9
5
5
  SHA512:
6
- metadata.gz: 9b036325f89f2dce9c2621514bff6096f29e4eca62fabea97e55855e4863512ea07d35875e7221aa8dd4471df100179447b0008aed2cc2388c418ae2df3444fd
7
- data.tar.gz: e1438472b79a8db5ac970157c048be626257a388a73679f62dd8423b20a6c80190839ad56348bb9d1aa358516374c4c0be8461460a60c86a2da50926ed996d23
6
+ metadata.gz: 88c96ee5c03eacfe8fce57523cac662771469aa716fd60ebb47686143ed20e3a4df30f912d84847b7c235d9b06db75a4ea6eff877f4a8e40f515205b7392d570
7
+ data.tar.gz: f86c7a69e61f131a2bc778309226c2e9ef9e364853cee4c9369d53e73e5e220dd3060ac583c91e6ae0b1101ef84311de0d7e7e0b0c819a2ae2662c04199c12b2
@@ -9,17 +9,17 @@ concurrency:
9
9
  jobs:
10
10
  docs:
11
11
  name: Build gem documentation
12
- runs-on: ubuntu-20.04
12
+ runs-on: ubuntu-22.04
13
13
  timeout-minutes: 5
14
14
  steps:
15
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v3
16
16
 
17
17
  - name: Install the correct Ruby version
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
20
20
  ruby-version: 2.5
21
21
  bundler-cache: true
22
- rubygems: latest
22
+ rubygems: '3.3.26'
23
23
 
24
24
  - name: Prepare the virtual environment
25
25
  uses: hausgold/actions/ci@master
@@ -0,0 +1,47 @@
1
+ name: Release
2
+ run-name: Release ${{ github.event.inputs.VERSION }}
3
+
4
+ on:
5
+ workflow_dispatch:
6
+ inputs:
7
+ VERSION:
8
+ description: The new version to release. (eg. `1.0.0`) Check the
9
+ changelog for the latest version.
10
+
11
+ concurrency:
12
+ group: '${{ github.event.inputs.VERSION }}'
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ docs:
17
+ name: Release the gem
18
+ runs-on: ubuntu-22.04
19
+ timeout-minutes: 5
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+
23
+ - name: Install Ruby 2.5
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: 2.5
27
+ bundler-cache: true
28
+ rubygems: '3.3.26'
29
+
30
+ - name: Prepare the virtual environment
31
+ uses: hausgold/actions/ci@master
32
+ with:
33
+ clone_token: '${{ secrets.CLONE_TOKEN }}'
34
+ settings: '${{ github.repository }}'
35
+ target: ci/gem-test
36
+
37
+ - name: Switch to SSH remotes for the Git repository
38
+ run: git-ssh-remotes
39
+
40
+ - name: Enforce version '${{ github.event.inputs.VERSION }}'
41
+ run: set-gem-version '${{ github.event.inputs.VERSION }}'
42
+
43
+ - name: Prepare the Git release commit
44
+ run: git-release-commit '${{ github.event.inputs.VERSION }}'
45
+
46
+ - name: Push the release Git commit/tag and package to the registry
47
+ run: make release
@@ -13,21 +13,21 @@ concurrency:
13
13
  jobs:
14
14
  test:
15
15
  name: 'Test the gem (Ruby ${{ matrix.ruby }})'
16
- runs-on: ubuntu-20.04
16
+ runs-on: ubuntu-22.04
17
17
  timeout-minutes: 5
18
18
  strategy:
19
19
  fail-fast: false
20
20
  matrix:
21
- ruby: [2.3, 2.4, 2.5, 2.6]
21
+ ruby: ['2.5', '2.7']
22
22
  steps:
23
- - uses: actions/checkout@v2
23
+ - uses: actions/checkout@v3
24
24
 
25
25
  - name: Install the correct Ruby version
26
26
  uses: ruby/setup-ruby@v1
27
27
  with:
28
28
  ruby-version: ${{ matrix.ruby }}
29
29
  bundler-cache: true
30
- rubygems: latest
30
+ rubygems: '3.3.26'
31
31
 
32
32
  - name: Prepare the virtual environment
33
33
  uses: hausgold/actions/ci@master
@@ -44,7 +44,7 @@ jobs:
44
44
 
45
45
  trigger-docs:
46
46
  name: Trigger the documentation upload
47
- runs-on: ubuntu-20.04
47
+ runs-on: ubuntu-22.04
48
48
  timeout-minutes: 2
49
49
  needs: test
50
50
  if: github.ref == 'refs/heads/master'
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
+ --backtrace
2
+ --force-color
1
3
  --format documentation
2
- --color
data/.rubocop.yml CHANGED
@@ -1,14 +1,19 @@
1
- require: rubocop-rspec
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-rails
2
4
 
3
5
  Rails:
4
6
  Enabled: true
5
7
 
6
- Documentation:
8
+ Style/Documentation:
7
9
  Enabled: true
8
10
 
9
11
  AllCops:
12
+ NewCops: enable
13
+ SuggestExtensions: false
10
14
  DisplayCopNames: true
11
15
  TargetRubyVersion: 2.5
16
+ TargetRailsVersion: 5.2
12
17
  Exclude:
13
18
  - bin/**/*
14
19
  - vendor/**/*
@@ -23,6 +28,10 @@ Metrics/BlockLength:
23
28
  - '**/*.rake'
24
29
  - doc/**/*.rb
25
30
 
31
+ # MFA is not yet enabled for our gems yet.
32
+ Gemspec/RequireMFA:
33
+ Enabled: false
34
+
26
35
  # Document all the things.
27
36
  Style/DocumentationMethod:
28
37
  Enabled: true
@@ -51,3 +60,11 @@ RSpec/FilePath:
51
60
  # Because we just implemented the ActiveRecord API.
52
61
  Rails/SkipsModelValidations:
53
62
  Enabled: false
63
+
64
+ # We stay with the original Ruby Style Guide recommendation.
65
+ Layout/LineLength:
66
+ Max: 80
67
+
68
+ # We highly depend on memoized helpers across the specs.
69
+ RSpec/MultipleMemoizedHelpers:
70
+ Enabled: false
data/.simplecov CHANGED
@@ -1,3 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'simplecov-html'
4
+ require 'simplecov_json_formatter'
5
+
6
+ SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
7
+ [
8
+ SimpleCov::Formatter::HTMLFormatter,
9
+ SimpleCov::Formatter::JSONFormatter
10
+ ]
11
+ )
12
+
1
13
  SimpleCov.start 'test_frameworks' do
2
14
  add_filter '/vendor/bundle/'
3
15
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### next
2
+
3
+ * TODO: Replace this bullet point with an actual description of a change.
4
+
5
+ ### 1.1.0
6
+
7
+ * Added support for Gem release automation
8
+
9
+ ### 1.0.0
10
+
11
+ * Bundler >= 2.3 is from now on required as minimal version (#18)
12
+ * Dropped support for Ruby < 2.5 (#18)
13
+ * Dropped support for Rails < 5.2 (#18)
14
+ * Updated all development/runtime gems to their latest
15
+ Ruby 2.5 compatible version (#18)
16
+
1
17
  ### 0.4.1
2
18
 
3
19
  * Added `InvoiceComment` models (#17)
@@ -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 development@hausgold.de. 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/Dockerfile CHANGED
@@ -2,7 +2,7 @@ FROM hausgold/ruby:2.5
2
2
  MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
3
3
 
4
4
  # Update system gem
5
- RUN gem update --system
5
+ RUN gem update --system '3.3.26'
6
6
 
7
7
  # Install system packages and the latest bundler
8
8
  RUN apt-get update -yqqq && \
@@ -11,8 +11,7 @@ RUN apt-get update -yqqq && \
11
11
  ca-certificates \
12
12
  bash-completion inotify-tools && \
13
13
  echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen && \
14
- gem install bundler -v '~> 2.0' --no-document --no-prerelease && \
15
- gem install bundler -v '~> 1.0' --no-document --no-prerelease
14
+ gem install bundler -v '~> 2.3.0' --no-document --no-prerelease
16
15
 
17
16
  # Add new web user
18
17
  RUN mkdir /app && \
data/Envfile CHANGED
@@ -1,6 +1,3 @@
1
1
  LANG=en_US.UTF-8
2
2
  LANGUAGE=en_US.UTF-8
3
3
  LC_ALL=en_US.UTF-8
4
-
5
- # Just fix this, so Appraisals with Rails 4 are working fine
6
- BUNDLER_VERSION=1.17.3
data/Guardfile ADDED
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A sample Guardfile
4
+ # More info at https://github.com/guard/guard#readme
5
+
6
+ ## Uncomment and set this to only include directories you want to watch
7
+ (directories %w[lib spec]).select do |d|
8
+ if Dir.exist?(d)
9
+ d
10
+ else
11
+ UI.warning("Directory #{d} does not exist")
12
+ end
13
+ end
14
+
15
+ ## Note: if you are using the `directories` clause above and you are not
16
+ ## watching the project directory ('.'), then you will want to move
17
+ ## the Guardfile to a watched dir and symlink it back, e.g.
18
+ #
19
+ # $ mkdir config
20
+ # $ mv Guardfile config/
21
+ # $ ln -s config/Guardfile .
22
+ #
23
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
24
+
25
+ # NOTE: The cmd option is now required due to the increasing number of ways
26
+ # rspec may be run, below are examples of the most common uses.
27
+ # * bundler: 'bundle exec rspec'
28
+ # * bundler binstubs: 'bin/rspec'
29
+ # * spring: 'bin/rspec' (This will use spring if running and you have
30
+ # installed the spring binstubs per the docs)
31
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
32
+ # * 'just' rspec: 'rspec'
33
+
34
+ guard :rspec, cmd: 'bundle exec rspec' do
35
+ watch('spec/spec_helper.rb') { 'spec' }
36
+ watch(%r{^lib/billomat.rb}) { 'spec' }
37
+ watch(%r{^spec/.+_spec\.rb$})
38
+ watch(%r{^lib/billomat/([^\\]+)\.rb$}) do |m|
39
+ "spec/#{m[1]}_spec.rb"
40
+ end
41
+ watch(%r{^lib/billomat/([^\\]+)/(.*)\.rb$}) do |m|
42
+ "spec/#{m[1]}/#{m[2]}_spec.rb"
43
+ end
44
+ end
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017 HAUSGOLD | talocasa GmbH
3
+ Copyright (c) 2023 HAUSGOLD | talocasa GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/Makefile CHANGED
@@ -9,6 +9,7 @@ SHELL := bash
9
9
  # Environment switches
10
10
  MAKE_ENV ?= docker
11
11
  COMPOSE_RUN_SHELL_FLAGS ?= --rm
12
+ BASH_RUN_SHELL_FLAGS ?=
12
13
 
13
14
  # Directories
14
15
  VENDOR_DIR ?= vendor/bundle
@@ -27,7 +28,9 @@ XARGS ?= xargs
27
28
  # Container binaries
28
29
  BUNDLE ?= bundle
29
30
  GEM ?= gem
31
+ GUARD ?= guard
30
32
  RAKE ?= rake
33
+ RSPEC ?= rspec
31
34
  RUBOCOP ?= rubocop
32
35
  YARD ?= yard
33
36
 
@@ -38,7 +41,8 @@ define run-shell
38
41
  $(COMPOSE) run $(COMPOSE_RUN_SHELL_FLAGS) \
39
42
  -e LANG=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 \
40
43
  -e HOME=/home/web -e BUNDLE_APP_CONFIG=/app/.bundle \
41
- -u `$(ID) -u` test bash -c 'sleep 0.1; echo; $(1)'
44
+ -u `$(ID) -u` test \
45
+ bash $(BASH_RUN_SHELL_FLAGS) -c 'sleep 0.1; echo; $(1)'
42
46
  endef
43
47
  else ifeq ($(MAKE_ENV),baremetal)
44
48
  define run-shell
@@ -50,11 +54,11 @@ all:
50
54
  # Billomat
51
55
  #
52
56
  # install Install the dependencies
53
- # update Update the local Gemset dependencies
54
57
  # clean Clean the dependencies
55
58
  #
56
59
  # test Run the whole test suite
57
60
  # test-style Test the code styles
61
+ # watch Watch for code changes and rerun the test suite
58
62
  #
59
63
  # docs Generate the Ruby documentation of the library
60
64
  # stats Print the code statistics (library and test suite)
@@ -64,12 +68,22 @@ all:
64
68
  # shell Run an interactive shell on the container
65
69
  # shell-irb Run an interactive IRB shell on the container
66
70
 
71
+ .interactive:
72
+ @$(eval BASH_RUN_SHELL_FLAGS = --login)
73
+
67
74
  install:
68
75
  # Install the dependencies
69
76
  @$(MKDIR) -p $(VENDOR_DIR)
70
77
  @$(call run-shell,$(BUNDLE) check || $(BUNDLE) install --path $(VENDOR_DIR))
71
- @$(call run-shell,GEM_HOME=vendor/bundle/ruby/$${RUBY_MAJOR}.0 \
72
- $(GEM) install bundler -v "~> 1.0")
78
+
79
+ update:
80
+ # Install the dependencies
81
+ @$(MKDIR) -p $(VENDOR_DIR)
82
+ @$(call run-shell,$(BUNDLE) update)
83
+
84
+ watch: install .interactive
85
+ # Watch for code changes and rerun the test suite
86
+ @$(call run-shell,$(BUNDLE) exec $(GUARD))
73
87
 
74
88
  test: \
75
89
  test-specs \
@@ -90,8 +104,8 @@ clean:
90
104
  # Clean the dependencies
91
105
  @$(RM) -rf $(VENDOR_DIR)
92
106
  @$(RM) -rf $(VENDOR_DIR)/Gemfile.lock
93
- @$(RM) -rf pkg
94
- @$(RM) -rf coverage
107
+ @$(RM) -rf .bundle .yardoc coverage pkg Gemfile.lock doc/api \
108
+ .rspec_status
95
109
 
96
110
  clean-containers:
97
111
  # Clean running containers
@@ -102,7 +116,7 @@ endif
102
116
  clean-images:
103
117
  # Clean build images
104
118
  ifeq ($(MAKE_ENV),docker)
105
- @-$(DOCKER) images | $(GREP) rimless \
119
+ @-$(DOCKER) images | $(GREP) $(shell basename "`pwd`") \
106
120
  | $(AWK) '{ print $$3 }' \
107
121
  | $(XARGS) -rn1 $(DOCKER) rmi -f
108
122
  endif
data/README.md CHANGED
@@ -14,7 +14,9 @@ online accounting service.
14
14
  - [Configuration](#configuration)
15
15
  - [Basic usage](#basic-usage)
16
16
  - [Development](#development)
17
+ - [Code of Conduct](#code-of-conduct)
17
18
  - [Contributing](#contributing)
19
+ - [Releasing](#releasing)
18
20
 
19
21
  ## Installation
20
22
 
@@ -87,17 +89,28 @@ client.delete
87
89
 
88
90
  ## Development
89
91
 
90
- After checking out the repo, run `bin/setup` to install dependencies. Then, run
91
- `rake spec` to run the tests. You can also run `bin/console` for an interactive
92
- prompt that will allow you to experiment.
92
+ After checking out the repo, run `make install` to install dependencies. Then,
93
+ run `make test` to run the tests. You can also run `make shell-irb` for an
94
+ interactive prompt that will allow you to experiment.
93
95
 
94
- To install this gem onto your local machine, run `bundle exec rake install`. To
95
- release a new version, update the version number in `version.rb`, and then run
96
- `bundle exec rake release`, which will create a git tag for the version, push
97
- git commits and tags, and push the `.gem` file to
98
- [rubygems.org](https://rubygems.org).
96
+ ## Code of Conduct
97
+
98
+ Everyone interacting in the project codebase, issue tracker, chat
99
+ rooms and mailing lists is expected to follow the [code of
100
+ conduct](./CODE_OF_CONDUCT.md).
99
101
 
100
102
  ## Contributing
101
103
 
102
104
  Bug reports and pull requests are welcome on GitHub at
103
- https://github.com/hausgold/billomat.
105
+ https://github.com/hausgold/billomat. Make sure that every pull request adds
106
+ a bullet point to the [changelog](./CHANGELOG.md) file with a reference to the
107
+ actual pull request.
108
+
109
+ ## Releasing
110
+
111
+ The release process of this Gem is fully automated. You just need to open the
112
+ Github Actions [Release
113
+ Workflow](https://github.com/hausgold/billomat/actions/workflows/release.yml)
114
+ and trigger a new run via the **Run workflow** button. Insert the new version
115
+ number (check the [changelog](./CHANGELOG.md) first for the latest release) and
116
+ you're done.
data/Rakefile CHANGED
@@ -2,76 +2,22 @@
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
- require 'rails/code_statistics'
6
- require 'pp'
5
+ require 'countless/rake_tasks'
7
6
 
8
7
  RSpec::Core::RakeTask.new(:spec)
9
8
 
10
9
  task default: :spec
11
10
 
12
- # Load some railties tasks
13
- load 'rails/tasks/statistics.rake'
14
- load 'rails/tasks/annotations.rake'
15
-
16
- # Clear the default statistics directory constant
17
- #
18
- # rubocop:disable Style/MutableConstant because we define it
19
- Object.send(:remove_const, :STATS_DIRECTORIES)
20
- ::STATS_DIRECTORIES = []
21
- # rubocop:enable Style/MutableConstant
22
-
23
- # Monkey patch the Rails +CodeStatistics+ class to support configurable
24
- # patterns per path. This is reuqired to support top-level only file matches.
25
- class CodeStatistics
26
- DEFAULT_PATTERN = /^(?!\.).*?\.(rb|js|coffee|rake)$/.freeze
27
-
28
- # Pass the possible +pattern+ argument down to the
29
- # +calculate_directory_statistics+ method call.
30
- def calculate_statistics
31
- Hash[@pairs.map do |pair|
32
- [pair.first, calculate_directory_statistics(*pair[1..-1])]
33
- end]
34
- end
35
-
36
- # Match the pattern against the individual file name and the relative file
37
- # path. This allows top-level only matches.
38
- def calculate_directory_statistics(directory, pattern = DEFAULT_PATTERN)
39
- stats = CodeStatisticsCalculator.new
40
-
41
- Dir.foreach(directory) do |file_name|
42
- path = "#{directory}/#{file_name}"
43
-
44
- if File.directory?(path) && (/^\./ !~ file_name)
45
- stats.add(calculate_directory_statistics(path, pattern))
46
- elsif file_name =~ pattern || path =~ pattern
47
- stats.add_by_file_path(path)
48
- end
49
- end
50
-
51
- stats
52
- end
53
- end
54
-
55
11
  # Configure all code statistics directories
56
- vendors = [
57
- [:unshift, 'Top-levels', 'lib', %r{lib(/billomat)?/[^/]+\.rb$}],
58
- [:unshift, 'Top-levels specs', 'spec', %r{spec/[^/]+_spec\.rb$}],
59
-
60
- [:unshift, 'Actions', 'lib/billomat/actions'],
61
-
62
- [:unshift, 'Models matchers', 'lib/billomat/models'],
63
- [:unshift, 'Models matchers specs', 'spec/models']
64
- ].reverse
65
-
66
- vendors.each do |method, type, dir, pattern|
67
- ::STATS_DIRECTORIES.send(method, [type, dir, pattern].compact)
68
- ::CodeStatistics::TEST_TYPES << type if type.include? 'specs'
69
- end
70
-
71
- # Setup annotations
72
- ENV['SOURCE_ANNOTATION_DIRECTORIES'] = 'spec,doc'
73
-
74
- desc 'Enumerate all annotations'
75
- task :notes do
76
- SourceAnnotationExtractor.enumerate '@?OPTIMIZE|@?FIXME|@?TODO', tag: true
12
+ Countless.configure do |config|
13
+ config.stats_base_directories = [
14
+ { name: 'Top-levels', dir: 'lib',
15
+ pattern: %r{/lib(/billomat)?/[^/]+\.rb$} },
16
+ { name: 'Top-levels specs', test: true, dir: 'spec',
17
+ pattern: %r{/spec(/billomat)?/[^/]+_spec\.rb$} },
18
+ { name: 'Actions', pattern: 'lib/billomat/actions/**/*.rb' },
19
+ { name: 'Models matchers', pattern: 'lib/billomat/models/**/*.rb' },
20
+ { name: 'Models matchers specs', test: true,
21
+ pattern: 'spec/models/**/*_spec.rb' }
22
+ ]
77
23
  end
data/billomat.gemspec CHANGED
@@ -5,42 +5,46 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'billomat/version'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'billomat'
9
- spec.version = Billomat::VERSION
10
- spec.licenses = ['MIT']
11
- spec.authors = ['Henning Vogt']
12
- spec.email = ['henning.vogt@hausgold.de']
13
-
14
- spec.summary = 'Wrapper for the Billomat API'
15
- spec.homepage = 'https://github.com/hausgold/billomat'
16
-
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the
18
- # 'allowed_push_host'
19
- # to allow pushing to a single host or delete this section to allow pushing
20
- # to any host.
21
- if spec.respond_to?(:metadata)
22
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
23
- else
24
- raise 'RubyGems 2.0 or newer is required to protect against ' \
25
- 'public gem pushes.'
26
- end
8
+ spec.name = 'billomat'
9
+ spec.version = Billomat::VERSION
10
+ spec.authors = ['Hermann Mayer', 'Henning Vogt']
11
+ spec.email = ['hermann.mayer92@gmail.com', 'henning.vogt@hausgold.de']
12
+
13
+ spec.license = 'MIT'
14
+ spec.summary = 'Wrapper for the Billomat API'
15
+ spec.description = 'Wrapper for the Billomat API'
16
+
17
+ base_uri = "https://github.com/hausgold/#{spec.name}"
18
+ spec.metadata = {
19
+ 'homepage_uri' => base_uri,
20
+ 'source_code_uri' => base_uri,
21
+ 'changelog_uri' => "#{base_uri}/blob/master/CHANGELOG.md",
22
+ 'bug_tracker_uri' => "#{base_uri}/issues",
23
+ 'documentation_uri' => "https://www.rubydoc.info/gems/#{spec.name}"
24
+ }
27
25
 
28
26
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
29
27
  f.match(%r{^(test|spec|features)/})
30
28
  end
31
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+
30
+ spec.bindir = 'exe'
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
32
  spec.require_paths = ['lib']
33
33
 
34
- spec.add_dependency 'rest-client', '~> 2.0', '>= 2.0.2'
35
-
36
- spec.add_development_dependency 'bundler', '>= 1.15', '< 3'
37
- spec.add_development_dependency 'pry', '~> 0.11'
38
- spec.add_development_dependency 'railties', '>= 4.2.0', '< 6.1'
39
- spec.add_development_dependency 'rake', '~> 10.0'
40
- spec.add_development_dependency 'rspec', '~> 3.0'
41
- spec.add_development_dependency 'rubocop', '~> 0.63.1'
42
- spec.add_development_dependency 'rubocop-rspec', '~> 1.31'
43
- spec.add_development_dependency 'simplecov', '< 0.18'
44
- spec.add_development_dependency 'yard', '~> 0.9.18'
45
- spec.add_development_dependency 'yard-activesupport-concern', '~> 0.0.1'
34
+ spec.required_ruby_version = '>= 2.5'
35
+
36
+ spec.add_dependency 'rest-client', '~> 2.1'
37
+
38
+ spec.add_development_dependency 'bundler', '~> 2.3'
39
+ spec.add_development_dependency 'countless', '~> 1.1'
40
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
41
+ spec.add_development_dependency 'irb', '~> 1.2'
42
+ spec.add_development_dependency 'rake', '~> 13.0'
43
+ spec.add_development_dependency 'rspec', '~> 3.12'
44
+ spec.add_development_dependency 'rubocop', '~> 1.28'
45
+ spec.add_development_dependency 'rubocop-rails', '~> 2.14'
46
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.10'
47
+ spec.add_development_dependency 'simplecov', '>= 0.22'
48
+ spec.add_development_dependency 'yard', '>= 0.9.28'
49
+ spec.add_development_dependency 'yard-activesupport-concern', '>= 0.0.1'
46
50
  end
data/bin/console CHANGED
@@ -10,5 +10,5 @@ require "billomat"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -89,7 +89,7 @@ module Billomat
89
89
  'X-BillomatApiKey' => config.api_key,
90
90
  'X-AppId' => config.app_id,
91
91
  'X-AppSecret' => config.app_secret
92
- }.reject { |_, val| val.nil? }
92
+ }.compact
93
93
  end
94
94
 
95
95
  # @return [Billomat::Configuration] the global gem configuration
@@ -28,14 +28,17 @@ module Billomat
28
28
  Billomat::Search.new(self, hash).run
29
29
  end
30
30
 
31
- ##
32
31
  # Initializes a new model.
33
32
  #
34
33
  # @param data [Hash] the attributes of the object
35
34
  # @return [Billomat::Models::Base] the record as an object
35
+ #
36
+ # rubocop:disable Style/OpenStructUse because of the convenient
37
+ # dynamic data access
36
38
  def initialize(data = {})
37
39
  @data = OpenStruct.new(data)
38
40
  end
41
+ # rubocop:enable Style/OpenStructUse
39
42
 
40
43
  # Persists the current object in the API.
41
44
  # When record is new it calls create, otherwise it saves the object.
@@ -49,6 +52,9 @@ module Billomat
49
52
  alias save! save
50
53
 
51
54
  # @return [TrueClass]
55
+ #
56
+ # rubocop:disable Style/OpenStructUse because of the convenient
57
+ # dynamic data access
52
58
  def create
53
59
  resp = Billomat::Gateway.new(
54
60
  :post, self.class.base_path, wrapped_data
@@ -59,6 +65,7 @@ module Billomat
59
65
  true
60
66
  end
61
67
  alias create! create
68
+ # rubocop:enable Style/OpenStructUse
62
69
 
63
70
  # @return [TrueClass]
64
71
  def update
@@ -24,7 +24,7 @@ module Billomat
24
24
  #
25
25
  # @return [Array<Billomat::Model::Base>]
26
26
  def run
27
- return [] if @hash.reject { |_k, v| v.nil? }.empty?
27
+ return [] if @hash.compact.empty?
28
28
 
29
29
  to_array(Billomat::Gateway.new(:get, path).run)
30
30
  end
@@ -1,5 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # The gem version details.
3
4
  module Billomat
4
- VERSION = '0.4.1'
5
+ # The version of the +billomat+ gem
6
+ VERSION = '1.1.0'
7
+
8
+ class << self
9
+ # Returns the version of gem as a string.
10
+ #
11
+ # @return [String] the gem version as string
12
+ def version
13
+ VERSION
14
+ end
15
+
16
+ # Returns the version of the gem as a +Gem::Version+.
17
+ #
18
+ # @return [Gem::Version] the gem version as object
19
+ def gem_version
20
+ Gem::Version.new VERSION
21
+ end
22
+ end
5
23
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: billomat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Hermann Mayer
7
8
  - Henning Vogt
8
- autorequire:
9
- bindir: bin
9
+ autorequire:
10
+ bindir: exe
10
11
  cert_chain: []
11
- date: 2022-06-27 00:00:00.000000000 Z
12
+ date: 2023-02-24 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rest-client
@@ -16,174 +17,185 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: '2.0'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 2.0.2
20
+ version: '2.1'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - "~>"
28
26
  - !ruby/object:Gem::Version
29
- version: '2.0'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 2.0.2
27
+ version: '2.1'
33
28
  - !ruby/object:Gem::Dependency
34
29
  name: bundler
35
30
  requirement: !ruby/object:Gem::Requirement
36
31
  requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '1.15'
40
- - - "<"
32
+ - - "~>"
41
33
  - !ruby/object:Gem::Version
42
- version: '3'
34
+ version: '2.3'
43
35
  type: :development
44
36
  prerelease: false
45
37
  version_requirements: !ruby/object:Gem::Requirement
46
38
  requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '1.15'
50
- - - "<"
39
+ - - "~>"
51
40
  - !ruby/object:Gem::Version
52
- version: '3'
41
+ version: '2.3'
53
42
  - !ruby/object:Gem::Dependency
54
- name: pry
43
+ name: countless
55
44
  requirement: !ruby/object:Gem::Requirement
56
45
  requirements:
57
46
  - - "~>"
58
47
  - !ruby/object:Gem::Version
59
- version: '0.11'
48
+ version: '1.1'
60
49
  type: :development
61
50
  prerelease: false
62
51
  version_requirements: !ruby/object:Gem::Requirement
63
52
  requirements:
64
53
  - - "~>"
65
54
  - !ruby/object:Gem::Version
66
- version: '0.11'
55
+ version: '1.1'
67
56
  - !ruby/object:Gem::Dependency
68
- name: railties
57
+ name: guard-rspec
69
58
  requirement: !ruby/object:Gem::Requirement
70
59
  requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: 4.2.0
74
- - - "<"
60
+ - - "~>"
75
61
  - !ruby/object:Gem::Version
76
- version: '6.1'
62
+ version: '4.7'
77
63
  type: :development
78
64
  prerelease: false
79
65
  version_requirements: !ruby/object:Gem::Requirement
80
66
  requirements:
81
- - - ">="
67
+ - - "~>"
82
68
  - !ruby/object:Gem::Version
83
- version: 4.2.0
84
- - - "<"
69
+ version: '4.7'
70
+ - !ruby/object:Gem::Dependency
71
+ name: irb
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
85
75
  - !ruby/object:Gem::Version
86
- version: '6.1'
76
+ version: '1.2'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.2'
87
84
  - !ruby/object:Gem::Dependency
88
85
  name: rake
89
86
  requirement: !ruby/object:Gem::Requirement
90
87
  requirements:
91
88
  - - "~>"
92
89
  - !ruby/object:Gem::Version
93
- version: '10.0'
90
+ version: '13.0'
94
91
  type: :development
95
92
  prerelease: false
96
93
  version_requirements: !ruby/object:Gem::Requirement
97
94
  requirements:
98
95
  - - "~>"
99
96
  - !ruby/object:Gem::Version
100
- version: '10.0'
97
+ version: '13.0'
101
98
  - !ruby/object:Gem::Dependency
102
99
  name: rspec
103
100
  requirement: !ruby/object:Gem::Requirement
104
101
  requirements:
105
102
  - - "~>"
106
103
  - !ruby/object:Gem::Version
107
- version: '3.0'
104
+ version: '3.12'
108
105
  type: :development
109
106
  prerelease: false
110
107
  version_requirements: !ruby/object:Gem::Requirement
111
108
  requirements:
112
109
  - - "~>"
113
110
  - !ruby/object:Gem::Version
114
- version: '3.0'
111
+ version: '3.12'
115
112
  - !ruby/object:Gem::Dependency
116
113
  name: rubocop
117
114
  requirement: !ruby/object:Gem::Requirement
118
115
  requirements:
119
116
  - - "~>"
120
117
  - !ruby/object:Gem::Version
121
- version: 0.63.1
118
+ version: '1.28'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '1.28'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rubocop-rails
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '2.14'
122
133
  type: :development
123
134
  prerelease: false
124
135
  version_requirements: !ruby/object:Gem::Requirement
125
136
  requirements:
126
137
  - - "~>"
127
138
  - !ruby/object:Gem::Version
128
- version: 0.63.1
139
+ version: '2.14'
129
140
  - !ruby/object:Gem::Dependency
130
141
  name: rubocop-rspec
131
142
  requirement: !ruby/object:Gem::Requirement
132
143
  requirements:
133
144
  - - "~>"
134
145
  - !ruby/object:Gem::Version
135
- version: '1.31'
146
+ version: '2.10'
136
147
  type: :development
137
148
  prerelease: false
138
149
  version_requirements: !ruby/object:Gem::Requirement
139
150
  requirements:
140
151
  - - "~>"
141
152
  - !ruby/object:Gem::Version
142
- version: '1.31'
153
+ version: '2.10'
143
154
  - !ruby/object:Gem::Dependency
144
155
  name: simplecov
145
156
  requirement: !ruby/object:Gem::Requirement
146
157
  requirements:
147
- - - "<"
158
+ - - ">="
148
159
  - !ruby/object:Gem::Version
149
- version: '0.18'
160
+ version: '0.22'
150
161
  type: :development
151
162
  prerelease: false
152
163
  version_requirements: !ruby/object:Gem::Requirement
153
164
  requirements:
154
- - - "<"
165
+ - - ">="
155
166
  - !ruby/object:Gem::Version
156
- version: '0.18'
167
+ version: '0.22'
157
168
  - !ruby/object:Gem::Dependency
158
169
  name: yard
159
170
  requirement: !ruby/object:Gem::Requirement
160
171
  requirements:
161
- - - "~>"
172
+ - - ">="
162
173
  - !ruby/object:Gem::Version
163
- version: 0.9.18
174
+ version: 0.9.28
164
175
  type: :development
165
176
  prerelease: false
166
177
  version_requirements: !ruby/object:Gem::Requirement
167
178
  requirements:
168
- - - "~>"
179
+ - - ">="
169
180
  - !ruby/object:Gem::Version
170
- version: 0.9.18
181
+ version: 0.9.28
171
182
  - !ruby/object:Gem::Dependency
172
183
  name: yard-activesupport-concern
173
184
  requirement: !ruby/object:Gem::Requirement
174
185
  requirements:
175
- - - "~>"
186
+ - - ">="
176
187
  - !ruby/object:Gem::Version
177
188
  version: 0.0.1
178
189
  type: :development
179
190
  prerelease: false
180
191
  version_requirements: !ruby/object:Gem::Requirement
181
192
  requirements:
182
- - - "~>"
193
+ - - ">="
183
194
  - !ruby/object:Gem::Version
184
195
  version: 0.0.1
185
- description:
196
+ description: Wrapper for the Billomat API
186
197
  email:
198
+ - hermann.mayer92@gmail.com
187
199
  - henning.vogt@hausgold.de
188
200
  executables: []
189
201
  extensions: []
@@ -191,6 +203,7 @@ extra_rdoc_files: []
191
203
  files:
192
204
  - ".editorconfig"
193
205
  - ".github/workflows/documentation.yml"
206
+ - ".github/workflows/release.yml"
194
207
  - ".github/workflows/test.yml"
195
208
  - ".gitignore"
196
209
  - ".rspec"
@@ -198,9 +211,11 @@ files:
198
211
  - ".simplecov"
199
212
  - ".yardopts"
200
213
  - CHANGELOG.md
214
+ - CODE_OF_CONDUCT.md
201
215
  - Dockerfile
202
216
  - Envfile
203
217
  - Gemfile
218
+ - Guardfile
204
219
  - LICENSE
205
220
  - Makefile
206
221
  - README.md
@@ -236,12 +251,16 @@ files:
236
251
  - lib/billomat/models/template.rb
237
252
  - lib/billomat/search.rb
238
253
  - lib/billomat/version.rb
239
- homepage: https://github.com/hausgold/billomat
254
+ homepage:
240
255
  licenses:
241
256
  - MIT
242
257
  metadata:
243
- allowed_push_host: https://rubygems.org
244
- post_install_message:
258
+ homepage_uri: https://github.com/hausgold/billomat
259
+ source_code_uri: https://github.com/hausgold/billomat
260
+ changelog_uri: https://github.com/hausgold/billomat/blob/master/CHANGELOG.md
261
+ bug_tracker_uri: https://github.com/hausgold/billomat/issues
262
+ documentation_uri: https://www.rubydoc.info/gems/billomat
263
+ post_install_message:
245
264
  rdoc_options: []
246
265
  require_paths:
247
266
  - lib
@@ -249,15 +268,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
249
268
  requirements:
250
269
  - - ">="
251
270
  - !ruby/object:Gem::Version
252
- version: '0'
271
+ version: '2.5'
253
272
  required_rubygems_version: !ruby/object:Gem::Requirement
254
273
  requirements:
255
274
  - - ">="
256
275
  - !ruby/object:Gem::Version
257
276
  version: '0'
258
277
  requirements: []
259
- rubygems_version: 3.0.9
260
- signing_key:
278
+ rubygems_version: 3.3.26
279
+ signing_key:
261
280
  specification_version: 4
262
281
  summary: Wrapper for the Billomat API
263
282
  test_files: []