Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move dependencies to calendarium-romanum.gemspec #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mkasberg
Copy link
Contributor

@mkasberg mkasberg commented Oct 2, 2019

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.

I'm trying to set up a development environment for calendarium-romanum
and manage my gem dependencies with [Bundler](https://bundler.io/). 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](https://bundler.io/v2.0/guides/creating_gem.html) 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
Copy link
Contributor Author

mkasberg commented Oct 2, 2019

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

@igneus
Copy link
Owner

igneus commented Oct 2, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants