davetron5000 / optparse-plus

Start your command line scripts off right in Ruby
http://davetron5000.github.com/optparse-plus
Apache License 2.0
521 stars 54 forks source link

Gems dependencies not resolving #100

Closed munjeli closed 6 years ago

munjeli commented 8 years ago

Yup, more issues with your gem dependencies. Methadone didn't run out of the box when I used the default Ruby on Ubuntu 14.04 nor did it run with Ruby 2.1 and upgraded rubygems. The most recent error was:

rake aborted! cannot load such file -- cucumber /home/foo/Rakefile:31:in `<top (required)>' (See full trace by running task with --trace) Run options: --seed 58522

Running tests:

Finished tests in 0.000257s, 0.0000 tests/s, 0.0000 assertions/s.

0 tests, 0 assertions, 0 failures, 0 errors, 0 skips

Sadly, I'm just going to move to another tool as there seems to be several issues around gem dependencies and I don't have time to work it out. Let me know if you want to support Ubuntu and I'll try to run your code on my next build.

davetron5000 commented 8 years ago

Is this after cloning the repo and trying to run tests, or is this after doing a gem install of methadone and creating a new methadone-powered app?

I just did a clean install into an empty gemset, created a new app, and tests ran:

> rvm use --create 2.1@methadone-test
> gem install methadone
> methadone test_app
> cd test_app
> bundle install
> bundle exec rake
Run options: 

# Running tests:

Finished tests in 0.007951s, 125.7703 tests/s, 125.7703 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips

ruby -v: ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-darwin14.0]
Feature: My bootstrapped app kinda works
  In order to get going on coding my awesome app
  I want to have aruba and cucumber setup
  So I don't have to do it myself

  Scenario: App just runs
    When I get help for "test_app"
    Then the exit status should be 0
    And the banner should be present
    And the banner should document that this app takes options
    And the following options should be documented:
      | --version |
    And the banner should document that this app takes no arguments

1 scenario (1 passed)
6 steps (6 passed)
0m0.442s

If it's not finding cucumber, it's likely because the gem isn't installed or isn't installed somewhere that Ruby can find it when running bundle install rake.

davetron5000 commented 8 years ago

FWIW, the build runs on “Ubuntu 12.04 LTS Server Edition 64 bit” so my expectation is that this gem works on Ubuntu (though I can't test it other than running tests in Travis)

munjeli commented 8 years ago

Here's the first error, on a clean pull of Ubuntu 14.04 with no updates:

root@8923e04ba872:/meth#  methadone --readme --license apache fullstop
stdout output of 'bundle gem fullstop --no-color': Creating gem 'fullstop'...
--- ERROR REPORT TEMPLATE -------------------------------------------------------
- What did you do?

  I ran the command `/usr/local/bin/bundle gem fullstop --no-color`

- What did you expect to happen?

  I expected Bundler to...

- What happened instead?

  Instead, what actually happened was...

Error details

    Errno::ENOENT: No such file or directory - git config user.name
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/cli/gem.rb:32:in ``'
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/cli/gem.rb:32:in `run'
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/cli.rb:370:in `gem'
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/cli.rb:10:in `start'
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/exe/bundle:19:in `block in <top (required)>'
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/lib/bundler/friendly_errors.rb:7:in `with_friendly_errors'
      /var/lib/gems/1.9.1/gems/bundler-1.11.2/exe/bundle:17:in `<top (required)>'
      /usr/local/bin/bundle:23:in `load'
      /usr/local/bin/bundle:23:in `<main>'

Environment

    Bundler   1.11.2
    Rubygems  1.8.23
    Ruby      1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
    Git       not installed
--- TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=No+such+file+or+directory+-+git+config+user.name&type=Issues

If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/bundler/bundler/issues/new
Error running 'bundle gem fullstop --no-color'
Command 'bundle gem fullstop --no-color' exited 1
munjeli commented 8 years ago

I did gem install methadone and methadone --readme --license apache fullstop

davetron5000 commented 8 years ago

Methadone uses bundler to set up a new project, as it's common in Ruby land to create new gems with bundle gem. Methadone does that, and then adds a few things to your gem. bundler assumes you a) want to use git and b) have git setup.

Presumably you don't have git installed or set up?

FWIW, the test suite runs exactly what you ran, on whatever Ubuntu box Travis sets up, so I think this is a matter of your environment not having git installed (which I agree is a silly dependency for this gem to have).

munjeli commented 8 years ago

I didn't on this machine, but I did on the first one. However, if git is a dependency, you should probably document that, if you haven't. Git is on all of the servers I build for work.

The problem I have here is that I can walk you through any setup on any os; I'm a DevOps engineer doing test driven infrastructure. But I don't have time.

If you're serious about supporting this gem, I can try and contribute tests (a simple chef cookbook could test your install on everything, and run in Docker, Vagrant whatever) at some point, but I'd need to know what you hope to support, and whether this gem is going to be developed further.

Also didn't work on Fedora 23. If you want to keep supporting Ubuntu, I'd just go for 16.04 at this point.

davetron5000 commented 8 years ago

This is really surprising to me because the gem has only a runtime dependency on bundler, which itself requires git (though my guess is that either the package you used to install bundler wasn't configured properly to require git or you used RubyGems [which is sensible] and it cannot programmatically require non-RubyGems).

I would also not expect someone to be doing actual development work using this gem inside a container that wasn't set up with "normal" Ruby development tools like a ruby version manager, bundler, and git.

This is a long way of saying two things, I think:

munjeli commented 8 years ago

I can make a simple chef cookbook using the gem resource and bash resource . You can run tests with docker or vagrant with Kitchen, and these tests of a simple install would be just kitchen converge. A great list of available vagrant boxes for Kitchen tests is at bento

Decide what you want to support (in terms of os) and I'll slap out a cookbook you can pull in on a branch to see what currently works. I'll also install git using the package resource as a dependency.

There's been a few issues around gem dependencies with this project, and I can't believe it's always user error. At best, there's a glitch in your documentation and users don't have all they need to install. A cli framework like this is a valuable contribution to open source, if it works. I'm willing to contribute some tests to help you get to a more robust install.

I can't make this part of my workday, it's not a dependency of the project, but I'll try and squeeze out some time after hours.

davetron5000 commented 8 years ago

The chef stuff is a bit over my head, and it's not the way my brain currently things about CI (also not sure I've seen many other RubyGems use chef or a container technology for running tests). At any rate, if you want to contribute something and it's easy enough for me to figure out, I'm game.

Curious about "a few issues around gem dependencies with this project". What issues? This is the first I've heard of someone having trouble here other than #85 which is due to a bug in a very old version of RubyGems on a long-unsupported version of Ruby.

munjeli commented 8 years ago

99 is also an issue around aruba I think which is the first error I saw. The bundle install didn't seem to pull down the requisite gems. I spent half a day trying to get it to work on my own dev vm (which is ubuntu 1404) and my personal machine (fedora 23). I haven't seen it install and run correctly yet.

As an infrastructure engineer I do a lot of work on clean machines, and there's a glitch someplace in your setup I reckon, but this kind of thing can be hard to diagnose. What you consider 'a standard Ruby dev environment' is not really a safe assumption. It would be good to have a sure list of your deps.

I'm engineering 12factor apps which is a kind of CI where I build the entire server to push a code change, and deploy with end to end automation. It's especially good for high security environments and scaling. There's no assured setup, only the necessary deps are there. For sure, it's a progressive strategy, but we make a LOT of CLIs in DevOps land, so it would be nice to have some more options. I like Methadone because it's designed to scaffold the app and it's fairly up to date compared with other options. CLIs are used for automation since it's easy to step in and debug an app you can run on the command line when automation fails.

I can make it easy to see where your app is failing, but I'm not sure I can help you discover the deps that actually make it run - that's an issue on the instances where it does run :)

davetron5000 commented 8 years ago

Yeah, I'm guessing I can fix whatever the issues are the come up, if I can reproduce them, but I honestly hadn't thought anyone would be doing development on clean machines outside of an rvm/bundler type situation that most Rails developer use. Then again, that's what's happening in #99 and it's super confusing to me because they have the same set up that I do and are seeing different behavior.

But you are right, there's something fishy. The confluence of Aruba, Bundler, and $ruby_manager is a constant source of headaches, since each thing is manipulating $PATH and the various Ruby library paths (which RubyGems also manipulates after installation). Now I see why Heroku bundles an entire Ruby with their application.

I feel like if we both had more free time we could make progress on this, but I'd be starting from near 0 on container-based stuff. Would the starting point be to take some standard Docker image, install Ruby, Bundler, Git, and methadone on it and see what happens?

munjeli commented 8 years ago

Are you on Mac OSX, Windoze, or some kind of Linux?

Setting up a Mac for Docker can be kind of messy, I think Vagrant is often preferred.

Yup, infrastructure development happens ideally on clean machines. I control the dependency tree for entire environments, including the upgrade path. One must rule dependencies even in dev with an iron fist. Accidentally injecting deps or upgrading are common issues when dev is carried out in personal boxes. This is actually a pretty familiar scenario.

Its notable I also launched this on canonical's ec2 ubuntu as I'm in the process of building an aws cloud, but if a kitchen test passes in docker or vagrant it will probably run there.

munjeli commented 8 years ago

Update: I have this working now on Fedora 23 - the gems installed in /home/$USER/bin and once I fixed my path, everything worked. I can try to set that as an auto install with Chef on RHEL and it should be fine; I'll test it and let you know.

The issue on Ubuntu is different though, so I'll keep trying to figure that out.

davetron5000 commented 6 years ago

Closing as partially resolved (and pretty old). If there is still an issue, please open a new issue with the current state of the problem