billomat 0.2.0 → 0.4.1
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 +4 -4
- data/.github/workflows/documentation.yml +39 -0
- data/.github/workflows/test.yml +60 -0
- data/.gitignore +5 -0
- data/.rubocop.yml +53 -0
- data/.yardopts +6 -0
- data/CHANGELOG.md +52 -0
- data/Dockerfile +29 -0
- data/Envfile +6 -0
- data/Gemfile +3 -1
- data/Makefile +135 -0
- data/README.md +4 -4
- data/Rakefile +74 -3
- data/billomat.gemspec +6 -3
- data/config/docker/.bash_profile +3 -0
- data/config/docker/.bashrc +48 -0
- data/config/docker/.inputrc +17 -0
- data/docker-compose.yml +9 -0
- data/lib/billomat/actions/cancel.rb +3 -5
- data/lib/billomat/actions/complete.rb +8 -12
- data/lib/billomat/actions/email.rb +6 -10
- data/lib/billomat/actions/pdf.rb +4 -10
- data/lib/billomat/actions/uncancel.rb +3 -6
- data/lib/billomat/actions.rb +0 -1
- data/lib/billomat/configuration.rb +1 -0
- data/lib/billomat/gateway.rb +42 -22
- data/lib/billomat/models/base.rb +25 -26
- data/lib/billomat/models/client.rb +3 -4
- data/lib/billomat/models/contact.rb +3 -4
- data/lib/billomat/models/credit_note.rb +18 -0
- data/lib/billomat/models/credit_note_item.rb +18 -0
- data/lib/billomat/models/invoice.rb +6 -11
- data/lib/billomat/models/invoice_comment.rb +19 -0
- data/lib/billomat/models/invoice_item.rb +3 -3
- data/lib/billomat/models/invoice_payment.rb +3 -4
- data/lib/billomat/models/tag.rb +3 -4
- data/lib/billomat/models/template.rb +3 -4
- data/lib/billomat/models.rb +4 -2
- data/lib/billomat/search.rb +12 -14
- data/lib/billomat/version.rb +1 -1
- data/lib/billomat.rb +15 -18
- metadata +97 -7
- data/.travis.yml +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 51765c8b9dedcc01ea242a91edbf539315979e7b50e6345384e6d1ce5cb4bd64
|
|
4
|
+
data.tar.gz: a9eb5a65d8c55ab1b8f7cede5572608d15d19d71d4c7301715e6454486ae782e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b036325f89f2dce9c2621514bff6096f29e4eca62fabea97e55855e4863512ea07d35875e7221aa8dd4471df100179447b0008aed2cc2388c418ae2df3444fd
|
|
7
|
+
data.tar.gz: e1438472b79a8db5ac970157c048be626257a388a73679f62dd8423b20a6c80190839ad56348bb9d1aa358516374c4c0be8461460a60c86a2da50926ed996d23
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Build Documentation
|
|
2
|
+
on:
|
|
3
|
+
repository_dispatch:
|
|
4
|
+
types: [documentation]
|
|
5
|
+
|
|
6
|
+
concurrency:
|
|
7
|
+
group: 'docs'
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
docs:
|
|
11
|
+
name: Build gem documentation
|
|
12
|
+
runs-on: ubuntu-20.04
|
|
13
|
+
timeout-minutes: 5
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v2
|
|
16
|
+
|
|
17
|
+
- name: Install the correct Ruby version
|
|
18
|
+
uses: ruby/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: 2.5
|
|
21
|
+
bundler-cache: true
|
|
22
|
+
rubygems: latest
|
|
23
|
+
|
|
24
|
+
- name: Prepare the virtual environment
|
|
25
|
+
uses: hausgold/actions/ci@master
|
|
26
|
+
with:
|
|
27
|
+
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
|
28
|
+
settings: '${{ github.repository }}'
|
|
29
|
+
target: ci/gem-test
|
|
30
|
+
|
|
31
|
+
- name: Build gem documentation
|
|
32
|
+
run: make docs
|
|
33
|
+
|
|
34
|
+
- name: Upload the code coverage report
|
|
35
|
+
run: coverage
|
|
36
|
+
|
|
37
|
+
- name: Add this job to the commit status
|
|
38
|
+
run: commit-status '${{ job.status }}'
|
|
39
|
+
if: always()
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- '**'
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: '0 0 * * MON'
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: '${{ github.ref }}'
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
name: 'Test the gem (Ruby ${{ matrix.ruby }})'
|
|
16
|
+
runs-on: ubuntu-20.04
|
|
17
|
+
timeout-minutes: 5
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
ruby: [2.3, 2.4, 2.5, 2.6]
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v2
|
|
24
|
+
|
|
25
|
+
- name: Install the correct Ruby version
|
|
26
|
+
uses: ruby/setup-ruby@v1
|
|
27
|
+
with:
|
|
28
|
+
ruby-version: ${{ matrix.ruby }}
|
|
29
|
+
bundler-cache: true
|
|
30
|
+
rubygems: latest
|
|
31
|
+
|
|
32
|
+
- name: Prepare the virtual environment
|
|
33
|
+
uses: hausgold/actions/ci@master
|
|
34
|
+
with:
|
|
35
|
+
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
|
36
|
+
settings: '${{ github.repository }}'
|
|
37
|
+
target: ci/gem-test
|
|
38
|
+
|
|
39
|
+
- name: Run the gem tests
|
|
40
|
+
run: make test
|
|
41
|
+
|
|
42
|
+
- name: Upload the code coverage report
|
|
43
|
+
run: coverage
|
|
44
|
+
|
|
45
|
+
trigger-docs:
|
|
46
|
+
name: Trigger the documentation upload
|
|
47
|
+
runs-on: ubuntu-20.04
|
|
48
|
+
timeout-minutes: 2
|
|
49
|
+
needs: test
|
|
50
|
+
if: github.ref == 'refs/heads/master'
|
|
51
|
+
steps:
|
|
52
|
+
- name: Prepare the virtual environment
|
|
53
|
+
uses: hausgold/actions/ci@master
|
|
54
|
+
with:
|
|
55
|
+
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
|
56
|
+
settings: '${{ github.repository }}'
|
|
57
|
+
target: ci/noop
|
|
58
|
+
|
|
59
|
+
- name: Trigger the documentation upload
|
|
60
|
+
run: workflow documentation
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require: rubocop-rspec
|
|
2
|
+
|
|
3
|
+
Rails:
|
|
4
|
+
Enabled: true
|
|
5
|
+
|
|
6
|
+
Documentation:
|
|
7
|
+
Enabled: true
|
|
8
|
+
|
|
9
|
+
AllCops:
|
|
10
|
+
DisplayCopNames: true
|
|
11
|
+
TargetRubyVersion: 2.5
|
|
12
|
+
Exclude:
|
|
13
|
+
- bin/**/*
|
|
14
|
+
- vendor/**/*
|
|
15
|
+
- build/**/*
|
|
16
|
+
- gemfiles/**/*
|
|
17
|
+
|
|
18
|
+
Metrics/BlockLength:
|
|
19
|
+
Exclude:
|
|
20
|
+
- Rakefile
|
|
21
|
+
- '*.gemspec'
|
|
22
|
+
- spec/**/*.rb
|
|
23
|
+
- '**/*.rake'
|
|
24
|
+
- doc/**/*.rb
|
|
25
|
+
|
|
26
|
+
# Document all the things.
|
|
27
|
+
Style/DocumentationMethod:
|
|
28
|
+
Enabled: true
|
|
29
|
+
RequireForNonPublicMethods: true
|
|
30
|
+
|
|
31
|
+
# It's a deliberate idiom in RSpec.
|
|
32
|
+
# See: https://github.com/bbatsov/rubocop/issues/4222
|
|
33
|
+
Lint/AmbiguousBlockAssociation:
|
|
34
|
+
Exclude:
|
|
35
|
+
- "spec/**/*"
|
|
36
|
+
|
|
37
|
+
# Because +expect_any_instance_of().to have_received()+ is not
|
|
38
|
+
# supported with the +with(hash_including)+ matchers
|
|
39
|
+
RSpec/MessageSpies:
|
|
40
|
+
EnforcedStyle: receive
|
|
41
|
+
|
|
42
|
+
# Because nesting makes sense here to group the feature tests
|
|
43
|
+
# more effective. This increases maintainability.
|
|
44
|
+
RSpec/NestedGroups:
|
|
45
|
+
Max: 4
|
|
46
|
+
|
|
47
|
+
# Disable regular Rails spec paths.
|
|
48
|
+
RSpec/FilePath:
|
|
49
|
+
Enabled: false
|
|
50
|
+
|
|
51
|
+
# Because we just implemented the ActiveRecord API.
|
|
52
|
+
Rails/SkipsModelValidations:
|
|
53
|
+
Enabled: false
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
### 0.4.1
|
|
2
|
+
|
|
3
|
+
* Added `InvoiceComment` models (#17)
|
|
4
|
+
|
|
5
|
+
### 0.3.0
|
|
6
|
+
|
|
7
|
+
* Improve error handling (breaking change, as we are now raising
|
|
8
|
+
`Billomat::GatewayError`s rather than just the client's
|
|
9
|
+
`RestClient::Exception`) (#15)
|
|
10
|
+
* Added bang variants to API methods
|
|
11
|
+
(`Billomat::Models::Base#{save!,create!,update!,delete!}`) (#16)
|
|
12
|
+
* Added `CreditNote` and `CreditNoteItem` models (#14)
|
|
13
|
+
* Moved to GitHub Actions
|
|
14
|
+
* Migrated to our own coverage reporting
|
|
15
|
+
|
|
16
|
+
### 0.2.0
|
|
17
|
+
|
|
18
|
+
* Add codeclimate test runner
|
|
19
|
+
* Update codeclimate reporter id
|
|
20
|
+
* Switched to SVG project teasers
|
|
21
|
+
* Updated Travis CI and Code Climate configs (#11)
|
|
22
|
+
* Changed travis-ci.org to travis-ci.com links
|
|
23
|
+
* Adds templates and tags to models (#13)
|
|
24
|
+
|
|
25
|
+
### 0.1.6
|
|
26
|
+
|
|
27
|
+
* Support registered apps
|
|
28
|
+
* Added `app_id` and `app_secret` to configuration (#9)
|
|
29
|
+
|
|
30
|
+
### 0.1.5
|
|
31
|
+
|
|
32
|
+
* Added contact support
|
|
33
|
+
|
|
34
|
+
### 0.1.4
|
|
35
|
+
|
|
36
|
+
* Made timeout configurable
|
|
37
|
+
|
|
38
|
+
### 0.1.3
|
|
39
|
+
|
|
40
|
+
* Added `#as_json` to base model
|
|
41
|
+
|
|
42
|
+
### 0.1.2
|
|
43
|
+
|
|
44
|
+
* Small fixes and code coverage
|
|
45
|
+
|
|
46
|
+
### 0.1.1
|
|
47
|
+
|
|
48
|
+
* Improved documentation and README
|
|
49
|
+
|
|
50
|
+
### 0.1.0
|
|
51
|
+
|
|
52
|
+
* Initial release
|
data/Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
FROM hausgold/ruby:2.5
|
|
2
|
+
MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
|
|
3
|
+
|
|
4
|
+
# Update system gem
|
|
5
|
+
RUN gem update --system
|
|
6
|
+
|
|
7
|
+
# Install system packages and the latest bundler
|
|
8
|
+
RUN apt-get update -yqqq && \
|
|
9
|
+
apt-get install -y \
|
|
10
|
+
build-essential locales sudo vim \
|
|
11
|
+
ca-certificates \
|
|
12
|
+
bash-completion inotify-tools && \
|
|
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
|
|
16
|
+
|
|
17
|
+
# Add new web user
|
|
18
|
+
RUN mkdir /app && \
|
|
19
|
+
adduser web --home /home/web --shell /bin/bash \
|
|
20
|
+
--disabled-password --gecos ""
|
|
21
|
+
COPY config/docker/* /home/web/
|
|
22
|
+
RUN chown web:web -R /app /home/web /usr/local/bundle && \
|
|
23
|
+
mkdir -p /home/web/.ssh
|
|
24
|
+
|
|
25
|
+
# Set the root password and grant root access to web
|
|
26
|
+
RUN echo 'root:root' | chpasswd
|
|
27
|
+
RUN echo 'web ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
|
28
|
+
|
|
29
|
+
WORKDIR /app
|
data/Envfile
ADDED
data/Gemfile
CHANGED
data/Makefile
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
MAKEFLAGS += --warn-undefined-variables -j1
|
|
2
|
+
SHELL := bash
|
|
3
|
+
.SHELLFLAGS := -eu -o pipefail -c
|
|
4
|
+
.DEFAULT_GOAL := all
|
|
5
|
+
.DELETE_ON_ERROR:
|
|
6
|
+
.SUFFIXES:
|
|
7
|
+
.PHONY:
|
|
8
|
+
|
|
9
|
+
# Environment switches
|
|
10
|
+
MAKE_ENV ?= docker
|
|
11
|
+
COMPOSE_RUN_SHELL_FLAGS ?= --rm
|
|
12
|
+
|
|
13
|
+
# Directories
|
|
14
|
+
VENDOR_DIR ?= vendor/bundle
|
|
15
|
+
|
|
16
|
+
# Host binaries
|
|
17
|
+
AWK ?= awk
|
|
18
|
+
BASH ?= bash
|
|
19
|
+
COMPOSE ?= docker-compose
|
|
20
|
+
DOCKER ?= docker
|
|
21
|
+
GREP ?= grep
|
|
22
|
+
ID ?= id
|
|
23
|
+
MKDIR ?= mkdir
|
|
24
|
+
RM ?= rm
|
|
25
|
+
XARGS ?= xargs
|
|
26
|
+
|
|
27
|
+
# Container binaries
|
|
28
|
+
BUNDLE ?= bundle
|
|
29
|
+
GEM ?= gem
|
|
30
|
+
RAKE ?= rake
|
|
31
|
+
RUBOCOP ?= rubocop
|
|
32
|
+
YARD ?= yard
|
|
33
|
+
|
|
34
|
+
# Define a generic shell run wrapper
|
|
35
|
+
# $1 - The command to run
|
|
36
|
+
ifeq ($(MAKE_ENV),docker)
|
|
37
|
+
define run-shell
|
|
38
|
+
$(COMPOSE) run $(COMPOSE_RUN_SHELL_FLAGS) \
|
|
39
|
+
-e LANG=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 \
|
|
40
|
+
-e HOME=/home/web -e BUNDLE_APP_CONFIG=/app/.bundle \
|
|
41
|
+
-u `$(ID) -u` test bash -c 'sleep 0.1; echo; $(1)'
|
|
42
|
+
endef
|
|
43
|
+
else ifeq ($(MAKE_ENV),baremetal)
|
|
44
|
+
define run-shell
|
|
45
|
+
$(1)
|
|
46
|
+
endef
|
|
47
|
+
endif
|
|
48
|
+
|
|
49
|
+
all:
|
|
50
|
+
# Billomat
|
|
51
|
+
#
|
|
52
|
+
# install Install the dependencies
|
|
53
|
+
# update Update the local Gemset dependencies
|
|
54
|
+
# clean Clean the dependencies
|
|
55
|
+
#
|
|
56
|
+
# test Run the whole test suite
|
|
57
|
+
# test-style Test the code styles
|
|
58
|
+
#
|
|
59
|
+
# docs Generate the Ruby documentation of the library
|
|
60
|
+
# stats Print the code statistics (library and test suite)
|
|
61
|
+
# notes Print all the notes from the code
|
|
62
|
+
# release Release a new Gem version (maintainers only)
|
|
63
|
+
#
|
|
64
|
+
# shell Run an interactive shell on the container
|
|
65
|
+
# shell-irb Run an interactive IRB shell on the container
|
|
66
|
+
|
|
67
|
+
install:
|
|
68
|
+
# Install the dependencies
|
|
69
|
+
@$(MKDIR) -p $(VENDOR_DIR)
|
|
70
|
+
@$(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")
|
|
73
|
+
|
|
74
|
+
test: \
|
|
75
|
+
test-specs \
|
|
76
|
+
test-style
|
|
77
|
+
|
|
78
|
+
test-specs:
|
|
79
|
+
# Run the whole test suite
|
|
80
|
+
@$(call run-shell,$(BUNDLE) exec $(RAKE) stats spec)
|
|
81
|
+
|
|
82
|
+
test-style: \
|
|
83
|
+
test-style-ruby
|
|
84
|
+
|
|
85
|
+
test-style-ruby:
|
|
86
|
+
# Run the static code analyzer (rubocop)
|
|
87
|
+
@$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a)
|
|
88
|
+
|
|
89
|
+
clean:
|
|
90
|
+
# Clean the dependencies
|
|
91
|
+
@$(RM) -rf $(VENDOR_DIR)
|
|
92
|
+
@$(RM) -rf $(VENDOR_DIR)/Gemfile.lock
|
|
93
|
+
@$(RM) -rf pkg
|
|
94
|
+
@$(RM) -rf coverage
|
|
95
|
+
|
|
96
|
+
clean-containers:
|
|
97
|
+
# Clean running containers
|
|
98
|
+
ifeq ($(MAKE_ENV),docker)
|
|
99
|
+
@$(COMPOSE) down
|
|
100
|
+
endif
|
|
101
|
+
|
|
102
|
+
clean-images:
|
|
103
|
+
# Clean build images
|
|
104
|
+
ifeq ($(MAKE_ENV),docker)
|
|
105
|
+
@-$(DOCKER) images | $(GREP) rimless \
|
|
106
|
+
| $(AWK) '{ print $$3 }' \
|
|
107
|
+
| $(XARGS) -rn1 $(DOCKER) rmi -f
|
|
108
|
+
endif
|
|
109
|
+
|
|
110
|
+
distclean: clean clean-containers clean-images
|
|
111
|
+
|
|
112
|
+
shell:
|
|
113
|
+
# Run an interactive shell on the container
|
|
114
|
+
@$(call run-shell,$(BASH) -i)
|
|
115
|
+
|
|
116
|
+
shell-irb:
|
|
117
|
+
# Run an interactive IRB shell on the container
|
|
118
|
+
@$(call run-shell,bin/console)
|
|
119
|
+
|
|
120
|
+
docs:
|
|
121
|
+
# Build the API documentation
|
|
122
|
+
@$(call run-shell,$(BUNDLE) exec $(YARD) -q && \
|
|
123
|
+
$(BUNDLE) exec $(YARD) stats --list-undoc --compact)
|
|
124
|
+
|
|
125
|
+
notes:
|
|
126
|
+
# Print the code statistics (library and test suite)
|
|
127
|
+
@$(call run-shell,$(BUNDLE) exec $(RAKE) notes)
|
|
128
|
+
|
|
129
|
+
stats:
|
|
130
|
+
# Print all the notes from the code
|
|
131
|
+
@$(call run-shell,$(BUNDLE) exec $(RAKE) stats)
|
|
132
|
+
|
|
133
|
+
release:
|
|
134
|
+
# Release a new gem version
|
|
135
|
+
@$(BUNDLE) exec $(RAKE) release
|
data/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
[](https://github.com/hausgold/billomat/actions/workflows/test.yml)
|
|
4
4
|
[](https://badge.fury.io/rb/billomat)
|
|
5
|
-
[](https://knowledge.hausgold.de/coverage)
|
|
6
|
+
[](https://knowledge.hausgold.de/coverage)
|
|
7
|
+
[](https://www.rubydoc.info/gems/billomat)
|
|
8
8
|
|
|
9
9
|
This gem provides a Ruby API for [billomat.com](https://billomat.com) - an
|
|
10
10
|
online accounting service.
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
4
|
+
require 'rspec/core/rake_task'
|
|
5
|
+
require 'rails/code_statistics'
|
|
6
|
+
require 'pp'
|
|
3
7
|
|
|
4
8
|
RSpec::Core::RakeTask.new(:spec)
|
|
5
9
|
|
|
6
|
-
task :
|
|
10
|
+
task default: :spec
|
|
11
|
+
|
|
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
|
+
# 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
|
|
77
|
+
end
|
data/billomat.gemspec
CHANGED
|
@@ -31,13 +31,16 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
32
32
|
spec.require_paths = ['lib']
|
|
33
33
|
|
|
34
|
-
spec.required_ruby_version = '>= 2.0'
|
|
35
|
-
|
|
36
34
|
spec.add_dependency 'rest-client', '~> 2.0', '>= 2.0.2'
|
|
37
35
|
|
|
38
36
|
spec.add_development_dependency 'bundler', '>= 1.15', '< 3'
|
|
39
37
|
spec.add_development_dependency 'pry', '~> 0.11'
|
|
38
|
+
spec.add_development_dependency 'railties', '>= 4.2.0', '< 6.1'
|
|
40
39
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
41
40
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
42
|
-
spec.add_development_dependency '
|
|
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'
|
|
43
46
|
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# ~/.bashrc: executed by bash(1) for non-login shells.
|
|
2
|
+
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
|
3
|
+
# for examples
|
|
4
|
+
|
|
5
|
+
_GEM_PATHS=$(ls -d1 ${HOME}/.gem/ruby/*/bin 2>/dev/null | paste -sd ':')
|
|
6
|
+
_APP_PATHS=$(ls -d1 /app/vendor/bundle/ruby/*/bin 2>/dev/null | paste -sd ':')
|
|
7
|
+
|
|
8
|
+
export PATH="${_GEM_PATHS}:${_APP_PATHS}:${PATH}"
|
|
9
|
+
export PATH="/app/node_modules/.bin:${HOME}/.bin:/app/bin:${PATH}"
|
|
10
|
+
export MAKE_ENV=baremetal
|
|
11
|
+
|
|
12
|
+
# Disable the autostart of all supervisord units
|
|
13
|
+
sudo sed -i 's/autostart=.*/autostart=false/g' /etc/supervisor/conf.d/*
|
|
14
|
+
|
|
15
|
+
# Start the supervisord (empty, no units)
|
|
16
|
+
sudo supervisord >/dev/null 2>&1 &
|
|
17
|
+
|
|
18
|
+
# Wait for supervisord
|
|
19
|
+
while ! supervisorctl status >/dev/null 2>&1; do sleep 1; done
|
|
20
|
+
|
|
21
|
+
# Boot the mDNS stack
|
|
22
|
+
echo '# Start the mDNS stack'
|
|
23
|
+
sudo supervisorctl start dbus avahi
|
|
24
|
+
echo
|
|
25
|
+
|
|
26
|
+
function watch-make-test()
|
|
27
|
+
{
|
|
28
|
+
while [ 1 ]; do
|
|
29
|
+
inotifywait --quiet -r `pwd` -e close_write --format '%e -> %w%f'
|
|
30
|
+
make test
|
|
31
|
+
done
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function watch-make()
|
|
35
|
+
{
|
|
36
|
+
while [ 1 ]; do
|
|
37
|
+
inotifywait --quiet -r `pwd` -e close_write --format '%e -> %w%f'
|
|
38
|
+
make $@
|
|
39
|
+
done
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function watch-run()
|
|
43
|
+
{
|
|
44
|
+
while [ 1 ]; do
|
|
45
|
+
inotifywait --quiet -r `pwd` -e close_write --format '%e -> %w%f'
|
|
46
|
+
bash -c "$@"
|
|
47
|
+
done
|
|
48
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
|
|
2
|
+
"\e[1;5C": forward-word
|
|
3
|
+
"\e[1;5D": backward-word
|
|
4
|
+
"\e[5C": forward-word
|
|
5
|
+
"\e[5D": backward-word
|
|
6
|
+
"\e\e[C": forward-word
|
|
7
|
+
"\e\e[D": backward-word
|
|
8
|
+
|
|
9
|
+
# handle common Home/End escape codes
|
|
10
|
+
"\e[1~": beginning-of-line
|
|
11
|
+
"\e[4~": end-of-line
|
|
12
|
+
"\e[7~": beginning-of-line
|
|
13
|
+
"\e[8~": end-of-line
|
|
14
|
+
"\eOH": beginning-of-line
|
|
15
|
+
"\eOF": end-of-line
|
|
16
|
+
"\e[H": beginning-of-line
|
|
17
|
+
"\e[F": end-of-line
|
data/docker-compose.yml
ADDED
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
module Billomat
|
|
4
4
|
module Actions
|
|
5
|
-
##
|
|
6
5
|
# This actions cancels an invoice
|
|
7
6
|
class Cancel
|
|
8
|
-
# @param [String]
|
|
7
|
+
# @param invoice_id [String] the invoice ID
|
|
9
8
|
# @return [Billomat::Actions::Cancel]
|
|
10
9
|
def initialize(invoice_id)
|
|
11
10
|
@invoice_id = invoice_id
|
|
12
11
|
end
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
# Calls the gateway
|
|
13
|
+
# Calls the gateway.
|
|
16
14
|
#
|
|
17
15
|
# @return [TrueClass]
|
|
18
16
|
def call
|
|
@@ -21,7 +19,7 @@ module Billomat
|
|
|
21
19
|
true
|
|
22
20
|
end
|
|
23
21
|
|
|
24
|
-
# @return [String]
|
|
22
|
+
# @return [String] the cancel path with the invoice_id
|
|
25
23
|
def path
|
|
26
24
|
"/invoices/#{@invoice_id}/cancel"
|
|
27
25
|
end
|