igneus / calendarium-romanum

liturgical calendar library (Roman Catholic, post-Vatican II)
50 stars 21 forks source link

Move dependencies to calendarium-romanum.gemspec #45

Open mkasberg opened 4 years ago

mkasberg commented 4 years ago

I'm trying to set up a development environment for calendarium-romanum and manage my gem dependencies with Bundler. So, I'd like to be able to do something like bundle install --path vendor/bundle followed by bundle exec calendariumrom. Currently, this doesn't work because even after running bundle install, it does not know about the calendarium-romanum gem itself.

In looking for the solution to this, I found this page in the Bundler docs. It notes that the Gemfile:

contains a gemspec line meaning that Bundler will include dependencies specified in foodie.gemspec too. It’s best practice to specify all the gems that our library depends on in the gemspec.

Additionally,

Bundler detects our gem, loads the gemspec and bundles our gem just like every other gem.

So, I've added a gemspec line to Gemfile. Then, I moved dependencies to calendarium-romanum.gemspec.

Before:

$ bundle install --path vendor/bundle
Bundle complete! 9 Gemfile dependencies, 33 gems now installed.
Bundled gems are installed into `./vendor/bundle`
$ bundle exec calendariumrom
bundler: command not found: calendariumrom
Install missing gem executables with `bundle install`

After:

$ bundle install --path vendor/bundle
Using calendarium-romanum 0.5.0 from source at `.`
Bundle complete! 7 Gemfile dependencies, 34 gems now installed.
Bundled gems are installed into `./vendor/bundle`
$ bundle exec calendariumrom
Commands:
  ...

Supporting this workflow should make it easier for other developers to run the gem after building it themselves, which should make it easier to test, develop, and contribute.

mkasberg commented 4 years ago

Let me know what you think about this - happy to consider other options if you're not a fan of this solution!

igneus commented 4 years ago

This will take me some time to digest - I don't know yet how much I am/am not a fan of this. Will have to read a bit on both Rubygems and Bundler.

As for development setup for testing the executable, I haven't tested it much recently, but when I do, I bundle exec ruby -Ilib bin/calendariumrom.