rubysketch 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0df24de4fc3eabd1c7880d51ff34ef8389b44bef43a8159c75e9e6c651953c0d
4
- data.tar.gz: cf03a57e9ecbf8a63f0b089c4588c0cd041ef93e2b92c69a580b8aa1f013659e
3
+ metadata.gz: 1a40d65c055cc2baacd0a7489ec511a0db37b8e534f58fc02d5c095f78ecca66
4
+ data.tar.gz: 9c8634c610e0df8201655809b82bc8e7dbc2adab8cad405e2033ecc321c09137
5
5
  SHA512:
6
- metadata.gz: 953e09a5b8da7f8798186e3f0a4e4b9ca636a5c7a34cdd1eca26da30f09221ac31fe3c5ed9ebc8e498060f84b88de4bb14738ef8054e30544c38ca664522f050
7
- data.tar.gz: 4c4ae42689cfda821c84617c2925fc48b6af3ad3672d8dd1c603b999427762b5439cbf7c879a06fdf8830f83632d5e01bd9197d1cf528f6ae948a38728063a2a
6
+ metadata.gz: 04d5e9096e7cef9ea5d6c16e3397d5965bc8da07f699fc3b241e91ad982c755fe7b4faf4296b6ce74612da690cc7d7cfd507612387f43276b0e2ab0d05566ddf
7
+ data.tar.gz: 224f32277392e5b84c84b6ef13a437813859f960e47dce696f97dd547273d0d86a3e62685a171a7055981989fd99679e60b843e12b839bc2b501c4e9fbb7e622
@@ -0,0 +1,62 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ['v[0-9]*']
6
+
7
+ jobs:
8
+ release:
9
+ runs-on: macos-latest
10
+
11
+ steps:
12
+ - name: checkout
13
+ uses: actions/checkout@v2
14
+
15
+ - name: ruby 2.6
16
+ uses: actions/setup-ruby@v1
17
+ with:
18
+ ruby-version: 2.6.x
19
+
20
+ - name: install gems
21
+ run: |
22
+ gem install bundler
23
+ bundle install --jobs 4 --retry 3
24
+
25
+ - name: version
26
+ id: version
27
+ run: |
28
+ echo ::set-output name=value::$(ruby -e 'print "${{ github.ref }}"[/\/v([\w\.\-]+)/, 1]')
29
+
30
+ - name: create gem
31
+ run: rake clean gem
32
+
33
+ - name: create release
34
+ id: create_release
35
+ uses: actions/create-release@v1
36
+ env:
37
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38
+ with:
39
+ tag_name: ${{ github.ref }}
40
+ release_name: ${{ github.ref }}
41
+ draft: false
42
+ prerelease: false
43
+
44
+ - name: upload to releases
45
+ uses: actions/upload-release-asset@v1
46
+ env:
47
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48
+ with:
49
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
50
+ asset_path: ./rubysketch-${{ steps.version.outputs.value }}.gem
51
+ asset_name: rubysketch-${{ steps.version.outputs.value }}.gem
52
+ asset_content_type: application/zip
53
+
54
+ - name: upload to rubygems
55
+ env:
56
+ GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
57
+ run: |
58
+ mkdir -p $HOME/.gem
59
+ touch $HOME/.gem/credentials
60
+ chmod 0600 $HOME/.gem/credentials
61
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
62
+ rake upload
@@ -0,0 +1,27 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: macos-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+
16
+ - name: ruby 2.6
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: 2.6.x
20
+
21
+ - name: install gems
22
+ run: |
23
+ gem install bundler
24
+ bundle install --jobs 4 --retry 3
25
+
26
+ - name: test
27
+ run: rake test
@@ -1,6 +1,12 @@
1
1
  # RubySketch ChangeLog
2
2
 
3
3
 
4
+ ## [0.3.6] - 2020-08-02
5
+
6
+ - random() can take array or nothing
7
+ - use github actions to release gem package
8
+
9
+
4
10
  ## [0.3.5] - 2020-08-02
5
11
 
6
12
  - add random()
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'yard'
4
+ gem 'reflexion'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
@@ -2169,16 +2169,21 @@ module RubySketch
2169
2169
 
2170
2170
  # Returns a random number in range low...high
2171
2171
  #
2172
+ # @overload random()
2172
2173
  # @overload random(high)
2173
2174
  # @overload random(low, high)
2175
+ # @overload random(choices)
2174
2176
  #
2175
- # @param low [Numeric] lower limit
2176
- # @param high [Numeric] upper limit
2177
+ # @param low [Numeric] lower limit
2178
+ # @param high [Numeric] upper limit
2179
+ # @param choices [Array] array to choose from
2177
2180
  #
2178
2181
  # @return [Float] random number
2179
2182
  #
2180
- def random (low = nil, high)
2181
- rand (low || 0).to_f...high.to_f
2183
+ def random (*args)
2184
+ return args.first.sample if args.first.kind_of? Array
2185
+ high, low = args.reverse
2186
+ rand (low || 0).to_f...(high || 1).to_f
2182
2187
  end
2183
2188
 
2184
2189
  # Creates a new vector.
@@ -28,17 +28,9 @@ Gem::Specification.new do |s|
28
28
  s.platform = Gem::Platform::RUBY
29
29
  s.required_ruby_version = '~> 2'
30
30
 
31
- s.add_runtime_dependency 'yard'
32
- s.add_runtime_dependency 'xot', '~> 0.1'
33
- s.add_runtime_dependency 'beeps', '~> 0.1'
34
- s.add_runtime_dependency 'rucy', '~> 0.1'
35
- s.add_runtime_dependency 'rays', '~> 0.1'
36
31
  s.add_runtime_dependency 'reflexion', '~> 0.1'
37
32
 
38
33
  s.files = `git ls-files`.split $/
39
34
  s.test_files = s.files.grep %r{^(test|spec|features)/}
40
35
  s.extra_rdoc_files = rdocs.to_a
41
- s.has_rdoc = true
42
-
43
- s.extensions << 'Rakefile'
44
36
  end
@@ -13,11 +13,16 @@ class TestProcessingUtility < Test::Unit::TestCase
13
13
  end
14
14
 
15
15
  def test_random ()
16
- assert_equal Float, C.random(1).class
17
- assert_equal Float, C.random(1.0).class
18
- assert_not_equal C.random(1), C.random(1)
16
+ assert_equal Float, C.random(1).class
17
+ assert_equal Float, C.random(1.0).class
18
+ assert_equal Symbol, C.random((:a..:z).to_a).class
19
+
20
+ assert_not_equal C.random, C.random
19
21
 
20
22
  10000.times do
23
+ n = C.random
24
+ assert 0 <= n && n < 1
25
+
21
26
  n = C.random 1
22
27
  assert 0 <= n && n < 1
23
28
 
metadata CHANGED
@@ -1,85 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysketch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-02 00:00:00.000000000 Z
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: yard
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: xot
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '0.1'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.1'
41
- - !ruby/object:Gem::Dependency
42
- name: beeps
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.1'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.1'
55
- - !ruby/object:Gem::Dependency
56
- name: rucy
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.1'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.1'
69
- - !ruby/object:Gem::Dependency
70
- name: rays
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.1'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '0.1'
83
13
  - !ruby/object:Gem::Dependency
84
14
  name: reflexion
85
15
  requirement: !ruby/object:Gem::Requirement
@@ -97,13 +27,15 @@ dependencies:
97
27
  description: Creative Coding Framework have API compatible to Processing API or p5.js.
98
28
  email: xordog@gmail.com
99
29
  executables: []
100
- extensions:
101
- - Rakefile
30
+ extensions: []
102
31
  extra_rdoc_files: []
103
32
  files:
33
+ - ".github/workflows/release.yml"
34
+ - ".github/workflows/test.yml"
104
35
  - ".gitignore"
105
36
  - ".yardopts"
106
37
  - ChangeLog.md
38
+ - Gemfile
107
39
  - LICENSE
108
40
  - README.md
109
41
  - Rakefile
@@ -126,7 +58,7 @@ files:
126
58
  homepage: https://github.com/xord/rubysketch
127
59
  licenses: []
128
60
  metadata: {}
129
- post_install_message:
61
+ post_install_message:
130
62
  rdoc_options: []
131
63
  require_paths:
132
64
  - lib
@@ -142,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
74
  version: '0'
143
75
  requirements: []
144
76
  rubygems_version: 3.0.3
145
- signing_key:
77
+ signing_key:
146
78
  specification_version: 4
147
79
  summary: Processing like Creative Coding Framework.
148
80
  test_files: