ruby-processing 2.6.6 → 2.6.7

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: adc61b4d1f9863347b5dad489be21b9e11175b73
4
- data.tar.gz: 47b8d8b0468f353e62e8e7d3ed39dfc898ae5861
3
+ metadata.gz: 66a5c0578c17ec6e9ace637abb2626d7c4907549
4
+ data.tar.gz: 711c1d6afedd64b8ca08956f7fd86a76db6841ea
5
5
  SHA512:
6
- metadata.gz: ec80fa518a755bffba552c7dbada41cd2ceb56b2152d63c41374245fad0b1fc617f4f43b54a80239273201be5f2d8da8e9793c44b3c5c0399db85e4869b86ded
7
- data.tar.gz: 31caff147a9a4acd94db75b20c96b4d2e8694cdeefc176466b5c35f6316b66cee10a4e271fe871d7ce14808810f076d2ff1f31813961a05009a7fc9b540e5529
6
+ metadata.gz: 3d8d40e8e3a1b996de6071faf63b0b8f9b2ac912a7d8564c93bb94c18ccea8641f67e019cc7090fd879539de2649554070318d7a090620bda3c59b59ef81f1e8
7
+ data.tar.gz: a193bb65ae7813300bc723a478d543e457a9b4fedd6c97e1e5d506c78ee43eebfbc543962ccdc6ea3504090ad1c5b170bda7c07e654d7a568b17165fb23e0904
data/lib/rpextras.jar CHANGED
Binary file
@@ -9,7 +9,6 @@ end
9
9
  SKETCH_ROOT ||= Dir.pwd
10
10
 
11
11
  require 'ruby-processing/version'
12
- require 'ruby-processing/helpers/string'
13
12
  require 'ruby-processing/helpers/numeric'
14
13
  require 'ruby-processing/helpers/range'
15
14
 
@@ -4,6 +4,7 @@
4
4
  # web applets, going fullscreen and so on.
5
5
  require 'java'
6
6
  require_relative '../ruby-processing/helper_methods'
7
+ require_relative '../ruby-processing/helpers/string_extra'
7
8
  require_relative '../ruby-processing/library_loader'
8
9
  require_relative '../ruby-processing/config'
9
10
 
@@ -185,10 +186,8 @@ module Processing
185
186
  x = options.fetch(:x, xc)
186
187
  y = options.fetch(:y, yc)
187
188
  args << "--location=#{x},#{y}" # important no spaces here
188
- title = options.fetch(
189
- :title,
190
- File.basename(SKETCH_PATH).sub(/(\.rb)$/, '').titleize
191
- )
189
+ string_extra = StringExtra.new(File.basename(SKETCH_PATH).sub(/(\.rb)$/, ''))
190
+ title = options.fetch(:title, string_extra.titleize)
192
191
  args << title
193
192
  PApplet.run_sketch(args.to_java(:string), self)
194
193
  end
@@ -1,6 +1,7 @@
1
1
  require 'fileutils'
2
2
  require 'erb'
3
3
  require_relative '../library_loader'
4
+ require_relative '../helpers/string_extra'
4
5
 
5
6
  module Processing
6
7
  # This base exporter implements some of the common
@@ -42,8 +43,9 @@ module Processing
42
43
 
43
44
  # Searches the source for a title.
44
45
  def extract_title(source)
46
+ generated_title = StringExtra.new(File.basename(@file, '.rb')).titleize
45
47
  match = source.match(/#{@info[:class_name]}\.new.*?:title\s=>\s["'](.+?)["']/m)
46
- match ? match[1] : File.basename(@file, '.rb').titleize
48
+ match ? match[1] : generated_title
47
49
  end
48
50
 
49
51
  # Searches the source for the width and height of the sketch.
@@ -50,11 +50,14 @@ end
50
50
  CODE
51
51
 
52
52
  module Processing
53
+ require_relative '../helpers/string_extra'
54
+ require_relative '../helpers/camel_string'
53
55
  # Write file to disk
54
56
  class SketchWriter
55
57
  attr_reader :file
56
58
  def initialize(path)
57
- @file = "#{File.dirname(path)}/#{path.underscore}.rb"
59
+ underscore = StringExtra.new(path).underscore
60
+ @file = "#{File.dirname(path)}/#{underscore}.rb"
58
61
  end
59
62
 
60
63
  def save(template)
@@ -69,7 +72,8 @@ module Processing
69
72
  ALL_DIGITS = /\A\d+\Z/
70
73
 
71
74
  def already_exist(path)
72
- new_file = "#{File.dirname(path)}/#{path.underscore}.rb"
75
+ underscore = StringExtra.new(path).underscore
76
+ new_file = "#{File.dirname(path)}/#{underscore}.rb"
73
77
  return if !File.exist?(path) && !File.exist?(new_file)
74
78
  puts 'That file already exists!'
75
79
  exit
@@ -131,9 +135,9 @@ module Processing
131
135
  main_file = File.basename(path, '.rb') # allow uneeded extension input
132
136
  # Check to make sure that the main file doesn't exist already
133
137
  already_exist(path)
134
- @name = main_file.camelize
138
+ @name = CamelString.new(main_file).camelize
135
139
  writer = SketchWriter.new(main_file)
136
- @title = main_file.titleize
140
+ @title = StringExtra.new(main_file).titleize
137
141
  @width, @height = args[0], args[1]
138
142
  @mode = args[2].upcase unless args[2].nil?
139
143
  template = @mode.nil? ? class_template : class_template_mode
@@ -0,0 +1,18 @@
1
+ require 'forwardable'
2
+
3
+ # Avoid the monkey patching of String for camelize
4
+ class CamelString
5
+ extend Forwardable
6
+ def_delegators(:@string, *String.public_instance_methods(false))
7
+ def initialize(str = 'no_name')
8
+ @string = (str.length > 60) ? 'long_name' : str
9
+ end
10
+
11
+ def camelize(first_letter_in_uppercase = true)
12
+ if first_letter_in_uppercase
13
+ @string.gsub(/\/(.?)/) { '::' + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
14
+ else
15
+ @string[0] + camelize[1..-1]
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,33 @@
1
+ require 'forwardable'
2
+
3
+ # Avoid the monkey patching of String for underscore/titleize/humanize
4
+ class StringExtra
5
+ extend Forwardable
6
+ def_delegators(:@string, *String.public_instance_methods(false))
7
+ def initialize(str = 'no_name')
8
+ @string = (str.length > 60) ? 'long_name' : str
9
+ end
10
+
11
+ def titleize
12
+ gsub(/::/, '/')
13
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
14
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
15
+ .tr('-', '_')
16
+ .downcase
17
+ .gsub(/_id$/, '')
18
+ .gsub(/_/, ' ').capitalize
19
+ .gsub(/\b([a-z])/) { $1.capitalize }
20
+ end
21
+
22
+ def humanize
23
+ gsub(/_id$/, '').gsub(/_/, ' ').capitalize
24
+ end
25
+
26
+ def underscore
27
+ gsub(/::/, '/')
28
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
29
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
30
+ .tr('-', '_')
31
+ .downcase
32
+ end
33
+ end
@@ -33,7 +33,7 @@ module Processing
33
33
 
34
34
  Examples:
35
35
  rp5 setup unpack_samples
36
- rp5 run samples/contributed/jwishy.rb
36
+ rp5 run rp_samples/samples/contributed/jwishy.rb
37
37
  rp5 create some_new_sketch 640 480 p3d (P3D mode example)
38
38
  rp5 create some_new_sketch 640 480 --wrap (a class wrapped default sketch)
39
39
  rp5 watch some_new_sketch.rb
@@ -1,3 +1,3 @@
1
1
  module RubyProcessing
2
- VERSION = '2.6.6'
2
+ VERSION = '2.6.7'
3
3
  end
data/vendors/Rakefile CHANGED
@@ -8,8 +8,8 @@ WARNING = <<-EOS
8
8
 
9
9
  EOS
10
10
 
11
- JRUBYC_VERSION = '1.7.18'
12
- EXAMPLES = '1.2'
11
+ JRUBYC_VERSION = '1.7.19'
12
+ EXAMPLES = '1.4'
13
13
  HOME_DIR = ENV['HOME']
14
14
  MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
15
15
 
@@ -27,7 +27,7 @@ file "jruby-complete-#{JRUBYC_VERSION}.jar" do
27
27
  rescue
28
28
  warn(WARNING)
29
29
  end
30
- check_sha1("jruby-complete-#{JRUBYC_VERSION}.jar", "a1be3e1790aace5c99614a87785454d875eb21c2")
30
+ check_sha1("jruby-complete-#{JRUBYC_VERSION}.jar", "9973923de511c06d979e950801b51a95d19e8be3")
31
31
  end
32
32
 
33
33
  directory "../lib/ruby"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-processing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.6
4
+ version: 2.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -18,7 +18,7 @@ authors:
18
18
  autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
- date: 2014-12-23 00:00:00.000000000 Z
21
+ date: 2015-01-30 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  requirement: !ruby/object:Gem::Requirement
@@ -111,9 +111,10 @@ files:
111
111
  - lib/ruby-processing/exporters/base_exporter.rb
112
112
  - lib/ruby-processing/exporters/creator.rb
113
113
  - lib/ruby-processing/helper_methods.rb
114
+ - lib/ruby-processing/helpers/camel_string.rb
114
115
  - lib/ruby-processing/helpers/numeric.rb
115
116
  - lib/ruby-processing/helpers/range.rb
116
- - lib/ruby-processing/helpers/string.rb
117
+ - lib/ruby-processing/helpers/string_extra.rb
117
118
  - lib/ruby-processing/library_loader.rb
118
119
  - lib/ruby-processing/runner.rb
119
120
  - lib/ruby-processing/runners/base.rb
@@ -1,25 +0,0 @@
1
- class String #:nodoc:
2
- def titleize
3
- underscore.humanize.gsub(/\b([a-z])/) { $1.capitalize }
4
- end
5
-
6
- def humanize
7
- gsub(/_id$/, '').gsub(/_/, ' ').capitalize
8
- end
9
-
10
- def camelize(first_letter_in_uppercase = true)
11
- if first_letter_in_uppercase
12
- gsub(/\/(.?)/) { '::' + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
13
- else
14
- first + camelize[1..-1]
15
- end
16
- end
17
-
18
- def underscore
19
- gsub(/::/, '/')
20
- .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
21
- .gsub(/([a-z\d])([A-Z])/, '\1_\2')
22
- .tr('-', '_')
23
- .downcase
24
- end
25
- end