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

Knapsack doesn't work with spring binstubs #54

Open
synth opened this issue Mar 12, 2017 · 6 comments
Open

Knapsack doesn't work with spring binstubs #54

synth opened this issue Mar 12, 2017 · 6 comments
Labels

Comments

@synth
Copy link

synth commented Mar 12, 2017

Our app has binstubs generated by rails/spring in the application root/bin folder. So for example, here is Rails.root/bin/rspec

#!/usr/bin/env ruby
begin
  load File.expand_path('../spring', __FILE__)
rescue LoadError => e
  raise unless e.message.include?('spring')
end
require 'bundler/setup'
load Gem.bin_path('rspec-core', 'rspec')

So, we execute all commands with the bin/ prefix.

bin/rspec spec
bin/rails c

When we run knapsack

bundle exec knapsack:rspec

We get loads of errors, including undefined_method errors

How can we get Knapsack to play nice with our binstubs?

@synth synth changed the title Knapsack doesn't work with binstubs and spring Knapsack doesn't work with spring binstubs Mar 12, 2017
@ArturT
Copy link
Member

ArturT commented Mar 12, 2017

I saw you forked the gem synth@884069c
Does it solve your problem?

@synth
Copy link
Author

synth commented Mar 12, 2017

Yes, it solves it temporarily. Perhaps the rspec command can be parameterized.

@ArturT
Copy link
Member

ArturT commented Mar 12, 2017

In knapsack_pro gem I load the rspec task in a bit different way:
https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/lib/knapsack_pro/runners/rspec_runner.rb

You may want to try the knapsack_pro gem to see if it works better for you.

@ibrahima
Copy link

ibrahima commented Dec 30, 2017

is it possible to try knapsack_pro (just to see if it fixes the issue) without getting a license for it? Why doesn't knapsack free use the same way of loading rake tasks? It'd be nice to make sure that the free version works with spring binstubs too, since it's a fairly common thing.

(I'm having a similar issue and am trying @synth's fork, but it'd be nice to not have to do that)

Ah, bleh, my issue was not resolved by using the fork. So maybe it's a different issue.

Briefly, I have this code

if ENV['UPLOAD_CODECOV']
  require 'simplecov'
  require 'codecov'
  SimpleCov.start 'rails' do
    formatter SimpleCov::Formatter::Codecov
  end

  Rails.application.eager_load!
end

But when I use Knapsack it fails because Rails is undefined.

@ArturT
Copy link
Member

ArturT commented Dec 31, 2017

Hi @ibrahima

is it possible to try knapsack_pro (just to see if it fixes the issue) without getting a license for it?

Sure you can try https://knapsackpro.com for free. The trial is 14 days and days are count only when you use Knapsack Pro API. If you need more time to test it please just drop me an email so I will extend your trial period.

Why doesn't knapsack free use the same way of loading rake tasks?

knapsack gem is older project than knapsack_pro hence the differences.

@ibrahima
Copy link

ibrahima commented Jan 1, 2018

Ah OK, that still didn't resolve my issue, so I think my problem is unrelated to binstubs. I'll open a new issue then.

@ArturT ArturT added the bug label Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants