jruby-gradle / jruby-gradle-plugin

A Gradle plugin for working with JRuby projects for fun and profit. Mostly profit.
http://jruby-gradle.org
Other
93 stars 38 forks source link

how to pull passed in gem strings #312

Open amiracam opened 7 years ago

amiracam commented 7 years ago

forgive my gradle newbieness, been walking thru the code but just could not figure out how to do the following

given:

jrubyJar "rubygems:colorize:0.7.7+" jrubyJar "rubygems:sequel:5.0.0" jrubyJar "rubygems:redis:4.0.0" jrubyJar 'org.slf4j:slf4j-simple:1.7.25' jrubyJar 'io.ratpack:ratpack-base:1.5.0' jrubyJar 'io.ratpack:ratpack-core:1.5.0' jrubyJar 'io.ratpack:ratpack-exec:1.5.0' jrubyJar 'org.slf4j:slf4j-simple:1.7.25'

I want to create a task where I can retrieve the passed in strings to "jrubyJar" , ideally those prefixed by "rubygems:" and subsequently pass those to a ruby script

thanks

ysb33r commented 7 years ago

Not sure what you want to achieve? Do you actually want to build a JRUby-based jar or do you want to run a Ruby script where the passed parameters are from a specfic configuration of dependencies?

amiracam commented 7 years ago

the latter, but I do count on prepareJrubyJar to run which is why I have a dependsOn to it, I basically have hacked a tenable integration with Intellij IDEA, which for now relies on the prepareJrubyJar task running after which I currently scan the build directories for the jars and gems and based on that I generate a .idea/libraries/.xml file with the respective jar l.ocal path, I also generate a Gemfile, IDEA Jruby projects have a file watcher that once they detect a Gemfile or modification IDEA runs a scan and updates its internal config files i.e. as far as Ruby.

To clarify, the steps are for "setupIDEA"

  1. do clean up
  2. copyJrubyJars
  3. generate IDEA jar library definition file
  4. generate Gem file

currently counting on the IDEA .iml file having a specific entry i.e. have not gotten yet around to modifying said IDEA config

So I was hoping to grab the gem names / versions and the Jar specifications from Gradle and pass these to the ruby script instead of what I do right now which is to scan over directories and based on the naming of folders and files retrieve the desired information.

What I have works but I would like to understand Gradle a bit better and obviously passing into the ruby scripts the dependency specs is much cleaner.

This morning I figured I could do as follows:

task testScan(type: JRubyExec){ script 'scripts/retrieveSpecs.rb' scriptArgs configurations.jrubyJar.dependencies.collect {"{\"name\":\"${it.name}\" , \"group\": \"${it.group}\", \"version\": \"${it.version}\"}"} }

I then can collect my rubygems group and generate the Gemfile from that and generate the IDEA Jar library configuration from the rest.

Please do suggest what could make this cleaner, thanks

ysb33r commented 7 years ago

You are on the right track now. I was going to suggest to you to learn about configurations, but I see you have discovered enough to get you going.

amiracam commented 7 years ago

yes, I probably should spend more time learning Gradle :) just swamped with building product

amiracam commented 5 years ago

hi, its been a while, I had to drop my efforts back then and concentrate on Groovy, is the Jruby Gradle plugin now more tightly integrated with IDEA ? thanks

ysb33r commented 5 years ago

Not so sure how integrated it is, but it is swiflty evolving into much better functionality.

amiracam commented 5 years ago

Ok, I’ll check it out again

Charles A. Monteiro Chief Technology Officer Web: www.tradeblazer.com

On Jun 11, 2019, 5:55 PM -0400, Schalk W. Cronjé notifications@github.com, wrote:

Not so sure how integrated it is, but it is swiflty evolving into much better functionality. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.