Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
env:
RUBY_VERSION: 2.7.1
ENABLE_CODE_COVERAGE: 1

name: build-test
on: push
jobs:
rubocop-test:
name: Rubocop
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
- name: Install rubocop
run: gem install rubocop
- name: Check code
run: rubocop
rspec-test:
name: RSpec
needs: rubocop-test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
- name: Install dependencies
run: |
gem install bundler
bundler install
- name: Run tests
run: bundler exec rspec
- name: Upload resultset artifact
uses: actions/upload-artifact@master
if: always()
with:
name: coverage-report
path: coverage
upload-codecov:
name: Codecov
needs: rspec-test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Download resultset artifact
uses: actions/download-artifact@v1
with:
name: coverage-report
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage-report/.resultset.json
6 changes: 0 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,3 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in aspire_budget.gemspec
gemspec

group :test, :development do
gem 'pry'
gem 'rspec', '~> 3.0'
gem 'rubocop'
end
25 changes: 18 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ GEM
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.1)
codecov (0.1.19)
colorize
json
simplecov
coderay (1.1.3)
colorize (0.8.1)
declarative (0.0.10)
declarative-option (0.1.0)
diff-lcs (1.4.1)
docile (1.3.2)
faraday (1.0.1)
multipart-post (>= 1.2, < 3)
google-api-client (0.41.0)
Expand All @@ -36,6 +42,7 @@ GEM
os (>= 0.9, < 2.0)
signet (~> 0.14)
httpclient (2.8.3)
json (2.3.1)
jwt (2.2.1)
memoist (0.16.2)
method_source (1.0.0)
Expand All @@ -54,7 +61,6 @@ GEM
method_source (~> 1.0)
public_suffix (4.0.5)
rainbow (3.0.0)
rake (12.3.3)
regexp_parser (1.7.1)
representable (3.0.4)
declarative (< 0.1.0)
Expand All @@ -75,23 +81,27 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
rubocop (0.86.0)
rubocop (0.87.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.0.3, < 1.0)
rubocop-ast (>= 0.1.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.0.3)
rubocop-ast (0.1.0)
parser (>= 2.7.0.1)
ruby-progressbar (1.10.1)
signet (0.14.0)
addressable (~> 2.3)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simplecov (0.18.5)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov-html (0.12.2)
uber (0.1.0)
unicode-display_width (1.7.0)

Expand All @@ -100,10 +110,11 @@ PLATFORMS

DEPENDENCIES
aspire_budget!
codecov
pry
rake (~> 12.0)
rspec (~> 3.0)
rubocop
rubocop (~> 0.87.1)
simplecov

BUNDLED WITH
2.1.4
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2# Aspire Budget - Ruby
# Aspire Budget - Ruby

This is an independent project implementing a Ruby for Aspire Budgeting spreadsheets, leveraging from the use of another great gem: `google_drive`.
The idea of this gem is to enable a good API to be easily implemented, allowing more powerful and complex tools to emerge.
Expand Down
5 changes: 5 additions & 0 deletions aspire_budget.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']

spec.add_runtime_dependency 'google_drive', '~> 3.0'

spec.add_development_dependency 'pry'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rubocop', '~> 0.87.1'
spec.add_development_dependency 'simplecov'
end
3 changes: 1 addition & 2 deletions lib/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ def self.configuration
end

class Configuration
attr_writer :session
attr_writer :spreadsheet_key
attr_writer :session, :spreadsheet_key

def session
@session || raise('Please set session')
Expand Down
2 changes: 2 additions & 0 deletions lib/models/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def self.from_row(header, row)
new(**params)
end

# rubocop:disable Metrics/ParameterLists
def initialize(date:, outflow:, inflow:, category:, account:, memo:, status:)
@date = Utils.parse_date(date) || Date.today
@outflow = outflow || 0.0
Expand All @@ -29,6 +30,7 @@ def initialize(date:, outflow:, inflow:, category:, account:, memo:, status:)
@memo = memo
@status = status
end
# rubocop:enable Metrics/ParameterLists

def to_row(header)
header.map do |h|
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def parse_currency(value)
end

def serialize_currency(value)
format('%.2f', value)
format('%<value>.2f', value: value)
end

def parse_status(value)
Expand Down
Empty file added report-codecov-error
Empty file.
5 changes: 5 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
require 'bundler/setup'
Bundler.require(:test)

if ENV['ENABLE_CODE_COVERAGE']
require 'simplecov'
SimpleCov.start
end

require 'support/google_drive_mock'

RSpec.configure do |config|
Expand Down