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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a9ec60551ec13d4abeea0e08797a8656211bfb9
4
- data.tar.gz: b613c72fbf9c86950010de5174d039bd0118d8c1
3
+ metadata.gz: 9057ee8db704e426f988d44decf1016542b74379
4
+ data.tar.gz: d59cbb6814a330e3f1ed7c25b406e7e84611d5ca
5
5
  SHA512:
6
- metadata.gz: 0944d643c059b3d4681f645a2a5d78f504f587894eae76b93eb04589fd0cbd1565e12b1a97121af4dcc47497d8d10d6f15dc3d8ba36e1e360c0c0339db1d58ea
7
- data.tar.gz: 5b52d20b3a166258e226f31c29d3ac370f21beabc78b6ed330fb92d0d858c31fb389e4ee7eb799a4639fc0a78e2cf05b81ce9f1bc7258b750b1be282b9dfd5bc
6
+ metadata.gz: ba558aaff5578de217aa277e3ed2cc7cb6c1523a1fdddbee2ac29b13e0a26f2a186b0801722b452c257ffc02b6f71b4c55b207cd3fe1c8b1811be5b92f250a8d
7
+ data.tar.gz: ff09bcadbd0b446b51f053e113f606c0b058b4663b3d94cb1ca0fbfef95666b5cb35b6a0bec65c46882c9238f5f2fb737c620ccddb4215904694344167389ad1
data/.gitignore CHANGED
@@ -1,3 +1,14 @@
1
- *.DS_Store
2
- Gemfile.lock
3
- /pkg
1
+ .DS_Store
2
+ .rvmrc
3
+ .ruby-version
4
+ .ruby-gemset
5
+ /.bundle/
6
+ /.yardoc
7
+ /Gemfile.lock
8
+ /_yardoc/
9
+ /coverage/
10
+ /doc/
11
+ /pkg/
12
+ /spec/reports/
13
+ /tmp/
14
+ sandoz*.gem
@@ -0,0 +1 @@
1
+ # TODO
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in sandoz.gemspec
3
+ gem 'opal'
4
+ gem 'sinatra'
5
+ gem 'rake'
6
+
4
7
  gemspec
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
- And then execute:
14
+ bundle install
14
15
 
15
- $ bundle
16
+ Run:
16
17
 
17
- Or install it yourself as:
18
+ bundle exec rackup
18
19
 
19
- $ gem install sandoz
20
+ How to Require:
20
21
 
21
- ## Usage
22
+ require 'opal'
23
+ require 'sandoz'
22
24
 
23
- This is assuming you are already have Opal boilerplate setup. See Opal gem docs.
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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "sandoz"
4
+ require "foo_gem"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -1,141 +1,142 @@
1
- require "sandoz/version"
1
+ require 'sandoz/version'
2
2
 
3
3
  module Sandoz
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
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
- def draw(&block)
91
- `#{@@p}.draw = #{block}`
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
@@ -1,3 +1,3 @@
1
1
  module Sandoz
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -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 |spec|
7
- spec.name = "sandoz"
8
- spec.version = Sandoz::VERSION
9
- spec.authors = ["hswick"]
10
- spec.email = ["hswick@smu.edu"]
11
-
12
- spec.summary = %q{A Gem Named Sandoz}
13
- spec.description = %q{Ruby P5 Wrapper to make trippy visuals}
14
- spec.homepage = "https://github.com/hswick/sandoz"
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 spec.respond_to?(:metadata)
20
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
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
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
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
- spec.add_development_dependency "bundler", "~> 1.11"
31
- spec.add_development_dependency "rake", "~> 10.0"
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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
- - hswick
7
+ - Harley Swick
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-23 00:00:00.000000000 Z
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: rake
28
+ name: sinatra
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
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: '10.0'
41
- description: Ruby P5 Wrapper to make trippy visuals
54
+ version: '0.9'
55
+ description: " Ruby P5.js wrapper for trippy visuals. "
42
56
  email:
43
- - hswick@smu.edu
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 Gem Named Sandoz
99
+ summary: A gem named Sandoz.
85
100
  test_files: []