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

Issue with View Generator #911

Closed
ghost opened this issue Aug 25, 2017 · 12 comments
Closed

Issue with View Generator #911

ghost opened this issue Aug 25, 2017 · 12 comments
Labels

Comments

@ghost
Copy link

ghost commented Aug 25, 2017

The command below throws an error:

rails g kaminari:views

My environment is ruby 2.4.0, rails 5.1.3, and kaminari 1.0.1. The error is as follows:

views_generator.rb:114:in `initialize': No such file or directory @ rb_sysopen

Any thoughts on what could be going on with this?

@ghost
Copy link
Author

ghost commented Aug 25, 2017

Here are the steps that I went through to reproduce the issue in irb (code from kaminari/kaminari-core/lib/generators/kaminari/views_generator.rb)

sha = open('https://api.github.com/repos/amatsuda/kaminari_themes/git/refs/heads/master') do |json|
  puts json.inspect
end

Here, I received the same error: No such file or directory @rb_sysopen. If I do the same code, but first put in

require 'open-uri'

I am able to pull the JSON response. I am not sure if there is a missing dependency, or if I just need to add something to my rails project itself to get the generator to work, though.

@yuki24 yuki24 added the Bug label Aug 25, 2017
@yuki24
Copy link
Member

yuki24 commented Aug 25, 2017

I just confirmed this bug. It seems like there was a dependency in Rails (or related) that required open-uri, but that was removed at some point, but I'm not 100% sure. Either way, this should work out of the box without adding an extra require. Thanks for reporting!

@yuki24
Copy link
Member

yuki24 commented Aug 26, 2017

fixed by #912

@yuki24 yuki24 closed this as completed Aug 26, 2017
@ldco2016
Copy link

ldco2016 commented Sep 12, 2017

Uh, it is not working out of the box. I am getting an error like this:

$ rails g kaminari:views bootstrap4
Running via Spring preloader in process 50187
/Users/danale/.rvm/gems/ruby-2.3.3/gems/kaminari-core-1.0.1/lib/generators/kaminari/views_generator.rb:114:in `initialize': No such file or directory @ rb_sysopen - https://api.github.com/repos/amatsuda/kaminari_themes/git/refs/heads/master (Errno::ENOENT)
	from /Users/danale/.rvm/gems/ruby-2.3.3/gems/kaminari-core-1.0.1/lib/generators/kaminari/views_generator.rb:114:in `open'
	from /Users/danale/.rvm/gems/ruby-2.3.3/gems/kaminari-core-1.0.1/lib/generators/kaminari/views_generator.rb:114:in `get_files_in_master'
	from /Users/danale/.rvm/gems/ruby-2.3.3/gems/kaminari-core-1.0.1/lib/generators/kaminari/views_generator.rb:40:in `themes'
	from /Users/danale/.rvm/gems/ruby-2.3.3/gems/kaminari-core-1.0.1/lib/generators/kaminari/views_generator.rb:29:in `copy_or_fetch'
	from /Users/danale/.rvm/gems/ruby-2.3.3/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
	from /Users/danale/.rvm/gems/ruby-2.3.3/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	from /Users/danale/.rvm/gems/ruby-2.3.3/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all'
	from /Users/danale/.rvm/gems/ruby-2.3.3/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each'

Before you suggest it is the Ruby version. I used this on another application with the same Ruby version and it worked.

@ghost
Copy link
Author

ghost commented Sep 12, 2017

In your Gemfile, are you pulling from the github repo directly? From what I can tell, the rubygem itself has not been updated yet since the version is still 1.0.1, which was the version number before I submitted the PR.

@ldco2016
Copy link

I did a bundle install to this gem:

gem 'kaminari', '~> 1.0', '>= 1.0.1'

@ghost
Copy link
Author

ghost commented Sep 12, 2017

Try changing it to the following:

gem 'kaminari', :git => 'https://github.com/kaminari/kaminari'

From there, re-issue a bundle install.

Edit: fixed the gem line in case someone else reads this.

@ldco2016
Copy link

I get this error when I try that:

r/git/kaminari-d32e1af000a94370fbc9d838bb9891dbd26e08c7" --bare --no-hardlinks --quiet` in directory /Users/danale/Projects/dancortesPortfolio has failed.remote: Not Found
fatal: repository 'https://github.com/kaminari/' not found

Retrying `git clone 'https://github.com/kaminari' "/Users/danale/.rvm/gems/ruby-2.3.3/cache/bundler/git/kaminari-d32e1af000a94370fbc9d838bb9891dbd26e08c7" --bare --no-hardlinks --quiet` due to error (3/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'https://github.com/kaminari' "/Users/danale/.rvm/gems/ruby-2.3.3/cache/bundler/git/kaminari-d32e1af000a94370fbc9d838bb9891dbd26e08c7" --bare --no-hardlinks --quiet` in directory /Users/danale/Projects/dancortesPortfolio has failed.remote: Not Found
fatal: repository 'https://github.com/kaminari/' not found

Retrying `git clone 'https://github.com/kaminari' "/Users/danale/.rvm/gems/ruby-2.3.3/cache/bundler/git/kaminari-d32e1af000a94370fbc9d838bb9891dbd26e08c7" --bare --no-hardlinks --quiet` due to error (4/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'https://github.com/kaminari' "/Users/danale/.rvm/gems/ruby-2.3.3/cache/bundler/git/kaminari-d32e1af000a94370fbc9d838bb9891dbd26e08c7" --bare --no-hardlinks --quiet` in directory /Users/danale/Projects/dancortesPortfolio has failed.remote: Not Found
fatal: repository 'https://github.com/kaminari/' not found

Git error: command `git clone 'https://github.com/kaminari' "/Users/danale/.rvm/gems/ruby-2.3.3/cache/bundler/git/kaminari-d32e1af000a94370fbc9d838bb9891dbd26e08c7" --bare
--no-hardlinks --quiet` in directory /Users/danale/Projects/dancortesPortfolio has failed.

@ghost
Copy link
Author

ghost commented Sep 12, 2017

Sorry, typo:

gem 'kaminari', :git => 'https://github.com/kaminari/kaminari'

@ldco2016
Copy link

that worked @jvsoares , thank you!

@yuki24
Copy link
Member

yuki24 commented Oct 17, 2017

We have just released a new version 1.1.0, which has fixes for this issue. Thanks folks for sticking around!

@maulayyacyber
Copy link

@jvsoares worked

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