Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added command line interface basically wrapping bundler

  • Loading branch information...
commit 2dee1ff68073d62cdb1ead9d86b792859d74b3b2 1 parent 41389db
@mkristian authored
View
3  Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- jbundler (0.2.0)
+ jbundler (0.2.1)
ruby-maven (= 3.0.4.0.29.0)
GEM
@@ -35,3 +35,4 @@ DEPENDENCIES
jbundler!
minitest (~> 2.10.0)
rake (= 0.9.2.2)
+ thor (> 0.14.0, < 0.16.0)
View
2  Readme.md
@@ -39,6 +39,8 @@ since the version resolution happens in two steps - first the gems then the jars
**Jarfile** is **not** a DSL, i.e. it is not ruby though it could use a ruby DSL to read the data (any contribution welcome).
+jbundler does not obey the **$HOME/.m2/settings.xml** from maven where you usually declare proxies, mirrors, etc.
+
## adding a maven repository ##
the maven central is default repostory and is always there. adding another repository use following decalration
View
19 bin/jbundler
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+require 'rubygems'
+
+if ARGV[0] == 'help'
+
+ require 'jbundler/cli'
+
+ JBundler::Cli.start
+
+else
+
+ load Gem.bin_path('bundler', 'bundle')
+
+ ARGV << 'install' if ARGV.size == 0
+ require 'jbundler/cli'
+
+ JBundler::Cli.start
+
+end
View
6 jbundler.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'jbundler'
- s.version = '0.2.0'
+ s.version = '0.2.1'
s.summary = 'bundler support for maven or/and maven support for bundler'
s.description = <<-END
@@ -11,6 +11,9 @@ END
s.email = ['m.kristian@web.de']
s.homepage = 'https://github.com/mkristian/jbundler'
+ s.bindir = "bin"
+ s.executables = ['jbundler']
+
s.files += Dir['lib/**/*']
s.files += Dir['spec/**/*']
s.files += Dir['MIT-LICENSE'] + Dir['*.md']
@@ -19,5 +22,6 @@ END
s.add_runtime_dependency "ruby-maven", "= 3.0.4.0.29.0"
s.add_development_dependency "rake", "0.9.2.2"
+ s.add_development_dependency "thor", "< 0.16.0", "> 0.14.0"
end
View
2  lib/jbundler.rb
@@ -9,7 +9,7 @@
if config.skip
warn "skip jbundler setup"
else
- classpath_file = JBundler::ClasspathFile.new('.jbundler/classpath.rb')
+ classpath_file = JBundler::ClasspathFile.new(config.classpath_file)
gemfile_lock = JBundler::GemfileLock.new(jarfile, config.gemfile + '.lock')
if classpath_file.needs_update?(jarfile, gemfile_lock)
View
4 lib/jbundler/aether.rb
@@ -50,6 +50,10 @@ def gemfile
@gemfile ||= jbundler_env('BUNDLE_GEMFILE') || 'Gemfile'
end
+ def classpath_file
+ '.jbundler/classpath.rb'
+ end
+
def local_repository
# use maven default local repo as default
@local_maven_repository ||= (jbundler_env('JBUNDLE_LOCAL_REPOSITORY') ||
View
49 lib/jbundler/cli.rb
@@ -0,0 +1,49 @@
+require 'thor'
+module JBundler
+ class Cli < Thor
+ no_tasks do
+ def mvn
+ @mvn ||= Maven::RubyMaven.new
+ end
+ end
+
+ desc 'install', "first `bundle install` is called and then the jar dependencies will be installed. for more details see `bundle help install`, jbundler will ignore all options. the install command is also the default when no command is given."
+ def install
+ require 'jbundler'
+ puts 'Your jbundle is complete! Use `jbundle show` to see where the bundled jars are installed.'
+ end
+
+ desc 'update', "first `bundle update` is called and if there are no options then the jar dependencies will be updated. for more details see `bundle help update`."
+ def update
+ if ARGV.size == 1
+ require 'java'
+ require 'jbundler/aether'
+ config = JBundler::AetherConfig.new
+ FileUtils.rm_f(config.jarfile + '.lock')
+
+ require 'jbundler'
+ puts 'Your jbundle is updated! Use `jbundle show` to see where the bundled jars are installed.'
+ end
+ end
+
+ desc 'show', "first `bundle show` is called and if there are no options then the jar dependencies will be displayed. for more details see `bundle help show`."
+ def show
+ if ARGV.size == 1
+ require 'java'
+ require 'jbundler/aether'
+ require 'jbundler/classpath_file'
+ config = JBundler::AetherConfig.new
+ classpath_file = JBundler::ClasspathFile.new('.jbundler/classpath.rb')#config.classpath_file)
+ if classpath_file.exists?
+ classpath_file.require_classpath
+ puts "JBundler classpath:"
+ JBUNDLER_CLASSPATH.each do |path|
+ puts " * #{path}"
+ end
+ else
+ puts "JBundler classpath is not installed."
+ end
+ end
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.