ruby-stream-api 0.0.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 +7 -0
- data/.github/FUNDING.yml +2 -0
- data/.gitignore +59 -0
- data/.rultor.yml +20 -0
- data/.travis.yml +14 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +34 -0
- data/LICENSE +29 -0
- data/README.md +45 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/fromarray.rb +90 -0
- data/lib/stream.rb +50 -0
- data/lib/version.rb +27 -0
- data/rcfg/rubygems.yml.asc +16 -0
- data/release.sh +37 -0
- data/ruby-stream-api.gemspec +28 -0
- metadata +63 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2af76353a382e0c4bc314ff0812d0369c03e34321e2d200b056c38f794df5d2d
|
4
|
+
data.tar.gz: ce869c2f9b0e1ca159ac4334f81c74598bd7c0dc96b3dd9c5eb7942d24f524c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a06201f56931982cc9b7d53189cf426ab9b410f96102985d9aefaacd7a12f880158bfd93bfa6d18c57d0f9caab3cccfc74a3bcf86bfbb00ea08cd282dccc64d2
|
7
|
+
data.tar.gz: 3b53ab001a35f9d9f33584ac7a4d5663b554a48e196fff4ede0452ba58adb9e6f59ca684f84d8568cf14b3a1643b1a8c9c44821addbb7df1997e810c44f748f8
|
data/.github/FUNDING.yml
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
rubygems.yml
|
2
|
+
.idea/*
|
3
|
+
.DS_Store
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/spec/examples.txt
|
12
|
+
/test/tmp/
|
13
|
+
/test/version_tmp/
|
14
|
+
/tmp/
|
15
|
+
|
16
|
+
# Used by dotenv library to load environment variables.
|
17
|
+
# .env
|
18
|
+
|
19
|
+
# Ignore Byebug command history file.
|
20
|
+
.byebug_history
|
21
|
+
|
22
|
+
## Specific to RubyMotion:
|
23
|
+
.dat*
|
24
|
+
.repl_history
|
25
|
+
build/
|
26
|
+
*.bridgesupport
|
27
|
+
build-iPhoneOS/
|
28
|
+
build-iPhoneSimulator/
|
29
|
+
|
30
|
+
## Specific to RubyMotion (use of CocoaPods):
|
31
|
+
#
|
32
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
33
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
34
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
35
|
+
#
|
36
|
+
# vendor/Pods/
|
37
|
+
|
38
|
+
## Documentation cache and generated files:
|
39
|
+
/.yardoc/
|
40
|
+
/_yardoc/
|
41
|
+
/doc/
|
42
|
+
/rdoc/
|
43
|
+
|
44
|
+
## Environment normalization:
|
45
|
+
/.bundle/
|
46
|
+
/vendor/bundle
|
47
|
+
/lib/bundler/man/
|
48
|
+
|
49
|
+
# for a library or gem, you might want to ignore these files since the code is
|
50
|
+
# intended to run in multiple environments; otherwise, check them in:
|
51
|
+
# Gemfile.lock
|
52
|
+
# .stream-version
|
53
|
+
# .stream-gemset
|
54
|
+
|
55
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
56
|
+
.rvmrc
|
57
|
+
|
58
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
59
|
+
# .rubocop-https?--*
|
data/.rultor.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
architect:
|
2
|
+
- amihaiemil
|
3
|
+
- andronachev
|
4
|
+
install: |
|
5
|
+
export GEM_HOME=~/.ruby
|
6
|
+
export GEM_PATH=$GEM_HOME:$GEM_PATH
|
7
|
+
bundle install
|
8
|
+
merge:
|
9
|
+
script: |-
|
10
|
+
bundle exec rake
|
11
|
+
deploy:
|
12
|
+
script: |-
|
13
|
+
echo 'Nothing to deploy yet'
|
14
|
+
exit -1
|
15
|
+
decrypt:
|
16
|
+
rubygems.yml: "repo/rcfg/rubygems.yml.asc"
|
17
|
+
release:
|
18
|
+
script: |-
|
19
|
+
chmod +x ./release.sh
|
20
|
+
./release.sh
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ruby-stream-api (0.0.1.pre.SNAPSHOT)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
codecov (0.1.14)
|
10
|
+
json
|
11
|
+
simplecov
|
12
|
+
url
|
13
|
+
docile (1.3.2)
|
14
|
+
json (2.3.0)
|
15
|
+
minitest (5.14.0)
|
16
|
+
rake (12.3.3)
|
17
|
+
simplecov (0.18.5)
|
18
|
+
docile (~> 1.1)
|
19
|
+
simplecov-html (~> 0.11)
|
20
|
+
simplecov-html (0.12.2)
|
21
|
+
url (0.3.2)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
codecov
|
28
|
+
minitest (~> 5.0)
|
29
|
+
rake (~> 12.3.3)
|
30
|
+
ruby-stream-api!
|
31
|
+
simplecov
|
32
|
+
|
33
|
+
BUNDLED WITH
|
34
|
+
2.1.4
|
data/LICENSE
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
BSD 3-Clause License
|
2
|
+
|
3
|
+
Copyright (c) 2020, Ruby Enterprise Edition
|
4
|
+
All rights reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
8
|
+
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
10
|
+
list of conditions and the following disclaimer.
|
11
|
+
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
14
|
+
and/or other materials provided with the distribution.
|
15
|
+
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
17
|
+
contributors may be used to endorse or promote products derived from
|
18
|
+
this software without specific prior written permission.
|
19
|
+
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Ruby Stream API
|
2
|
+
|
3
|
+
[](https://travis-ci.org/ruby-ee/ruby-stream-api)
|
4
|
+
[](https://codecov.io/github/ruby-ee/ruby-stream-api?branch=master)
|
5
|
+
|
6
|
+
[](http://www.rultor.com/p/ruby-ee/ruby-stream-api)
|
7
|
+
[](https://www.jetbrains.com/ruby/)
|
8
|
+
|
9
|
+
A Stream is a wrapper over a collection of elements offering a number of useful
|
10
|
+
operations to modify and/or get information about the collection. The operations are chainable and can be categorized as follows:
|
11
|
+
|
12
|
+
* **Source** operations -- these are the operations which are generating the Stream.
|
13
|
+
* **Intermediate** operations (skip, filter, map etc) -- operations which are altering the Stream and still leave it open for further modifications.
|
14
|
+
* **Terminal** operations (count, collect etc) -- operations which are executed after all the modifications have been done and are returning a finite result.
|
15
|
+
|
16
|
+
First glance (finite Stream from an array):
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
array = [1, 2, 2, 2, 3, 3, 4, 5]
|
20
|
+
stream = Stream::FromArray(array)
|
21
|
+
collected = stream
|
22
|
+
.distinct()
|
23
|
+
.skip(2)
|
24
|
+
.collect
|
25
|
+
puts collected # [3, 4, 5]
|
26
|
+
```
|
27
|
+
|
28
|
+
More info and examples soon.
|
29
|
+
|
30
|
+
## Not a Mixin
|
31
|
+
|
32
|
+
This is **not** a Mixin! The Stream is a proper object wrapping your collection(s). Furthermore, each object in this gem is immutable and therefore thread-safe -> the **intermediate** operations are not altering the instance on which they are called; instead, they create a new instance of the Stream with a modified version of the underlying collection.
|
33
|
+
|
34
|
+
## Contribute
|
35
|
+
|
36
|
+
If you would like to contribute, just open an Issue (bugs, feature requests, any improvement idea) or a PR.
|
37
|
+
|
38
|
+
In order to build the project, you need Bundler and Ruby >= 2.3.0.
|
39
|
+
|
40
|
+
Make sure the build passes:
|
41
|
+
|
42
|
+
```shell
|
43
|
+
$bundle install
|
44
|
+
$bundle exec rake
|
45
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env stream
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "stream"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/fromarray.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# BSD 3-Clause License
|
2
|
+
# Copyright (c) 2020, Ruby Enterprise Edition
|
3
|
+
# All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
# 1. Redistributions of source code must retain the above copyright notice, this
|
7
|
+
# list of conditions and the following disclaimer.
|
8
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer in the documentation
|
10
|
+
# and/or other materials provided with the distribution.
|
11
|
+
# 3. Neither the name of the copyright holder nor the names of its
|
12
|
+
# contributors may be used to endorse or promote products derived from
|
13
|
+
# this software without specific prior written permission.
|
14
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
15
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
16
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
17
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
18
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
19
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
20
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
21
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
22
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
23
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
|
+
|
25
|
+
module Stream
|
26
|
+
# A stream implemented based on an Array.
|
27
|
+
# This class is immutable and thread-safe.
|
28
|
+
# Author:: Mihai Andronache (amihaiemil@gmail.com)
|
29
|
+
class FromArray
|
30
|
+
def initialize(array)
|
31
|
+
@array = array
|
32
|
+
end
|
33
|
+
|
34
|
+
# Return the number of elements in this stream.
|
35
|
+
def count
|
36
|
+
@array.length
|
37
|
+
end
|
38
|
+
|
39
|
+
# Filter out the elements which are not satisfying the given condition.
|
40
|
+
# Example:
|
41
|
+
#
|
42
|
+
# stream = Stream::FromArray.new([1, 2, 3, 4, 5])
|
43
|
+
# collected = stream.filter {|num| num % 2 == 0}.collect
|
44
|
+
# puts collected # [2, 4]
|
45
|
+
#
|
46
|
+
# +condition+:: Ruby Block taking one parameter (the stream element) and
|
47
|
+
# returning a boolean check on it.
|
48
|
+
def filter(&condition)
|
49
|
+
filtered = []
|
50
|
+
@array.each do |val|
|
51
|
+
filtered.push(val) unless condition.call(val) == false
|
52
|
+
end
|
53
|
+
FromArray.new(filtered)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Map the stream's elements to a given value using a function.
|
57
|
+
# Example (map int to string):
|
58
|
+
#
|
59
|
+
# stream = Stream::FromArray.new([1, 2, 3])
|
60
|
+
# collected = stream.map {|num| num.to_s}.collect
|
61
|
+
# puts collected # ['1', '2', '3']
|
62
|
+
#
|
63
|
+
# +function+:: Ruby Block function taking one parameter
|
64
|
+
# (the element in the stream).
|
65
|
+
def map(&function)
|
66
|
+
mapped = []
|
67
|
+
@array.each do |val|
|
68
|
+
mapped.push(function.call(val))
|
69
|
+
end
|
70
|
+
FromArray.new(mapped)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Skip the first n elements of the stream.
|
74
|
+
# +count+:: Number of elements to skip from the beginning of the stream.
|
75
|
+
def skip(count)
|
76
|
+
raise ArgumentError, 'count has to be positive integer' unless count.positive? and count.is_a? Integer
|
77
|
+
|
78
|
+
skipped = []
|
79
|
+
@array.each_with_index do |val, index|
|
80
|
+
skipped.push(val) unless index + 1 <= count
|
81
|
+
end
|
82
|
+
FromArray.new(skipped)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Collect the stream's data into an array and return it.
|
86
|
+
def collect
|
87
|
+
@array.dup
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/lib/stream.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# BSD 3-Clause License
|
2
|
+
# Copyright (c) 2020, Ruby Enterprise Edition
|
3
|
+
# All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
# 1. Redistributions of source code must retain the above copyright notice, this
|
7
|
+
# list of conditions and the following disclaimer.
|
8
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer in the documentation
|
10
|
+
# and/or other materials provided with the distribution.
|
11
|
+
# 3. Neither the name of the copyright holder nor the names of its
|
12
|
+
# contributors may be used to endorse or promote products derived from
|
13
|
+
# this software without specific prior written permission.
|
14
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
15
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
16
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
17
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
18
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
19
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
20
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
21
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
22
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
23
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
|
+
|
25
|
+
require 'fromarray.rb'
|
26
|
+
|
27
|
+
# Ruby Stream API main module.
|
28
|
+
# Author:: Mihai Andronache (amihaiemil@gmail.com)
|
29
|
+
module Stream
|
30
|
+
|
31
|
+
# If it breaks, go to stderr
|
32
|
+
class Error < StandardError
|
33
|
+
end
|
34
|
+
|
35
|
+
# Build a stream from an array.
|
36
|
+
def self.from_array(array)
|
37
|
+
FromArray.new(array)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Generate a Stream based on a seed function.
|
41
|
+
# Since this would be an infinite Stream, a limit has to be applied.
|
42
|
+
# If no limit is specified, the default is 100 elements.
|
43
|
+
def self.generate(limit = 100, &seed)
|
44
|
+
raise ArgumentError, 'limit has to be a positive integer' unless limit.positive? and limit.is_a? Integer
|
45
|
+
|
46
|
+
elements = []
|
47
|
+
limit.times { elements.push(seed.call) }
|
48
|
+
FromArray.new(elements)
|
49
|
+
end
|
50
|
+
end
|
data/lib/version.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# BSD 3-Clause License
|
2
|
+
# Copyright (c) 2020, Ruby Enterprise Edition
|
3
|
+
# All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
# 1. Redistributions of source code must retain the above copyright notice, this
|
7
|
+
# list of conditions and the following disclaimer.
|
8
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer in the documentation
|
10
|
+
# and/or other materials provided with the distribution.
|
11
|
+
# 3. Neither the name of the copyright holder nor the names of its
|
12
|
+
# contributors may be used to endorse or promote products derived from
|
13
|
+
# this software without specific prior written permission.
|
14
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
15
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
16
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
17
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
18
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
19
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
20
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
21
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
22
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
23
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
|
+
|
25
|
+
module Stream
|
26
|
+
VERSION = '0.0.1'.freeze # rultor
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
-----BEGIN PGP MESSAGE-----
|
2
|
+
|
3
|
+
hQEMA5qETcGag5w6AQf+NeUGuqLOXx3q0+CUyTnjLwRG6eqlMGzTSYLpTRPbjAS+
|
4
|
+
xNForun5aXHN1fUEHwrca8Ny2Blf+NcpNG+EL1dv5dOhkc0Ljbeq7oS84c0JpXYa
|
5
|
+
h/e1SC3s1U/7vkJuPoTrTvBF+vqGil75FrSlrPWLVrJ/m3d3ICYYCQSlpsdzHMXz
|
6
|
+
SPiTBZ4BCTE9AmadFCxD9HAS65mzPUbEiS1iMkQsmGFL8LRccgwXkccRSXst+Tjz
|
7
|
+
L3au3+DYkFHIOReULORXzwn2dRy9aNEtQtmsatZcqjisqG9EHraFKff6dFzSenpD
|
8
|
+
mEdlohBYqBObtUR2Rwpm9yTlLzfpZp9wurF5qurGSNLAWAFv1T1P2gjrG+pwvK0C
|
9
|
+
vdg6UArcypUC0m9PHIl1VtugAxzFfRMLMAh1S1o0LqdkWscWAYY/zZvOBY10jT1H
|
10
|
+
PcuFSuzfJP8gK89aAjTZCgRW2lI0DS3tLzt4dfV+CmcOXwAaPAQpK+HVfgsvVjSB
|
11
|
+
OI4+7lcDPCZxUadtlm97h9i03I8X5OuG2O1fVty1+2FNHda+/MeVp4EWP4xiSaBj
|
12
|
+
1tgSQT+Dv3VDehjd+7bxugQw4vS5nPOCo4sq5MM7eUr1FVJ+nVwDs1VsEJhstTGl
|
13
|
+
WQQu8avfq0txvIfMus8YWGIHi90zvBlpynlrbhKZuJVlhwCOAmhE2hm1WHt7VYIr
|
14
|
+
cTQ3vbrmplHLQeJztGR9o9UlGd/bD6K5l4g=
|
15
|
+
=tPM8
|
16
|
+
-----END PGP MESSAGE-----
|
data/release.sh
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# Release script to be run by Rultor.
|
3
|
+
|
4
|
+
set -e
|
5
|
+
set -o pipefail
|
6
|
+
|
7
|
+
CURRENT_VERSION=$(grep -o '[0-9]*\.[0-9]*\.[0-9]*-SNAPSHOT' -m 1 ./lib/version.rb)
|
8
|
+
|
9
|
+
NUMBERS=($(echo $tag | grep -o -E '[0-9]+'))
|
10
|
+
|
11
|
+
echo "CURRENT VERSION IS"
|
12
|
+
echo $CURRENT_VERSION
|
13
|
+
|
14
|
+
NEXT_VERSION=${NUMBERS[0]}'.'${NUMBERS[1]}'.'$((${NUMBERS[2]}+1))'-SNAPSHOT'
|
15
|
+
|
16
|
+
echo "RELEASE VERSION IS"
|
17
|
+
echo $tag
|
18
|
+
|
19
|
+
echo "NEXT VERSION IS"
|
20
|
+
echo $NEXT_VERSION
|
21
|
+
|
22
|
+
### Actual Script Here
|
23
|
+
rm -rf *.gem
|
24
|
+
sed -i "s/'${CURRENT_VERSION}'.freeze # rultor/'${tag}'.freeze # rultor/" ./lib/version.rb
|
25
|
+
gem build ruby-stream-api.gemspec
|
26
|
+
chmod 0600 /home/r/rubygems.yml
|
27
|
+
gem push *.gem --config-file /home/r/rubygems.yml
|
28
|
+
###
|
29
|
+
|
30
|
+
# set next dev version in version.rb
|
31
|
+
sed -i "s/'${tag}'.freeze # rultor/'${NEXT_VERSION}'.freeze # rultor/" ./lib/version.rb
|
32
|
+
|
33
|
+
git commit -am "${NEXT_VERSION}"
|
34
|
+
git checkout master
|
35
|
+
git merge __rultor
|
36
|
+
git checkout __rultor
|
37
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'lib/version.rb'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "ruby-stream-api"
|
5
|
+
spec.version = Stream::VERSION
|
6
|
+
spec.authors = ["amihaiemil"]
|
7
|
+
spec.email = ["amihaiemil@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = "Ruby Stream API"
|
10
|
+
spec.description = "Stream API for Ruby, inspired by Java 8's Stream API"
|
11
|
+
spec.homepage = "https://github.com/ruby-ee/ruby-stream-api"
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
|
+
|
14
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/ruby-ee/ruby-stream-api"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/ruby-ee/ruby-stream-api"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby-stream-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- amihaiemil
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-01 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Stream API for Ruby, inspired by Java 8's Stream API
|
14
|
+
email:
|
15
|
+
- amihaiemil@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".github/FUNDING.yml"
|
21
|
+
- ".gitignore"
|
22
|
+
- ".rultor.yml"
|
23
|
+
- ".travis.yml"
|
24
|
+
- Gemfile
|
25
|
+
- Gemfile.lock
|
26
|
+
- LICENSE
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- bin/console
|
30
|
+
- bin/setup
|
31
|
+
- lib/fromarray.rb
|
32
|
+
- lib/stream.rb
|
33
|
+
- lib/version.rb
|
34
|
+
- rcfg/rubygems.yml.asc
|
35
|
+
- release.sh
|
36
|
+
- ruby-stream-api.gemspec
|
37
|
+
homepage: https://github.com/ruby-ee/ruby-stream-api
|
38
|
+
licenses: []
|
39
|
+
metadata:
|
40
|
+
allowed_push_host: https://rubygems.org/
|
41
|
+
homepage_uri: https://github.com/ruby-ee/ruby-stream-api
|
42
|
+
source_code_uri: https://github.com/ruby-ee/ruby-stream-api
|
43
|
+
changelog_uri: https://github.com/ruby-ee/ruby-stream-api
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.3.0
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubygems_version: 3.0.1
|
60
|
+
signing_key:
|
61
|
+
specification_version: 4
|
62
|
+
summary: Ruby Stream API
|
63
|
+
test_files: []
|