rpbundle 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e1d5af9a2e1e2112a52b77156b43b8756baddf26
4
+ data.tar.gz: 419b55806649c9541e4de46ca510553848d5bed6
5
+ SHA512:
6
+ metadata.gz: 2af28c851cab9a8a0b29f745b4bbfb1debdbfba540647f4f41107130c9af224026e5f2a8e7b501ae44e178115a03b0dd86583a1fe8267946655f30c2157ce731
7
+ data.tar.gz: db9ae0a6a5157036f7f3dddb94677904167d110bbf0478f5a6ac8858f1e21bd22885d4f0cfe6ae1918332637c6e2dd6eb05b8d3414efc52205c7a8cea0a93b3f
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rpbundle.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Emil Soman
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # rpbundle
2
+
3
+ `rpbundle` is an extension to ruby-processing which allows you
4
+ to use rubygems in your ruby-processing sketches and manage gem dependencies
5
+ of your sketches using bundler.
6
+
7
+ ## Why do I need this ?
8
+
9
+ First, some background.
10
+
11
+ There are 2 ways of running ruby-processing sketches :
12
+
13
+ 1. Using system wide jruby installation
14
+ 2. Using jruby-complete.jar which is nothing but jruby in a jar
15
+
16
+ ### Why do we need 2 jrubies ?
17
+
18
+ Sadly, some sketches (like those which use `load_image`) require you to use
19
+ jruby-complete.jar by specifying `--nojruby` CLI argument to rp5. So that means
20
+ having a system wide jruby installation is not enough.
21
+
22
+ ### So why can't I always use --nojruby flag ?
23
+
24
+ Using system jruby allows you to use gems and make use of bundler in the usual
25
+ way, whereas using --nojruby doesn't allow you to do the same because jruby-complete
26
+ is like ruby in a box, and it doesn't know where your system gems are by default.
27
+
28
+ ### TL;DR
29
+
30
+ If there was a way to use rubygems with `--nojruby` flag, that would be the
31
+ ideal way to run sketches. `rpbundle` allows you to do that, and
32
+ that's why you need this.
33
+
34
+ ## Installation
35
+
36
+ $ gem install rpbundle
37
+
38
+ This gem has ruby-processing as a dependency so this installs `ruby-processing`
39
+ as well.
40
+
41
+ ## Usage
42
+
43
+ This gem comes with an executable `rpbundle`.
44
+
45
+ Prerequisite step for setting up :
46
+ $ rpbundle setup
47
+ The above command creates a directory at `~/.rpbundle` and installs `bundler`
48
+ gem into it.
49
+
50
+ Inside a sketch/project directory with a Gemfile, to install dependent gems :
51
+ $ rpbundle install
52
+
53
+ To run/watch/<other subcommands supported by rp5> your sketch using
54
+ rp5 command and load your gem dependencies while doing so :
55
+ $ rpbundle run/watch/.. my_sketch.rb
56
+
57
+ rp5bundle is a basically a wrapper around rp5 and does 2 things :
58
+
59
+ 1. Loads bundler environment in your sketches
60
+ 2. Uses jruby-complete.jar (So you don't need to specify --nojruby. It's always on.)
61
+
62
+ ## Contributing
63
+
64
+ 1. Fork it ( http://github.com/emilsoman/rpbundle/fork )
65
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
66
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
67
+ 4. Push to the branch (`git push origin my-new-feature`)
68
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/rpbundle ADDED
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ruby-processing'
4
+
5
+ # This is where ruby-processing holds jruby-complete.jar
6
+ JRUBY_COMPLETE = Processing::Runner.new.send(:jruby_complete)
7
+ # This is where rpbundle installs and reads gems from
8
+ RPBUNDLE_HOME = File.join Dir.home, '.rpbundle'
9
+
10
+ # Monkeypatch Processing::Runner so that jruby runs our `bundled_runner`
11
+ # and pass the original runner filename as an argument to it
12
+ class Processing::Runner
13
+ def spin_up(starter_script, sketch, args)
14
+ # Make sure that Processing::Runner knows we don't want system wide jruby
15
+ @options.nojruby = true
16
+ bundled_runner = File.join(File.dirname(__FILE__), '../lib/rpbundle/bundled_runner.rb')
17
+ runner = "#{RP5_ROOT}/lib/ruby-processing/runners/#{starter_script}"
18
+ java_args = discover_java_args(sketch).join(' ')
19
+ system "GEM_PATH=#{RPBUNDLE_HOME} java #{java_args} -cp #{jruby_complete} " +
20
+ "org.jruby.Main #{bundled_runner} #{runner} #{sketch} #{args}"
21
+ end
22
+ end
23
+
24
+ def run
25
+ case ARGV[0]
26
+ when 'setup'
27
+ setup
28
+ when 'install'
29
+ bundle_install
30
+ when 'help', '--help', '', nil
31
+ show_help
32
+ else
33
+ execute_with_processing(ARGV)
34
+ end
35
+ end
36
+
37
+ def setup
38
+ Dir.mkdir RPBUNDLE_HOME unless Dir.exist?(RPBUNDLE_HOME)
39
+ # Install bundler gem into RPBUNDLE_HOME using jruby_complete
40
+ system "java -jar #{JRUBY_COMPLETE} -S gem install -i #{RPBUNDLE_HOME} --no-rdoc --no-ri bundler"
41
+ end
42
+
43
+ def bundle_install
44
+ system("GEM_HOME=#{RPBUNDLE_HOME} GEM_PATH=#{RPBUNDLE_HOME} " +
45
+ "java -jar #{JRUBY_COMPLETE} -S bundle install")
46
+ end
47
+
48
+ def execute_with_processing(args)
49
+ Processing::Runner.execute
50
+ end
51
+
52
+ def show_help
53
+ puts """
54
+ rpbundle setup - Prerequisite step. Creates ~/.rpbundle directory
55
+ and installs bundler gem into ~/.rpbundle
56
+ rpbundle install - Install dependencies in your Gemfile
57
+ rpbundle help - Show this help text
58
+ rpbundle <any rp5 command line arguments> - Load gems and run rp5 commands
59
+ example: rpbundle run sketch.rb. This will load Gemfile dependencies and
60
+ run `rp5 run sketch.rb`
61
+ """
62
+ end
63
+
64
+ run
@@ -0,0 +1,4 @@
1
+ require 'bundler/setup'
2
+
3
+ runner = ARGV.shift
4
+ require runner
@@ -0,0 +1,3 @@
1
+ module Rpbundle
2
+ VERSION = "0.0.1"
3
+ end
data/lib/rpbundle.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Rpbundle
2
+ VERSION = "0.0.1"
3
+ end
data/rpbundle.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rpbundle/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rpbundle"
8
+ spec.version = Rpbundle::VERSION
9
+ spec.authors = ["Emil Soman"]
10
+ spec.email = ["emil.soman@gmail.com"]
11
+ spec.summary = %q{Use Gemfiles in your ruby-processing sketches}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "ruby-processing", "~> 2.4.3"
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec", "~> 2.14.1"
24
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rpbundle
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Emil Soman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruby-processing
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.4.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.4.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.14.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.14.1
69
+ description:
70
+ email:
71
+ - emil.soman@gmail.com
72
+ executables:
73
+ - rpbundle
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/rpbundle
83
+ - lib/rpbundle.rb
84
+ - lib/rpbundle/bundled_runner.rb
85
+ - lib/rpbundle/version.rb
86
+ - rpbundle.gemspec
87
+ homepage: ''
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.2.1
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Use Gemfiles in your ruby-processing sketches
111
+ test_files: []