dry-effects 0.1.3 → 0.1.4

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: 06b5f9b8d829b3fc846dfe06e838492c4022a164406a3371039e0d258206bb10
4
- data.tar.gz: 3963e477f1036e4b3657a1cf2ba1ebad879334069c152910e365541b2cd9a809
3
+ metadata.gz: 8b0de29697072219c4159b2d7eb371b04ee20ae17895cd06158ea4d7bc29bf1e
4
+ data.tar.gz: 0021bd3593b13b70da9780acc2b66f11f32b2bf61a7878f5b88ca7e168590b08
5
5
  SHA512:
6
- metadata.gz: 8d1259fe383b29301b2beb6b5b08af66d0161abeb4bc6c3884885b4860c3fbda38b1c6cb95c61f08780d40aacd6be3be4d96553ac694735021ed612f62823f77
7
- data.tar.gz: 1466e9485f008b74d4c4a00f9d2dd2fa5f241bc31c569dd871b1aec73dcc12aee072f71530a01f54c1a55c9578ff350d84ee12420216125ef0329b2ed3cd42ec
6
+ metadata.gz: 9900386d6f4ca0d157d4514f15c4229ed611540186be2f821b0cc80c909fcc838c9a91806c369b4d21d300a6b9ecaccc62adfa0b16458a5732a7d477fa59efca
7
+ data.tar.gz: 9c4ebd87d7b929941b43699dbd466e282e7636b7c06c064088a2203461febd81396bf749863eda6829034c1b579702a59637bee4a750464f28cb8efd3cf3cbd1
@@ -8,67 +8,45 @@ on:
8
8
  - .github/workflows/ci.yml
9
9
  - lib/**
10
10
  - spec/**
11
+ - Rakefile
11
12
  - Gemfile
13
+ - Gemfile.devtools
12
14
  - "*.gemspec"
15
+ - ".rubocop.yml"
16
+ pull_request:
17
+ branches:
18
+ - master
13
19
 
14
20
  jobs:
15
- tests-mri:
21
+ tests:
16
22
  runs-on: ubuntu-latest
17
23
  strategy:
18
24
  fail-fast: false
19
25
  matrix:
20
- ruby: ["2.6.x", "2.5.x", "2.4.x"]
26
+ ruby:
27
+ - "2.7"
28
+ - "2.6"
29
+ - "2.5"
30
+ - "2.4"
31
+ - "jruby"
21
32
  include:
22
- - ruby: "2.6.x"
33
+ - ruby: "2.6"
23
34
  coverage: "true"
24
35
  steps:
25
36
  - uses: actions/checkout@v1
26
37
  - name: Set up Ruby
27
- uses: actions/setup-ruby@v1
38
+ uses: eregon/use-ruby-action@master
28
39
  with:
29
40
  ruby-version: ${{matrix.ruby}}
30
- - name: Download test reporter
31
- if: "matrix.coverage == 'true'"
41
+ - name: Install latest bundler
32
42
  run: |
33
- mkdir -p tmp/
34
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
35
- chmod +x ./tmp/cc-test-reporter
36
- ./tmp/cc-test-reporter before-build
43
+ gem install bundler
44
+ bundle config set without 'tools benchmarks docs'
45
+ - name: Bundle install
46
+ run: bundle install --jobs 4 --retry 3
37
47
  - name: Run all tests
38
48
  env:
39
49
  COVERAGE: ${{matrix.coverage}}
40
- run: |
41
- gem install bundler
42
- bundle install --jobs 4 --retry 3 --without tools docs benchmarks
43
- bundle exec rake
44
- - name: Send coverage results
45
- if: "matrix.coverage == 'true'"
46
- env:
47
- CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
48
- GIT_COMMIT_SHA: ${{github.sha}}
49
- GIT_BRANCH: ${{github.ref}}
50
- GIT_COMMITTED_AT: ${{github.event.head_commit.timestamp}}
51
- run: |
52
- GIT_BRANCH=`ruby -e "puts ENV['GITHUB_REF'].split('/', 3).last"` \
53
- GIT_COMMITTED_AT=`ruby -r time -e "puts Time.iso8601(ENV['GIT_COMMITTED_AT']).to_i"` \
54
- ./tmp/cc-test-reporter after-build
55
-
56
- tests-others:
57
- runs-on: ubuntu-latest
58
- strategy:
59
- fail-fast: false
60
- matrix:
61
- image: ["jruby:9.2.8", "ruby:rc"]
62
- container:
63
- image: ${{matrix.image}}
64
- steps:
65
- - uses: actions/checkout@v1
66
- - name: Install git
67
- run: |
68
- apt-get update
69
- apt-get install -y --no-install-recommends git
70
- - name: Run all tests
71
- run: |
72
- gem install bundler
73
- bundle install --jobs 4 --retry 3 --without tools docs benchmarks
74
- bundle exec rspec
50
+ CODACY_RUN_LOCAL: true
51
+ CODACY_PROJECT_TOKEN: ${{secrets.CODACY_PROJECT_TOKEN}}
52
+ run: bundle exec rake
@@ -11,23 +11,45 @@ jobs:
11
11
  if: github.event.action == 'sync_configs'
12
12
  steps:
13
13
  - uses: actions/checkout@v1
14
- - name: Update configuration files from devtools
14
+ - name: Set up Ruby
15
+ uses: eregon/use-ruby-action@master
16
+ with:
17
+ ruby-version: 2.6
18
+ - name: Install latest bundler
19
+ run: |
20
+ gem install bundler
21
+ bundle config set without 'tools benchmarks docs'
22
+ - name: Install dependencies
23
+ run: bundle install --jobs 4 --retry 3 --without tools test benchmarks docs
24
+ - name: Symlink ossy
25
+ run: ln -sf "$(bundle info ossy --path)/bin/ossy" bin/ossy
26
+ - name: Clone devtools
27
+ run: git clone https://github.com/dry-rb/devtools.git tmp/devtools
28
+ - name: Compile file templates
15
29
  env:
16
30
  GITHUB_LOGIN: dry-bot
17
31
  GITHUB_TOKEN: ${{ secrets.GH_PAT }}
18
32
  run: |
19
- git clone https://github.com/dry-rb/devtools.git tmp/devtools
20
-
33
+ if [ -f "project.yml" ]; then
34
+ for t in `ls tmp/devtools/templates`
35
+ do
36
+ bin/ossy t c tmp/devtools/templates/$t $(basename $t .erb) project.yml
37
+ done
38
+ fi
39
+ - name: Update configuration files from devtools
40
+ run: |
21
41
  if [ -f ".github/workflows/custom_ci.yml" ]; then
22
- rsync -av --exclude '.github/workflows/ci.yml' tmp/devtools/shared/ . ;
42
+ rsync -arv --exclude '.github/workflows/ci.yml' tmp/devtools/shared/ . ;
23
43
  else
24
- rsync -av tmp/devtools/shared/ . ;
44
+ rsync -arv tmp/devtools/shared/ . ;
25
45
  fi
26
-
46
+ - name: Commit changes
47
+ run: |
48
+ rm bin/ossy
27
49
  git config --local user.email "dry-bot@dry-rb.org"
28
50
  git config --local user.name "dry-bot"
29
51
  git add -A
30
- git commit -m "[devtools] config sync" || echo "nothing changed"
52
+ git commit -m "[devtools] sync configs" || echo "nothing changed"
31
53
  - name: Push changes
32
54
  uses: ad-m/github-push-action@master
33
55
  with:
data/.rspec CHANGED
@@ -1,4 +1,4 @@
1
1
  --color
2
2
  --require spec_helper
3
3
  --order random
4
-
4
+ --warnings
data/.rubocop.yml CHANGED
@@ -10,6 +10,9 @@ Style/StringLiterals:
10
10
  Enabled: true
11
11
  EnforcedStyle: single_quotes
12
12
 
13
+ Style/ParallelAssignment:
14
+ Enabled: false
15
+
13
16
  Style/Alias:
14
17
  Enabled: false
15
18
 
@@ -36,17 +39,17 @@ Metrics/LineLength:
36
39
  Max: 100
37
40
 
38
41
  Metrics/MethodLength:
39
- Max: 22
42
+ Enabled: false
40
43
 
41
44
  Metrics/ClassLength:
42
- Max: 150
43
-
44
- Metrics/AbcSize:
45
- Max: 20
45
+ Enabled: false
46
46
 
47
47
  Metrics/BlockLength:
48
48
  Enabled: false
49
49
 
50
+ Metrics/AbcSize:
51
+ Max: 20
52
+
50
53
  Metrics/CyclomaticComplexity:
51
54
  Enabled: true
52
55
  Max: 10
@@ -71,6 +74,9 @@ Lint/HandleExceptions:
71
74
  Exclude:
72
75
  - "spec/spec_helper.rb"
73
76
 
77
+ Naming/PredicateName:
78
+ Enabled: false
79
+
74
80
  Naming/FileName:
75
81
  Exclude:
76
82
  - "lib/dry-*.rb"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # v0.1.4 - 2020-01-07
2
+
3
+ ## Fixed
4
+
5
+ - Some calls of effect builders were updated to prevent keyword warnings on 2.7 (flash-gordon)
6
+
7
+ [Compare v0.1.3...v0.1.4](https://github.com/dry-rb/dry-effects/compare/v0.1.3...v0.1.4)
8
+
1
9
  # v0.1.3 - 2019-12-20
2
10
 
3
11
  ## Added
data/Gemfile CHANGED
@@ -2,21 +2,18 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- git_source(:github) { |repo_name| "https://github.com/dry-rb/#{repo_name}" }
5
+ eval_gemfile 'Gemfile.devtools'
6
6
 
7
7
  gemspec
8
8
 
9
9
  group :test do
10
10
  gem 'dry-auto_inject', require: false
11
- gem 'dry-system', github: 'dry-system', branch: 'master', require: false
12
- gem 'simplecov', require: false, platform: :mri
11
+ gem 'dry-system', github: 'dry-rb/dry-system', branch: 'master', require: false
13
12
  gem 'warning'
14
13
  end
15
14
 
16
15
  group :tools do
17
16
  gem 'pry-byebug', platform: :mri
18
- gem 'rubocop'
19
- gem 'ossy', git: 'https://github.com/solnic/ossy.git', branch: 'master'
20
17
  end
21
18
 
22
19
  gem 'dry-struct'
data/Gemfile.devtools ADDED
@@ -0,0 +1,14 @@
1
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
2
+
3
+ gem "ossy", github: "solnic/ossy", branch: "master", platforms: :ruby
4
+
5
+ group :test do
6
+ gem 'codacy-coverage', require: false, platforms: :ruby
7
+ gem 'simplecov', require: false, platforms: :ruby
8
+ gem 'warning'
9
+ end
10
+
11
+ group :tools do
12
+ # this is the same version that we use on codacy
13
+ gem 'rubocop', '0.71.0'
14
+ end
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2019 dry-rb team
3
+ Copyright (c) 2015-2020 dry-rb team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -1,22 +1,29 @@
1
1
  [gem]: https://rubygems.org/gems/dry-effects
2
- [ci]: https://github.com/dry-rb/dry-effects/actions?query=workflow%3Aci
3
- [codeclimate]: https://codeclimate.com/github/dry-rb/dry-effects/maintainability
4
- [coverage]: https://codeclimate.com/github/dry-rb/dry-effects/test_coverage
2
+ [actions]: https://github.com/dry-rb/dry-effects/actions
3
+ [codacy]: https://www.codacy.com/gh/dry-rb/dry-effects
5
4
  [chat]: https://dry-rb.zulipchat.com
5
+ [inchpages]: http://inch-ci.org/github/dry-rb/dry-effects
6
6
 
7
7
  # dry-effects [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
8
8
 
9
9
  [![Gem Version](https://badge.fury.io/rb/dry-effects.svg)][gem]
10
- [![Build Status](https://github.com/dry-rb/dry-monads/workflows/ci/badge.svg)][ci]
11
- [![Maintainability](https://api.codeclimate.com/v1/badges/83bdab1ec9e1097c2284/maintainability)][codeclimate]
12
- [![Test Coverage](https://api.codeclimate.com/v1/badges/83bdab1ec9e1097c2284/test_coverage)][coverage]
10
+ [![CI Status](https://github.com/dry-rb/dry-effects/workflows/ci/badge.svg)][actions]
11
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/158a8a584a3845eba4a67a71ad540210)][codacy]
12
+ [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/158a8a584a3845eba4a67a71ad540210)][codacy]
13
+ [![Inline docs](http://inch-ci.org/github/dry-rb/dry-effects.svg?branch=master)][inchpages]
13
14
 
14
- ## Development
15
+ ## Links
15
16
 
16
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
17
+ * [User documentation](http://dry-rb.org/gems/dry-effects)
18
+ * [API documentation](http://rubydoc.info/gems/dry-effects)
17
19
 
18
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then 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).
20
+ ## Supported Ruby versions
19
21
 
20
- ## Contributing
22
+ This library officially supports the following Ruby versions:
21
23
 
22
- See CONTRIBUTING.md.
24
+ * MRI >= `2.4`
25
+ * jruby >= `9.2`
26
+
27
+ ## License
28
+
29
+ See `LICENSE` file.
@@ -29,7 +29,7 @@ end
29
29
  ###
30
30
 
31
31
  class CreateSubscription
32
- include Dry::Efefcts.Resolve(:subscription_repo)
32
+ include Dry::Effects.Resolve(:subscription_repo)
33
33
  include Dry::Effects.CurrentTime
34
34
 
35
35
  def call(values)
@@ -27,6 +27,8 @@ Handling timeouts:
27
27
 
28
28
  ```ruby
29
29
  class WithTimeout
30
+ include Dry::Effects::Handler.Timeout(:http)
31
+
30
32
  def initialize(app)
31
33
  @app = app
32
34
  end
@@ -34,7 +34,7 @@ module Dry
34
34
  end
35
35
  end
36
36
 
37
- if ::File.exists?("#{__dir__}/providers/#{key}.rb")
37
+ if ::File.exist?("#{__dir__}/providers/#{key}.rb")
38
38
  providers.register(key, memoize: true) do
39
39
  require "dry/effects/providers/#{key}"
40
40
  Providers.const_get(Inflector.camelize(key))
@@ -19,7 +19,7 @@ module Dry
19
19
  else
20
20
  readers.each do |reader, key|
21
21
  define_method(reader) do
22
- ::Dry::Effects.yield(Read.(key))
22
+ ::Dry::Effects.yield(Read.payload(key))
23
23
  end
24
24
  end
25
25
  end
@@ -15,7 +15,7 @@ module Dry
15
15
 
16
16
  module_eval do
17
17
  define_method(dependency) do |*args|
18
- ::Dry::Effects.yield(lookup.(args[0])).(*args)
18
+ ::Dry::Effects.yield(lookup.payload(args[0])).(*args)
19
19
  end
20
20
  end
21
21
  end
@@ -18,7 +18,7 @@ module Dry
18
18
  if Undefined.equal?(payload)
19
19
  ::Dry::Effects.yield(interrupt)
20
20
  else
21
- ::Dry::Effects.yield(interrupt.(payload))
21
+ ::Dry::Effects.yield(interrupt.payload(payload))
22
22
  end
23
23
  end
24
24
  end
@@ -16,13 +16,13 @@ module Dry
16
16
  define_method(:lock) do |key, meta: Undefined, &block|
17
17
  if block
18
18
  begin
19
- handle = ::Dry::Effects.yield(Lock.(key, meta))
19
+ handle = ::Dry::Effects.yield(Lock.payload(key, meta))
20
20
  block.(!handle.nil?)
21
21
  ensure
22
- ::Dry::Effects.yield(Unlock.(handle)) if handle
22
+ ::Dry::Effects.yield(Unlock.payload(handle)) if handle
23
23
  end
24
24
  else
25
- ::Dry::Effects.yield(Lock.(key, meta))
25
+ ::Dry::Effects.yield(Lock.payload(key, meta))
26
26
  end
27
27
  end
28
28
 
@@ -31,11 +31,11 @@ module Dry
31
31
  end
32
32
 
33
33
  define_method(:locked?) do |key|
34
- ::Dry::Effects.yield(Locked.(key))
34
+ ::Dry::Effects.yield(Locked.payload(key))
35
35
  end
36
36
 
37
37
  define_method(:lock_meta) do |key|
38
- ::Dry::Effects.yield(Meta.(key))
38
+ ::Dry::Effects.yield(Meta.payload(key))
39
39
  end
40
40
  end
41
41
  end
@@ -11,7 +11,7 @@ module Dry
11
11
 
12
12
  def initialize
13
13
  define_method(:par) { |&block| ::Dry::Effects.yield(Par).(&block) }
14
- define_method(:join) { |xs| ::Dry::Effects.yield(Join.(xs)) }
14
+ define_method(:join) { |xs| ::Dry::Effects.yield(Join.payload(xs)) }
15
15
  end
16
16
  end
17
17
  end
@@ -6,11 +6,11 @@ module Dry
6
6
  module Effects
7
7
  module Effects
8
8
  class Random < ::Module
9
- Read = Effect.new(type: :random, name: :rand)
9
+ Rand = Effect.new(type: :random, name: :rand)
10
10
 
11
11
  def initialize
12
12
  module_eval do
13
- define_method(:rand) { |n = nil| ::Dry::Effects.yield(Read.(n)) }
13
+ define_method(:rand) { |n = nil| ::Dry::Effects.yield(Rand.payload(n)) }
14
14
  end
15
15
  end
16
16
  end
@@ -38,6 +38,7 @@ module Dry
38
38
  # @api private
39
39
  def options?
40
40
  return @has_options if defined? @has_options
41
+
41
42
  @has_options = false
42
43
  end
43
44
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Effects
5
- VERSION = '0.1.3'
5
+ VERSION = '0.1.4'
6
6
  end
7
7
  end
data/project.yml ADDED
@@ -0,0 +1,2 @@
1
+ name: dry-effects
2
+ codacy_id: 158a8a584a3845eba4a67a71ad540210
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-effects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikita Shilnikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-20 00:00:00.000000000 Z
11
+ date: 2020-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -181,6 +181,7 @@ files:
181
181
  - CODE_OF_CONDUCT.md
182
182
  - CONTRIBUTING.md
183
183
  - Gemfile
184
+ - Gemfile.devtools
184
185
  - LICENSE
185
186
  - README.md
186
187
  - Rakefile
@@ -258,6 +259,7 @@ files:
258
259
  - lib/dry/effects/providers/timestamp.rb
259
260
  - lib/dry/effects/stack.rb
260
261
  - lib/dry/effects/version.rb
262
+ - project.yml
261
263
  homepage: https://github.com/dry-rb/dry-effects
262
264
  licenses:
263
265
  - MIT
@@ -281,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
283
  - !ruby/object:Gem::Version
282
284
  version: '0'
283
285
  requirements: []
284
- rubygems_version: 3.0.6
286
+ rubygems_version: 3.1.2
285
287
  signing_key:
286
288
  specification_version: 4
287
289
  summary: Algebraic effects.