sandoz 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 +4 -4
- data/.gitignore +14 -3
- data/CONTRIBUTING.md +1 -0
- data/Gemfile +4 -1
- data/README.md +19 -13
- data/bin/console +1 -1
- data/lib/sandoz.rb +135 -134
- data/lib/sandoz/version.rb +1 -1
- data/sandoz.gemspec +18 -18
- metadata +25 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9057ee8db704e426f988d44decf1016542b74379
|
4
|
+
data.tar.gz: d59cbb6814a330e3f1ed7c25b406e7e84611d5ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba558aaff5578de217aa277e3ed2cc7cb6c1523a1fdddbee2ac29b13e0a26f2a186b0801722b452c257ffc02b6f71b4c55b207cd3fe1c8b1811be5b92f250a8d
|
7
|
+
data.tar.gz: ff09bcadbd0b446b51f053e113f606c0b058b4663b3d94cb1ca0fbfef95666b5cb35b6a0bec65c46882c9238f5f2fb737c620ccddb4215904694344167389ad1
|
data/.gitignore
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# TODO
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,32 +1,38 @@
|
|
1
|
-
# Sandoz
|
2
|
-
|
3
|
-
A Gem Named Sandoz
|
1
|
+
# A Gem Named Sandoz
|
4
2
|
|
5
3
|
## Installation
|
4
|
+
Make sure you have bundler installed
|
6
5
|
|
6
|
+
gem install bundler
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
gem 'sandoz'
|
11
11
|
```
|
12
|
+
Then install dependencies:
|
12
13
|
|
13
|
-
|
14
|
+
bundle install
|
14
15
|
|
15
|
-
|
16
|
+
Run:
|
16
17
|
|
17
|
-
|
18
|
+
bundle exec rackup
|
18
19
|
|
19
|
-
|
20
|
+
How to Require:
|
20
21
|
|
21
|
-
|
22
|
+
require 'opal'
|
23
|
+
require 'sandoz'
|
22
24
|
|
23
|
-
|
25
|
+
#Have to do this to get functions in global namespace
|
26
|
+
include Sandoz
|
27
|
+
#Option 2:
|
28
|
+
Sandoz::defsketch do
|
29
|
+
Sandoz::setup do
|
30
|
+
Sandoz::size 600, 600
|
31
|
+
Sandoz::rect 100, 100, 100, 100
|
32
|
+
end
|
33
|
+
end
|
24
34
|
|
25
35
|
```ruby
|
26
|
-
require 'opal'
|
27
|
-
require 'sandoz'
|
28
|
-
include Sandoz
|
29
|
-
|
30
36
|
defsketch("content") do
|
31
37
|
setup do
|
32
38
|
size 600, 600
|
data/bin/console
CHANGED
data/lib/sandoz.rb
CHANGED
@@ -1,141 +1,142 @@
|
|
1
|
-
require
|
1
|
+
require 'sandoz/version'
|
2
2
|
|
3
3
|
module Sandoz
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
@p5 = `new p5(#{sketch}, #{id})`
|
12
|
-
end
|
13
|
-
|
14
|
-
def view_p
|
15
|
-
`return #{@p5}`
|
16
|
-
end
|
17
|
-
|
18
|
-
def init(p)
|
19
|
-
@@p = p
|
20
|
-
end
|
21
|
-
|
22
|
-
def size(w, h)
|
23
|
-
`#{@@p}.createCanvas(#{w}, #{h})`
|
24
|
-
end
|
25
|
-
|
26
|
-
def background(r, g=nil, b=nil)
|
27
|
-
if g == nil && b == nil
|
28
|
-
`#{@@p}.background(#{r})`
|
29
|
-
else
|
30
|
-
`#{@@p}.background(#{r}, #{g}, #{b})`
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def fill(r, g=nil, b=nil, a=nil)
|
35
|
-
if g==nil && b ==nil
|
36
|
-
`#{@@p}.fill(#{r})`
|
37
|
-
elsif a == nil
|
38
|
-
`#{@@p}.fill(#{r}, #{g}, #{b})`
|
39
|
-
else
|
40
|
-
`#{@@p}.fill(#{r}, #{g}, #{b}, #{a})`
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def rect(x, y, w, h)
|
45
|
-
`#{@@p}.rect(#{x}, #{y}, #{w}, #{h})`
|
46
|
-
end
|
47
|
-
|
48
|
-
def ellipse(x, y, w, h)
|
49
|
-
`#{@@p}.ellipse(#{x}, #{y}, #{w}, #{h})`
|
50
|
-
end
|
51
|
-
|
52
|
-
def width
|
53
|
-
`#{@@p}.width`
|
54
|
-
end
|
55
|
-
|
56
|
-
def height
|
57
|
-
`#{@@p}.height`
|
58
|
-
end
|
59
|
-
|
60
|
-
def line(x1, y1, x2, y2)
|
61
|
-
`#{@@p}.line(#{x1}, #{y1}, #{x2}, #{y2})`
|
62
|
-
end
|
63
|
-
|
64
|
-
def point(x, y)
|
65
|
-
`#{@@p}.point(#{x}, #{y})`
|
66
|
-
end
|
67
|
-
|
68
|
-
def stroke(r, g=nil, b=nil, a=nil)
|
69
|
-
if g==nil && b ==nil
|
70
|
-
`#{@@p}.stroke(#{r})`
|
71
|
-
elsif a == nil
|
72
|
-
`#{@@p}.stroke(#{r}, #{g}, #{b})`
|
73
|
-
else
|
74
|
-
`#{@@p}.stroke(#{r}, #{g}, #{b}, #{a})`
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def no_stroke
|
79
|
-
`#{@@p}.noStroke()`
|
80
|
-
end
|
81
|
-
|
82
|
-
def stroke_weight(weight)
|
83
|
-
`#{@@p}.strokeWeight(#{weight})`
|
84
|
-
end
|
85
|
-
|
86
|
-
def setup(&block)
|
87
|
-
`#{@@p}.setup = #{block}`
|
4
|
+
# https://github.com/processing/p5.js/wiki/p5.js-overview#instantiation--namespace
|
5
|
+
# TODO Add html element argument
|
6
|
+
def defsketch(id, &block)
|
7
|
+
sketch = Proc.new do |p|
|
8
|
+
init(p)
|
9
|
+
block.call
|
88
10
|
end
|
11
|
+
@p5 = `new p5(#{sketch}, #{id})`
|
12
|
+
end
|
13
|
+
|
14
|
+
def view_p
|
15
|
+
`return #{@p5}`
|
16
|
+
end
|
17
|
+
|
18
|
+
def init(p)
|
19
|
+
@@p = p
|
20
|
+
end
|
21
|
+
|
22
|
+
def size(w, h)
|
23
|
+
`#{@@p}.createCanvas(#{w}, #{h})`
|
24
|
+
end
|
25
|
+
|
26
|
+
def background(r, g=nil, b=nil)
|
27
|
+
if g == nil && b == nil
|
28
|
+
`#{@@p}.background(#{r})`
|
29
|
+
else
|
30
|
+
`#{@@p}.background(#{r}, #{g}, #{b})`
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def fill(r, g=nil, b=nil, a=nil)
|
35
|
+
if g==nil && b ==nil
|
36
|
+
`#{@@p}.fill(#{r})`
|
37
|
+
elsif a == nil
|
38
|
+
`#{@@p}.fill(#{r}, #{g}, #{b})`
|
39
|
+
else
|
40
|
+
`#{@@p}.fill(#{r}, #{g}, #{b}, #{a})`
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def rect(x, y, w, h)
|
45
|
+
`#{@@p}.rect(#{x}, #{y}, #{w}, #{h})`
|
46
|
+
end
|
47
|
+
|
48
|
+
def ellipse(x, y, w, h)
|
49
|
+
`#{@@p}.ellipse(#{x}, #{y}, #{w}, #{h})`
|
50
|
+
end
|
51
|
+
|
52
|
+
def width
|
53
|
+
`#{@@p}.width`
|
54
|
+
end
|
55
|
+
|
56
|
+
def height
|
57
|
+
`#{@@p}.height`
|
58
|
+
end
|
59
|
+
|
60
|
+
def line(x1, y1, x2, y2)
|
61
|
+
`#{@@p}.line(#{x1}, #{y1}, #{x2}, #{y2})`
|
62
|
+
end
|
63
|
+
|
64
|
+
def point(x, y)
|
65
|
+
`#{@@p}.point(#{x}, #{y})`
|
66
|
+
end
|
67
|
+
|
68
|
+
def stroke(r, g=nil, b=nil, a=nil)
|
69
|
+
if g==nil && b ==nil
|
70
|
+
`#{@@p}.stroke(#{r})`
|
71
|
+
elsif a == nil
|
72
|
+
`#{@@p}.stroke(#{r}, #{g}, #{b})`
|
73
|
+
else
|
74
|
+
`#{@@p}.stroke(#{r}, #{g}, #{b}, #{a})`
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def no_stroke
|
79
|
+
`#{@@p}.noStroke()`
|
80
|
+
end
|
81
|
+
|
82
|
+
def stroke_weight(weight)
|
83
|
+
`#{@@p}.strokeWeight(#{weight})`
|
84
|
+
end
|
85
|
+
|
86
|
+
def setup(&block)
|
87
|
+
`#{@@p}.setup = #{block}`
|
88
|
+
end
|
89
89
|
|
90
|
-
|
91
|
-
|
90
|
+
def draw(&block)
|
91
|
+
`#{@@p}.draw = #{block}`
|
92
|
+
end
|
93
|
+
|
94
|
+
def dist(x1, y1, x2, y2)
|
95
|
+
`return #{@@p}.dist(x1, y1, x2, y2)`
|
96
|
+
end
|
97
|
+
|
98
|
+
def random(min, max=nil)
|
99
|
+
if max
|
100
|
+
`return #{@@p}.random(#{min}, #{max})`
|
101
|
+
else
|
102
|
+
`return #{@@p}.random(#{min})`
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def color(r, g=nil, b=nil, a=nil)
|
107
|
+
if g==nil && b ==nil
|
108
|
+
`return #{@@p}.color(#{r})`
|
109
|
+
elsif a == nil
|
110
|
+
`return #{@@p}.color(#{r}, #{g}, #{b})`
|
111
|
+
else
|
112
|
+
`return #{@@p}.color(#{r}, #{g}, #{b}, #{a})`
|
92
113
|
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def map(value, start1, stop1, start2, stop2)
|
117
|
+
`return #{@@p}.map(#{value}, #{start1}, #{stop1}, #{start2}, #{stop2})`
|
118
|
+
end
|
119
|
+
|
120
|
+
def millis
|
121
|
+
`return #{@@p}.millis();`
|
122
|
+
end
|
123
|
+
|
124
|
+
def no_fill
|
125
|
+
`#{@@p}.noFill()`
|
126
|
+
end
|
127
|
+
|
128
|
+
def noise(x, y=nil, z=nil)
|
129
|
+
if y == nil && z == nil
|
130
|
+
`return #{@@p}.noise(#{x})`
|
131
|
+
elsif z == nil
|
132
|
+
`return #{@@p}.noise(#{x}, #{y})`
|
133
|
+
else
|
134
|
+
`return #{@@p}.noise(#{x}, #{y}, #{z})`
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def text(text, x, y)
|
139
|
+
`#{@@p}.text(#{text}, #{x}, #{y})`
|
140
|
+
end
|
93
141
|
|
94
|
-
def dist(x1, y1, x2, y2)
|
95
|
-
`return #{@@p}.dist(x1, y1, x2, y2)`
|
96
|
-
end
|
97
|
-
|
98
|
-
def random(min, max=nil)
|
99
|
-
if max
|
100
|
-
`return #{@@p}.random(#{min}, #{max})`
|
101
|
-
else
|
102
|
-
`return #{@@p}.random(#{min})`
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def color(r, g=nil, b=nil, a=nil)
|
107
|
-
if g==nil && b ==nil
|
108
|
-
`return #{@@p}.color(#{r})`
|
109
|
-
elsif a == nil
|
110
|
-
`return #{@@p}.color(#{r}, #{g}, #{b})`
|
111
|
-
else
|
112
|
-
`return #{@@p}.color(#{r}, #{g}, #{b}, #{a})`
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def map(value, start1, stop1, start2, stop2)
|
117
|
-
`return #{@@p}.map(#{value}, #{start1}, #{stop1}, #{start2}, #{stop2})`
|
118
|
-
end
|
119
|
-
|
120
|
-
def millis
|
121
|
-
`return #{@@p}.millis();`
|
122
|
-
end
|
123
|
-
|
124
|
-
def no_fill
|
125
|
-
`#{@@p}.noFill()`
|
126
|
-
end
|
127
|
-
|
128
|
-
def noise(x, y=nil, z=nil)
|
129
|
-
if y == nil && z == nil
|
130
|
-
`return #{@@p}.noise(#{x})`
|
131
|
-
elsif z == nil
|
132
|
-
`return #{@@p}.noise(#{x}, #{y})`
|
133
|
-
else
|
134
|
-
`return #{@@p}.noise(#{x}, #{y}, #{z})`
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
def text(text, x, y)
|
139
|
-
`#{@@p}.text(#{text}, #{x}, #{y})`
|
140
|
-
end
|
141
142
|
end
|
data/lib/sandoz/version.rb
CHANGED
data/sandoz.gemspec
CHANGED
@@ -3,30 +3,30 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'sandoz/version'
|
5
5
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
spec.license = "MIT"
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'sandoz'
|
8
|
+
s.version = Sandoz::VERSION
|
9
|
+
s.authors = ["Harley Swick"]
|
10
|
+
s.email = ["hswick@example.com"]
|
11
|
+
s.summary = %q{ A gem named Sandoz. }
|
12
|
+
s.description = %q{ Ruby P5.js wrapper for trippy visuals. }
|
13
|
+
s.homepage = "https://github.com/hswick/sandoz"
|
14
|
+
s.license = "MIT"
|
16
15
|
|
17
16
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
17
|
# delete this section to allow pushing this gem to any host.
|
19
|
-
if
|
20
|
-
|
18
|
+
if s.respond_to?(:metadata)
|
19
|
+
s.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
20
|
else
|
22
21
|
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
22
|
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
s.bindir = "exe"
|
26
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
s.require_paths = ["lib"]
|
29
28
|
|
30
|
-
|
31
|
-
|
29
|
+
s.add_development_dependency 'bundler', '~> 1.11'
|
30
|
+
s.add_dependency 'sinatra', '~> 1.4'
|
31
|
+
s.add_dependency 'opal', '~> 0.9'
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sandoz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Harley Swick
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,28 +25,43 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: sinatra
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
type: :
|
33
|
+
version: '1.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: opal
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.9'
|
48
|
+
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
-
description: Ruby P5
|
54
|
+
version: '0.9'
|
55
|
+
description: " Ruby P5.js wrapper for trippy visuals. "
|
42
56
|
email:
|
43
|
-
- hswick@
|
57
|
+
- hswick@example.com
|
44
58
|
executables: []
|
45
59
|
extensions: []
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
48
62
|
- ".gitignore"
|
49
63
|
- CODE_OF_CONDUCT.md
|
64
|
+
- CONTRIBUTING.md
|
50
65
|
- Gemfile
|
51
66
|
- Gemfile.lock
|
52
67
|
- LICENSE.txt
|
@@ -81,5 +96,5 @@ rubyforge_project:
|
|
81
96
|
rubygems_version: 2.4.5.1
|
82
97
|
signing_key:
|
83
98
|
specification_version: 4
|
84
|
-
summary: A
|
99
|
+
summary: A gem named Sandoz.
|
85
100
|
test_files: []
|