From f1ca00a6a0c4493b5c4de9177934725343205a92 Mon Sep 17 00:00:00 2001 From: Ananthu Date: Thu, 15 Apr 2021 16:01:04 +0530 Subject: [PATCH 1/7] feat: update based on template --- .github/workflows/gem-workflow.yaml | 67 +++++++++++++++++++++++++++++ lib/ledger_sync/stripe/version.rb | 12 +++--- spec/version_spec.rb | 15 +++++-- 3 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/gem-workflow.yaml diff --git a/.github/workflows/gem-workflow.yaml b/.github/workflows/gem-workflow.yaml new file mode 100644 index 0000000..c8e9ff8 --- /dev/null +++ b/.github/workflows/gem-workflow.yaml @@ -0,0 +1,67 @@ +name: Test and Deploy +on: + push: + pull_request: + release: + types: [created] +jobs: + rubocop: + strategy: + matrix: + ruby-version: [2.6.3, 2.6.6, 2.7.1] + runs-on: [ubuntu-latest] + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + fetch-depth: 0 + - name: Ruby Setup and Bundle + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + - run: bundle exec rubocop + rspec: + strategy: + matrix: + ruby-version: [2.6.3, 2.6.6, 2.7.1] + runs-on: [ubuntu-latest] + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + fetch-depth: 0 + - name: Ruby Setup and Bundle + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + - name: rspec and report to coveralls + env: + COVERALLS_REPO_TOKEN: ${{ github.event_name == 'push' && secrets.COVERALLS_REPO_TOKEN }} + run: bundle exec rspec --order rand + publish: + runs-on: ubuntu-latest + needs: ['rubocop', 'rspec'] + if: github.event_name == 'release' && github.event.action == 'created' + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + persist-credentials: false + fetch-depth: 0 + - name: Ruby Setup and Bundle + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.1 + bundler-cache: true + - name: Publish to RubyGems + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials + gem build *.gemspec + gem push *.gem + env: + GEM_HOST_API_KEY: "${{ secrets.RUBY_GEM_KEY }}" diff --git a/lib/ledger_sync/stripe/version.rb b/lib/ledger_sync/stripe/version.rb index 8330274..861a140 100644 --- a/lib/ledger_sync/stripe/version.rb +++ b/lib/ledger_sync/stripe/version.rb @@ -3,15 +3,13 @@ # :nocov: module LedgerSync module Stripe - VERSION = '0.1.0' + VERSION = '0.1.1' - def self.version(args = {}) - pre = args.fetch(:pre, false) - - if !pre && (!ENV['TRAVIS'] || ENV.fetch('TRAVIS_TAG', '') != '') - VERSION + def self.version + if ENV['PRE_RELEASE'] + "#{VERSION}.pre.#{ENV['GITHUB_RUN_NUMBER']}" else - "#{VERSION}.pre.#{ENV['TRAVIS_BUILD_NUMBER']}" + VERSION end end end diff --git a/spec/version_spec.rb b/spec/version_spec.rb index 3e3a074..56c7ea1 100644 --- a/spec/version_spec.rb +++ b/spec/version_spec.rb @@ -2,7 +2,16 @@ require 'spec_helper' -RSpec.describe LedgerSync::Stripe do - it { expect(described_class).to respond_to(:version) } - it { expect(described_class.version(pre: true)).to include('.pre.') } +module LedgerSync + RSpec.describe Stripe do + it 'has a version number' do + expect(described_class).to respond_to(:version) + end + + it 'has a version number in pre release' do + ClimateControl.modify PRE_RELEASE: 'true' do + expect(described_class.version).to include('pre') + end + end + end end From 89e5826d0335d248e943cb16612c8ef71967860a Mon Sep 17 00:00:00 2001 From: Ananthu Date: Sat, 17 Apr 2021 04:34:04 +0530 Subject: [PATCH 2/7] feat: require stripe --- Gemfile.lock | 73 +++++++++++++------------------------- ledger_sync-stripe.gemspec | 1 + lib/ledger_sync/stripe.rb | 1 + 3 files changed, 27 insertions(+), 48 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b59b074..33ef3ae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,12 @@ PATH remote: . specs: - ledger_sync-stripe (0.1.0) + ledger_sync-stripe (0.1.1) dotenv ledger_sync nokogiri oauth2 + stripe GEM remote: https://rubygems.org/ @@ -20,12 +21,8 @@ GEM zeitwerk (~> 2.2, >= 2.2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - akami (1.3.1) - gyoku (>= 0.4.0) - nokogiri ast (2.4.1) awesome_print (1.8.0) - builder (3.2.4) bump (0.9.0) byebug (11.1.3) childprocess (4.0.0) @@ -42,22 +39,20 @@ GEM diff-lcs (1.4.4) docile (1.3.2) dotenv (2.7.6) - dry-configurable (0.11.6) + dry-configurable (0.12.1) concurrent-ruby (~> 1.0) - dry-core (~> 0.4, >= 0.4.7) - dry-equalizer (~> 0.2) + dry-core (~> 0.5, >= 0.5.0) dry-container (0.7.2) concurrent-ruby (~> 1.0) dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.4.9) + dry-core (0.5.0) concurrent-ruby (~> 1.0) dry-equalizer (0.3.0) dry-inflector (0.2.0) dry-initializer (3.0.4) - dry-logic (1.0.8) + dry-logic (1.1.1) concurrent-ruby (~> 1.0) - dry-core (~> 0.2) - dry-equalizer (~> 0.2) + dry-core (~> 0.5, >= 0.5) dry-schema (1.5.6) concurrent-ruby (~> 1.0) dry-configurable (~> 0.8, >= 0.8.3) @@ -66,11 +61,10 @@ GEM dry-initializer (~> 3.0) dry-logic (~> 1.0) dry-types (~> 1.4) - dry-types (1.4.0) + dry-types (1.5.1) concurrent-ruby (~> 1.0) dry-container (~> 0.3) - dry-core (~> 0.4, >= 0.4.4) - dry-equalizer (~> 0.3) + dry-core (~> 0.5, >= 0.5) dry-inflector (~> 0.1, >= 0.1.2) dry-logic (~> 1.0, >= 1.0.2) dry-validation (1.5.6) @@ -82,27 +76,24 @@ GEM dry-schema (~> 1.5, >= 1.5.2) factory_bot (6.1.0) activesupport (>= 5.0.0) - faraday (1.1.0) + faraday (1.3.0) + faraday-net_http (~> 1.0) multipart-post (>= 1.2, < 3) ruby2_keywords faraday-detailed_logger (2.3.0) faraday (>= 0.8, < 2) + faraday-net_http (1.0.1) faraday_middleware (1.0.0) faraday (~> 1.0) fingerprintable (1.2.1) colorize - gyoku (1.3.1) - builder (>= 2.1.2) hashdiff (1.0.1) - httpi (2.4.5) - rack - socksify i18n (1.8.5) concurrent-ruby (~> 1.0) iniparse (1.5.0) json (2.3.1) jwt (2.2.2) - ledger_sync (1.6.0) + ledger_sync (1.8.1) activemodel colorize dry-schema (~> 1.5.4) @@ -111,29 +102,27 @@ GEM faraday-detailed_logger faraday_middleware fingerprintable (>= 1.2.1) - netsuite (~> 0.8.6) nokogiri - oauth2 + openssl (~> 2.2.0) pd_ruby + rack (~> 2.2.3) resonad simply_serializable (>= 1.5.1) - stripe (~> 5.26.0) - mini_portile2 (2.4.0) + mini_portile2 (2.5.0) minitest (5.14.2) multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) - netsuite (0.8.6) - savon (>= 2.3.0, <= 2.11.1) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) - nori (2.6.0) - oauth2 (1.4.4) + nokogiri (1.11.3) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) + oauth2 (1.4.7) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) + openssl (2.2.0) overcommit (0.57.0) childprocess (>= 0.6.3, < 5) iniparse (~> 1.4) @@ -143,11 +132,12 @@ GEM pd_ruby (0.2.3) colorize public_suffix (4.0.6) + racc (1.5.2) rack (2.2.3) rainbow (3.0.0) rake (13.0.1) regexp_parser (1.8.2) - resonad (1.3.0) + resonad (1.4.0) rexml (3.2.4) rspec (3.10.0) rspec-core (~> 3.10.0) @@ -174,15 +164,7 @@ GEM rubocop-ast (1.1.1) parser (>= 2.7.1.5) ruby-progressbar (1.10.1) - ruby2_keywords (0.0.2) - savon (2.11.1) - akami (~> 1.2) - builder (>= 2.1.2) - gyoku (~> 1.2) - httpi (~> 2.3) - nokogiri (>= 1.4.0) - nori (~> 2.4) - wasabi (~> 3.4) + ruby2_keywords (0.0.4) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -190,8 +172,7 @@ GEM simplecov-html (0.10.2) simply_serializable (1.5.1) fingerprintable (>= 1.2.1) - socksify (1.7.1) - stripe (5.26.0) + stripe (5.32.1) sync (0.5.0) term-ansicolor (1.7.1) tins (~> 1.0) @@ -202,10 +183,6 @@ GEM tzinfo (1.2.7) thread_safe (~> 0.1) unicode-display_width (1.7.0) - wasabi (3.6.1) - addressable - httpi (~> 2.0) - nokogiri (>= 1.4.2) webmock (3.9.4) addressable (>= 2.3.6) crack (>= 0.3.2) diff --git a/ledger_sync-stripe.gemspec b/ledger_sync-stripe.gemspec index e92fe2e..0472010 100644 --- a/ledger_sync-stripe.gemspec +++ b/ledger_sync-stripe.gemspec @@ -42,4 +42,5 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency('ledger_sync') spec.add_runtime_dependency('nokogiri', '>= 0') spec.add_runtime_dependency('oauth2', '>= 0') + spec.add_runtime_dependency('stripe', '>= 0') end diff --git a/lib/ledger_sync/stripe.rb b/lib/ledger_sync/stripe.rb index 4704f9b..623f2d9 100644 --- a/lib/ledger_sync/stripe.rb +++ b/lib/ledger_sync/stripe.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'ledger_sync' +require 'stripe' module LedgerSync module Stripe From 6d54de606786fd4e5382736ca043eb42a49d3525 Mon Sep 17 00:00:00 2001 From: Ananthu Date: Sat, 17 Apr 2021 06:13:37 +0530 Subject: [PATCH 3/7] refactor(test): module format --- spec/customer/create_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/customer/create_spec.rb b/spec/customer/create_spec.rb index db92532..2e76c63 100644 --- a/spec/customer/create_spec.rb +++ b/spec/customer/create_spec.rb @@ -4,6 +4,14 @@ support :stripe_shared_examples -RSpec.describe LedgerSync::Stripe::Customer::Operations::Create, operation: true do - it_behaves_like 'a stripe operation' +module LedgerSync + module Stripe + module Customer + module Operations + RSpec.describe Create, operation: true do + it_behaves_like 'a stripe operation' + end + end + end + end end From 4337a401d637d99fcf2a5be331a23c72c8978dd2 Mon Sep 17 00:00:00 2001 From: Ananthu Sudhikumar Date: Mon, 3 May 2021 19:31:06 +0530 Subject: [PATCH 4/7] config(ci): coveralls corrected --- .github/workflows/gem-workflow.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gem-workflow.yaml b/.github/workflows/gem-workflow.yaml index c8e9ff8..9786b6f 100644 --- a/.github/workflows/gem-workflow.yaml +++ b/.github/workflows/gem-workflow.yaml @@ -37,9 +37,13 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - name: rspec and report to coveralls - env: - COVERALLS_REPO_TOKEN: ${{ github.event_name == 'push' && secrets.COVERALLS_REPO_TOKEN }} run: bundle exec rspec --order rand + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel: true + flag-name: run-${{ matrix.ruby-version }} publish: runs-on: ubuntu-latest needs: ['rubocop', 'rspec'] @@ -64,4 +68,4 @@ jobs: gem build *.gemspec gem push *.gem env: - GEM_HOST_API_KEY: "${{ secrets.RUBY_GEM_KEY }}" + GEM_HOST_API_KEY: "${{ secrets.RUBY_GEM_KEY }}" \ No newline at end of file From f6eb6fee33aaa661baf33e5ea56cbca5498b724a Mon Sep 17 00:00:00 2001 From: Ananthu Sudhikumar Date: Mon, 3 May 2021 19:31:22 +0530 Subject: [PATCH 5/7] fix: module corrected --- spec/customer/create_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/customer/create_spec.rb b/spec/customer/create_spec.rb index 2e76c63..2f1775a 100644 --- a/spec/customer/create_spec.rb +++ b/spec/customer/create_spec.rb @@ -6,7 +6,7 @@ module LedgerSync module Stripe - module Customer + class Customer module Operations RSpec.describe Create, operation: true do it_behaves_like 'a stripe operation' From b80c333aecd2c9cc0608b971439a092ef924a9bb Mon Sep 17 00:00:00 2001 From: Ananthu Sudhikumar Date: Mon, 3 May 2021 19:31:36 +0530 Subject: [PATCH 6/7] fix:factorybot name corrected --- spec/qa/customers_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/qa/customers_spec.rb b/spec/qa/customers_spec.rb index 0fb309e..3707611 100644 --- a/spec/qa/customers_spec.rb +++ b/spec/qa/customers_spec.rb @@ -10,7 +10,7 @@ } end let(:resource) do - FactoryBot.create(:customer) + FactoryBot.create(:stripe_customer) end it_behaves_like 'a full stripe resource' From 372ccdba0b914afcf02e43a5d93a622a9a34f90b Mon Sep 17 00:00:00 2001 From: Ananthu Sudhikumar Date: Mon, 3 May 2021 19:32:08 +0530 Subject: [PATCH 7/7] config: lock file updated --- Gemfile.lock | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 33ef3ae..562f956 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,7 +37,7 @@ GEM tins (~> 1.6) crack (0.4.4) diff-lcs (1.4.4) - docile (1.3.2) + docile (1.3.5) dotenv (2.7.6) dry-configurable (0.12.1) concurrent-ruby (~> 1.0) @@ -50,7 +50,7 @@ GEM dry-equalizer (0.3.0) dry-inflector (0.2.0) dry-initializer (3.0.4) - dry-logic (1.1.1) + dry-logic (1.2.0) concurrent-ruby (~> 1.0) dry-core (~> 0.5, >= 0.5) dry-schema (1.5.6) @@ -76,13 +76,17 @@ GEM dry-schema (~> 1.5, >= 1.5.2) factory_bot (6.1.0) activesupport (>= 5.0.0) - faraday (1.3.0) + faraday (1.4.1) + faraday-excon (~> 1.1) faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) multipart-post (>= 1.2, < 3) - ruby2_keywords + ruby2_keywords (>= 0.0.4) faraday-detailed_logger (2.3.0) faraday (>= 0.8, < 2) + faraday-excon (1.1.0) faraday-net_http (1.0.1) + faraday-net_http_persistent (1.1.0) faraday_middleware (1.0.0) faraday (~> 1.0) fingerprintable (1.2.1) @@ -91,9 +95,9 @@ GEM i18n (1.8.5) concurrent-ruby (~> 1.0) iniparse (1.5.0) - json (2.3.1) - jwt (2.2.2) - ledger_sync (1.8.1) + json (2.5.1) + jwt (2.2.3) + ledger_sync (2.0.0) activemodel colorize dry-schema (~> 1.5.4) @@ -108,7 +112,7 @@ GEM rack (~> 2.2.3) resonad simply_serializable (>= 1.5.1) - mini_portile2 (2.5.0) + mini_portile2 (2.5.1) minitest (5.14.2) multi_json (1.15.0) multi_xml (0.6.0) @@ -176,9 +180,9 @@ GEM sync (0.5.0) term-ansicolor (1.7.1) tins (~> 1.0) - thor (1.0.1) + thor (1.1.0) thread_safe (0.3.6) - tins (1.26.0) + tins (1.28.0) sync tzinfo (1.2.7) thread_safe (~> 0.1)