jruby_art 1.0.5 → 1.0.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
  SHA1:
3
- metadata.gz: bf8d21207bb2dfe22e678dca2a1fc520a63522ca
4
- data.tar.gz: adf82b194889168470524499825b63f3e3f20ef8
3
+ metadata.gz: 871f9994cf154b8e5f8273b71ec1ae5e95465e59
4
+ data.tar.gz: 3e0bab9affa5a74f596d2e2d74e5c5b525b98328
5
5
  SHA512:
6
- metadata.gz: ac9e19615a363cb46559a1361935c1ba93ec4c015de899984777d41d562f166e10114d69983c2ae206f06ca8b23b94e5cd172603b5c4507a9d3e406236646c6a
7
- data.tar.gz: 588994785d671d415d562f26499f71754ae28a49d7cbf44bfca40cd24e78cea1150d85fe7c588c3ad675ae1e9ccb9453f60dc9233d7afd46108906463970269f
6
+ metadata.gz: a94a5ce02de30ffebbfc7f672e8900206b070aa752964ce2f92b37179a4ef7c2cfbbf94a9af355693a09033633d2dabea035f8026ba4e3127b240bf34f23f94a
7
+ data.tar.gz: a7f6a8bdb65170d293ec798e74a4d2ca6e1be10c092d3f506be513f3892121486fb740dd3f93cf6f625e12d55822851dba04737d5b3226c019ae625714cc347c
@@ -137,7 +137,6 @@ CODE
137
137
  # processing wrapper module
138
138
  module Processing
139
139
  require_relative '../helpers/string_extra'
140
- require_relative '../helpers/camel_string'
141
140
  # Write file to disk
142
141
  class SketchWriter
143
142
  attr_reader :file
@@ -222,7 +221,7 @@ module Processing
222
221
  main_file = File.basename(path, '.rb') # allow uneeded extension input
223
222
  # Check to make sure that the main file doesn't exist already
224
223
  already_exist(path)
225
- @name = CamelString.new(main_file).camelize
224
+ @name = StringExtra.new(main_file).camelize
226
225
  writer = SketchWriter.new(main_file)
227
226
  @title = StringExtra.new(main_file).titleize
228
227
  @width, @height = args[0], args[1]
@@ -247,7 +246,7 @@ module Processing
247
246
  main_file = File.basename(path, '.rb') # allow uneeded extension input
248
247
  # Check to make sure that the main file doesn't exist already
249
248
  already_exist(path)
250
- @name = CamelString.new(main_file).camelize
249
+ @name = StringExtra.new(main_file).camelize
251
250
  writer = SketchWriter.new(main_file)
252
251
  @title = StringExtra.new(main_file).titleize
253
252
  @width, @height = args[0], args[1]
@@ -3,12 +3,12 @@
3
3
 
4
4
  require 'forwardable'
5
5
 
6
- # Avoid the monkey patching of String for underscore/titleize/humanize
6
+ # String utility for creating titles and class-names
7
7
  class StringExtra
8
8
  extend Forwardable
9
- def_delegators(:@string, *String.public_instance_methods(false))
10
- def initialize(str = 'no_name')
11
- @string = (str.length > 60) ? 'long_name' : str
9
+ def_delegators :@str, :upcase, :capitalize, :length, :downcase, :gsub, :tr
10
+ def initialize(str)
11
+ @str = str
12
12
  end
13
13
 
14
14
  def titleize
@@ -18,19 +18,28 @@ class StringExtra
18
18
  .tr('-', '_')
19
19
  .downcase
20
20
  .gsub(/_id$/, '')
21
- .gsub(/_/, ' ').capitalize
21
+ .tr('_', ' ').capitalize
22
22
  .gsub(/\b([a-z])/) { Regexp.last_match[1].capitalize }
23
23
  end
24
24
 
25
25
  def humanize
26
- gsub(/_id$/, '').gsub(/_/, ' ').capitalize
26
+ gsub(/_id$/, '').tr(/_/, ' ').capitalize
27
27
  end
28
28
 
29
29
  def underscore
30
30
  gsub(/::/, '/')
31
31
  .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
32
32
  .gsub(/([a-z\d])([A-Z])/, '\1_\2')
33
- .tr('-', '_')
33
+ .sub('-', '_')
34
34
  .downcase
35
35
  end
36
+
37
+ def camelize(first_letter_in_uppercase = true)
38
+ if first_letter_in_uppercase
39
+ @str.gsub(%r{/(.?)}) { '::' + Regexp.last_match[1].upcase }
40
+ .gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
41
+ else
42
+ @str[0] + camelize[1..-1]
43
+ end
44
+ end
36
45
  end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
  # A wrapper for version
4
4
  module JRubyArt
5
- VERSION = '1.0.5'
5
+ VERSION = '1.0.6'
6
6
  end
data/lib/rpextras.jar CHANGED
Binary file
@@ -0,0 +1,43 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+ # Here's a little library for quickly hooking up in sketch sliders.
4
+ # Copyright (c) 2016 Martin Prout.
5
+
6
+ java_import 'monkstone.slider.CustomHorizontalSlider'
7
+ java_import 'monkstone.slider.CustomVerticalSlider'
8
+
9
+ module Slider
10
+ def self.slider(app:, x:, y:, name:, **opts)
11
+ options = default.merge opts
12
+ if options[:vertical]
13
+ slider = CustomVerticalSlider.new(
14
+ app,
15
+ x,
16
+ y,
17
+ options[:length],
18
+ options[:range].first,
19
+ options[:range].last,
20
+ name
21
+ )
22
+ else
23
+ slider = CustomHorizontalSlider.new(
24
+ app,
25
+ x,
26
+ y,
27
+ options[:length],
28
+ options[:range].first,
29
+ options[:range].last,
30
+ name
31
+ )
32
+ end
33
+ unless opts.empty?
34
+ slider.bar_width(opts.fetch(:bar_width, 10))
35
+ slider.set_value(opts.fetch(:initial_value, 0))
36
+ end
37
+ slider
38
+ end
39
+
40
+ def self.default
41
+ { length: 100, range: (0..100) }
42
+ end
43
+ end
data/vendors/Rakefile CHANGED
@@ -9,7 +9,7 @@ WARNING = <<-EOS
9
9
  EOS
10
10
 
11
11
  JRUBYC_VERSION = '9.0.5.0'
12
- EXAMPLES = '1.4'
12
+ EXAMPLES = '1.5'
13
13
  HOME_DIR = ENV['HOME']
14
14
  MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby_art
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-06 00:00:00.000000000 Z
13
+ date: 2016-04-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -40,15 +40,15 @@ dependencies:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '5.8'
43
- description: |2
44
- JRubyArt is a ruby wrapper for the processing art framework.
45
- The current version supports processing-3.0.2, and uses jruby-9.0.5.0
46
- as the glue between ruby and java. You can use both processing libraries and ruby
47
- gems in your sketches. Features create/run/watch/live modes. The "watch" mode,
48
- provides a nice REPL-ish way to work on your processing sketches. Includes:-
49
- A "Control Panel" library, so that you can easily create sliders, buttons,
50
- checkboxes and drop-down menus, and hook them into your sketch's instance
51
- variables and hundreds of worked examples to get you started...
43
+ description: " JRubyArt is a ruby wrapper for the processing art framework.\n The
44
+ current release features examples using hype library by Joshua Davis.\n This version
45
+ supports processing-3.0.2, and uses jruby-9.0.5.0 as the glue \n between ruby
46
+ and java. You can use both processing libraries and ruby gems \n in your sketches.
47
+ Features create/run/watch/live modes. The \"watch\" mode,\n provides a nice REPL-ish
48
+ way to work on your processing sketches. Includes:-\n A \"Control Panel\" library,
49
+ so that you can easily create sliders, buttons,\n checkboxes and drop-down menus,
50
+ and hook them into your sketch's instance\n variables and hundreds of worked examples
51
+ to get you started...\n"
52
52
  email: martin_p@lineone.net
53
53
  executables:
54
54
  - k9
@@ -62,7 +62,6 @@ files:
62
62
  - lib/jruby_art/creators/creator.rb
63
63
  - lib/jruby_art/helper_methods.rb
64
64
  - lib/jruby_art/helpers/aabb.rb
65
- - lib/jruby_art/helpers/camel_string.rb
66
65
  - lib/jruby_art/helpers/numeric.rb
67
66
  - lib/jruby_art/helpers/string_extra.rb
68
67
  - lib/jruby_art/library_loader.rb
@@ -77,6 +76,7 @@ files:
77
76
  - library/control_panel/control_panel.rb
78
77
  - library/library_proxy/README.md
79
78
  - library/library_proxy/library_proxy.rb
79
+ - library/slider/slider.rb
80
80
  - library/video_event/video_event.rb
81
81
  - vendors/Rakefile
82
82
  homepage: https://ruby-processing.github.io/
@@ -100,10 +100,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  requirements:
102
102
  - A decent graphics card
103
- - java runtime >= 1.8+
104
- - processing = 3.0.1+
103
+ - java runtime >= 1.8.0_77+
104
+ - processing = 3.0.2+
105
105
  rubyforge_project:
106
- rubygems_version: 2.5.2
106
+ rubygems_version: 2.6.3
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Code as Art, Art as Code. Processing and Ruby are meant for each other.
@@ -1,22 +0,0 @@
1
- # encoding: utf-8
2
- # frozen_string_literal: false
3
-
4
- require 'forwardable'
5
-
6
- # Avoid the monkey patching of String for camelize
7
- class CamelString
8
- extend Forwardable
9
- def_delegators(:@string, *String.public_instance_methods(false))
10
- def initialize(str = 'no_name')
11
- @string = (str.length > 60) ? 'long_name' : str
12
- end
13
-
14
- def camelize(first_letter_in_uppercase = true)
15
- if first_letter_in_uppercase
16
- @string.gsub(%r{/(.?)}) { '::' + Regexp.last_match[1].upcase }
17
- .gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
18
- else
19
- @string[0] + camelize[1..-1]
20
- end
21
- end
22
- end