---------- Forwarded message ----------
From: Vassilis Rizopoulos <vassilisr...@gmail.com>
Date: Sun, Oct 25, 2009 at 4:42 AM
Subject: Jeweler
To: jo...@technicalpickles.com
Hey Josh,
my name is Vassilis and I'm currently trying to get
webdriver/selenium2.0 in a gem.
I've been looking at putting jeweler to work so I have a list of
issues/questions that might be interesting for you.
Now, our little project pulls the ruby drivers from a repo structure
that has all the webdriver relevant stuff (so we have C, Java, python,
ruby etc) so to build a gem we don't have the files in the usual lib/
bin/ test/ structure.
I actually have the same problem with hoe and I was wondering if you
have any ideas on that. How can I convince jeweler to take for example
common/src/rb/lib/**/*.rb and put it in lib/ on the gem?
It seems to me jeweler is setup to handle pure Ruby projects as it
comes out of the box, so my use case goes way out of the default
conventions - seems to happen to me all the time.
Another wish would be to be able to manage multiple gems in the same
project. Webdriver for example should have one gem pro platform
(windows, macosx, linux) and not pack everything into one gem.
The main hurdle here is basically the rake tasks created. If we could
parametrize that...
And talking about rake tasks, I'll come to the one thing I consider a
bug: The names of the tasks. Naming the task build is limiting the
library to pure Ruby projects. Please consider at least namespacing
the tasks: gem:build or jeweler:build would be fine.
Cheers,
V.-
--
http://www.ampelofilosofies.gr
I'm going to reply in line...
> Now, our little project pulls the ruby drivers from a repo structure that
> has all the webdriver relevant stuff (so we have C, Java, python, ruby etc)
> so to build a gem we don't have the files in the usual lib/ bin/ test/
> structure.
> I actually have the same problem with hoe and I was wondering if you have
> any ideas on that. How can I convince jeweler to take for example
> common/src/rb/lib/**/*.rb and put it in lib/ on the gem?
Let me understand this correctly... you want common/src/rb/lib to show
up in the gem as lib?
The only way I can think of is to have a Rakefile in src/rb with
Jeweler setup, and build the gemspec/gem there. I think that should
work well.
> It seems to me jeweler is setup to handle pure Ruby projects as it comes out
> of the box, so my use case goes way out of the default conventions - seems
> to happen to me all the time.
This is very true. I've not done anything except pure ruby projects,
so my knowledge is kinda lacking for anything beyond that is lacking.
I don't think jeweler entirely precludes the use of native stuff
though. It is working on a gemspec, and the gemspec is where you setup
the extension stuff.
The only thing that is really lacking is out of the box jeweler tasks
for doing this.
> Another wish would be to be able to manage multiple gems in the same
> project. Webdriver for example should have one gem pro platform (windows,
> macosx, linux) and not pack everything into one gem.
I think this should be possible. Jeweler can be configured to have a
different 'base directory'. I'm not sure if the rake tasks expose this
though.
>
> The main hurdle here is basically the rake tasks created. If we could
> parametrize that...
>
> And talking about rake tasks, I'll come to the one thing I consider a bug:
> The names of the tasks. Naming the task build is limiting the library to
> pure Ruby projects. Please consider at least namespacing the tasks:
> gem:build or jeweler:build would be fine.
This makes sense. I could imagine a 'no conflict mode' which prefixes
everything with jeweler. Similarly, could have a custom namespace, as
if, one for each gem...
Let me know how that sounds. If you pointed me at the repo, I could
take a closer look at it.
- Josh
Jeweler::Tasks.new(:namespace => 'my_first_gem', :base_directory =>
'path/to/my_first_gem') do |gemspec|
# the usual stuff here, but it's all relative to path/to/my_first_gem
end
And this would define stuff like... my_first_gem:build,
my_first_gem:release, etc.
- Josh
Also, take a look at the gemspec reference:
http://docs.rubygems.org/read/chapter/20
Specifically, look at require_paths:
http://docs.rubygems.org/read/chapter/20#require_paths
That might go a ways towards helping your setup.
- Josh
I'm pretty sure you're just going to have to copy the files from your
project structure into a temporary gem directory (ie with lib). You
could probably make your own rake tasks to do this, and then make the
jeweler tasks depend on them.
- Josh
Jeweler:Tasks.new(nil,false){...}
Not very nice I must admit, but it serves as a workaround for what I
currently want to do.
Any pointers on how to test this properly?
here's my repo: git://github.com/damphyr/jeweler.git
Create the gem structure I want under tmp/, so tmp/ looks like
tmp/
lib/
webdriver/
...
webdriver.rb
Now if I say gemspec.files=FileList["tmp/lib/**/*"]
the gem ends up with a tmp/ directory.
The only way to work around this is if I say
gemspec.files=FileList["lib/**/*"] and Dir.chdir("tmp/") in the task
that sets up the gem structure - not very nice.
Cheers,
V.-
Yes, it'd still be a problem, but that's why I'm saying Jeweler (the
class) allows you to specify a base directory to work in. It just
needs to be exposed to Jeweler::Tasks.
When you use base_dir, Jeweler does a chdir internally, so that the
file paths are correct. This was mainly done initially for testing,
but now it's useful for your situation.
So, I'd imagine doing this:
Jeweler::Tasks.new :base_dir => 'tmp' do |gemspec|
# snip
gemspec.files = FileList["lib/**/*"]
end
Additionally, I think you'd need a task to prepare your tmp directory,
and you'd need to make the jeweler tasks that deal with the gemspec
depend on it. I'd imagine something like...
task :prepare_tmp do
# copy stuff
end
namespace :gemspec do
task :debug => :prepare_tmp
task :build => :prepare_tmp
end
I don't think any others would need it, but that's just what I can
think of off the top of my head.
Hope that helps a bit.
- Josh