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

Error installing Rainforest (file.metas['link']) #13

Closed
AliSoftware opened this issue May 13, 2014 · 19 comments
Closed

Error installing Rainforest (file.metas['link']) #13

AliSoftware opened this issue May 13, 2014 · 19 comments

Comments

@AliSoftware
Copy link
Contributor

There is an error in the Rakefile@L417

file.metas['link'].first ➡️ Undefined method metas for #<Tempfile>

I just freshly cloned the repo, did execute rvm gemset create rainforest to have a clean gemset to start from, then followed the README instructions.

$ rvm current
ruby-2.0.0-p353@rainforest
$ rake --trace bootstrap
** Invoke bootstrap (first_time)
** Execute bootstrap
/Users/olivier/.rvm/gems/ruby-2.0.0-p353@global/bin/bundler
** Invoke clone (first_time)
** Execute clone

--------------------------------------------------------------------------------
Fetching repositories list
--------------------------------------------------------------------------------
rake aborted!
undefined method `metas' for #<Tempfile:0x00000101a959c8>
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:417:in `block in fetch_repos'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:412:in `loop'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:412:in `fetch_repos'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:398:in `fetch_default_repos'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:48:in `block in <top (required)>'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:228:in `call'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:228:in `block in execute'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:223:in `each'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:223:in `execute'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:159:in `invoke_with_call_chain'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:152:in `invoke'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:35:in `block in <top (required)>'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:228:in `call'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:228:in `block in execute'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:223:in `each'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:223:in `execute'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:159:in `invoke_with_call_chain'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/task.rb:152:in `invoke'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/application.rb:143:in `invoke_task'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/application.rb:101:in `block (2 levels) in top_level'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/application.rb:101:in `each'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/application.rb:101:in `block in top_level'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/application.rb:110:in `run_with_threads'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/application.rb:95:in `top_level'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/application.rb:73:in `block in run'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/rake/application.rb:70:in `run'
/Users/olivier/.rvm/rubies/ruby-2.0.0-p353/bin/rake:37:in `<main>'
Tasks: TOP => clone
@alloy
Copy link
Member

alloy commented May 14, 2014

Can you try it without RVM and gemsets? There shouldn’t be a need for this, especially as you’re not doing any other Ruby dev, right?

@AliSoftware
Copy link
Contributor Author

This doesn't change anything.

$ rvm current
system
$ rake bootstrap
/usr/bin/bundler

--------------------------------------------------------------------------------
Fetching repositories list
--------------------------------------------------------------------------------
rake aborted!
NoMethodError: undefined method `metas' for #<Tempfile:0x007faee8884b10>
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:417:in `block in fetch_repos'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:412:in `loop'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:412:in `fetch_repos'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:398:in `fetch_default_repos'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:48:in `block in <top (required)>'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:35:in `block in <top (required)>'
Tasks: TOP => clone
(See full trace by running task with --trace)

@AliSoftware
Copy link
Contributor Author

FYI:

$ gem list

*** LOCAL GEMS ***

activesupport (3.2.17, 3.2.16)
addressable (2.3.6)
ast (1.1.0)
bacon (1.2.0)
bigdecimal (1.2.0)
bundler (1.6.2)
CFPropertyList (2.2.6, 2.2.0)
claide (0.5.0, 0.4.0)
cocoapods (0.32.1, 0.29.0)
cocoapods-core (0.32.1, 0.29.0)
cocoapods-downloader (0.5.0, 0.3.0)
cocoapods-plugins (0.1.1, 0.1.0)
cocoapods-try (0.2.0)
cocoapods-try-release-fix (0.1.2, 0.1.1)
colored (1.2)
coveralls (0.7.0)
crack (0.4.2)
docile (1.1.3)
escape (0.0.4)
fuzzy_match (2.0.4)
i18n (0.6.9)
io-console (0.4.2)
json (1.8.1, 1.7.7)
json_pure (1.8.1)
libxml-ruby (2.7.0, 2.6.0)
metaclass (0.0.4)
mime-types (2.2)
mini_portile (0.5.2)
minitest (4.3.2)
mocha (1.0.0)
mocha-on-bacon (0.2.2)
multi_json (1.9.2, 1.8.2)
nap (0.7.0, 0.6.0)
nokogiri (1.6.1, 1.5.6)
open4 (1.3.3, 1.3.0)
parser (2.1.7)
powerpack (0.0.9)
prettybacon (0.0.1)
psych (2.0.0)
rainbow (2.0.0)
rake (10.2.2, 10.1.1, 0.9.6)
rdoc (4.0.0)
rest-client (1.6.7)
rubocop (0.20.1, 0.20.0)
ruby-progressbar (1.4.2)
rubygems-update (2.2.2)
safe_yaml (1.0.2)
simplecov (0.8.2)
simplecov-html (0.8.0)
slop (3.5.0)
sqlite3 (1.3.8, 1.3.7)
term-ansicolor (1.3.0)
test-unit (2.0.0.0)
thor (0.19.1)
tins (1.1.0)
webmock (1.17.4)
xcodeproj (0.16.1, 0.14.1)

@alloy
Copy link
Member

alloy commented May 14, 2014

Looking at the API for OpenURI, it seems the method is misspelled. It should probably be just meta: http://apidock.com/ruby/OpenURI/Meta (the header fields).

@AliSoftware
Copy link
Contributor Author

Progress.

$ sed -n 417p Rakefile 
    link = file.meta['link'].first
$ rake bootstrap
/usr/bin/bundler

--------------------------------------------------------------------------------
Fetching repositories list
--------------------------------------------------------------------------------
rake aborted!
NoMethodError: undefined method `first' for #<String:0x007fdf018977f8>
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:417:in `block in fetch_repos'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:412:in `loop'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:412:in `fetch_repos'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:398:in `fetch_default_repos'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:48:in `block in <top (required)>'
/Users/olivier/Documents/Dev/GitHub/Rainforest/Rakefile:35:in `block in <top (required)>'
Tasks: TOP => clone
(See full trace by running task with --trace)

@alloy
Copy link
Member

alloy commented May 14, 2014

Hrmm, I have the feeling that the objects returned by OpenURI might have different APIs on different Ruby versions. @irrationalfab can you confirm?

In this case, assuming that @irrationalfab confirms that on other Ruby versions this does return an Array, it would have to be made compatible with all. I think this should help:

link = Array(file.meta['link']).first

The Kernel::Array() method wraps an object in an array, unless it’s already an Array.

@AliSoftware
Copy link
Contributor Author

This seems to work, the rake script is cloning repos right now!

$ sed -n 417p Rakefile 
    link = Array(file.meta['link']).first
$ ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]

@alloy
Copy link
Member

alloy commented May 14, 2014

Ok, let’s see what @irrationalfab says about why the code is as it is right now and then patch it accordingly.

@AliSoftware
Copy link
Contributor Author

$ ri OpenURI::Meta#meta
 = OpenURI::Meta#meta

(from ruby core)
------------------------------------------------------------------------------

returns a Hash that represents header fields. The Hash keys are downcased for
canonicalization.

I believe that if there is only one header of a given header key (like link), it returns an String, and only returns an array if there are multiple values for the same header. But I'll wait for @irrationalfab validation before pushing the fix.

@AliSoftware
Copy link
Contributor Author

Something strange about this Rakefile anyway:

  • The first time I tried to rake bootstrap, it stopped asking me to manually install bundler

  • So I did some sudo gem install bundler (even if I found it strange as I believe the gem was already installed) and ran rake bootstrap again

  • But then after cloning all the repositories, it failed on this:

    gem install bundler
    ERROR:  While executing gem ... (Gem::FilePermissionError)
    
  • So I sudo rake bootstrap to workaround the permission error, which did the trick but showed me this warning:

    gem install bundler
    Successfully installed bundler-1.6.2
    Parsing documentation for bundler-1.6.2
    1 gem installed
    bundle install
    Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
    installing your bundle as root will break this application for all non-root
    users on this machine.
    

Seems strange that even if I manually installed bundler explicitly before running rake, it tried to install it again, right?

@alloy
Copy link
Member

alloy commented May 14, 2014

One of the repos Rakefile’s is probably trying to install Bundler as part of rake bootstrap which should not be done. It has to be installed manually before running rake bootstrap. Can you figure out which repo it is?

@AliSoftware
Copy link
Contributor Author

Will try, but am a bit lost with all this code in multiple Rakefiles and all the repos 😉

If it helps, this was in the "Installing gems" section of the output:

[...]
Cloning cocoapods-plugins
Already cloned

Cloning shared
Already cloned

--------------------------------------------------------------------------------
Bootstrapping all the repositories
--------------------------------------------------------------------------------

Bootstrapping CLAide/
rake --no-search bootstrap

--------------------------------------------------------------------------------
Installing gems
--------------------------------------------------------------------------------

gem install bundler
[...]

@alloy
Copy link
Member

alloy commented May 14, 2014

There we go, it’s in the CLAide Rakefile: https://github.com/CocoaPods/CLAide/blob/master/Rakefile#L8.

@AliSoftware
Copy link
Contributor Author

@AliSoftware
Copy link
Contributor Author

Damn you shot first 😆

@alloy
Copy link
Member

alloy commented May 14, 2014

👯

So yeah, it probably use a check like this repo’s Rakefile has and print an error to install bundler. In any case, it should not try to install bundler.

@AliSoftware
Copy link
Contributor Author

Just FYI, once I manually fixed both:

  • line 417 of Rainforest's Rakefile
  • the bootstrap task of CLAide's Rakefile to remove the sh gem install bundle line (but keep sh bundle install line)

I was finally able to complete the installation, confirmed by running CocoaPods/bin/pod --help

This still needs some official fix though

@AliSoftware AliSoftware changed the title Error installing Rainforest Error installing Rainforest (file.metas['link']) May 15, 2014
AliSoftware added a commit that referenced this issue May 16, 2014
Fix for #13 - file.metas['link']
@AliSoftware
Copy link
Contributor Author

Fixed by 4a8fac0

@fabiopelosin
Copy link
Member

👍

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

No branches or pull requests

3 participants