CocoaPods-app icon indicating copy to clipboard operation
CocoaPods-app copied to clipboard

Use bundled Gems defined within a Gemfile

Open orta opened this issue 8 years ago • 8 comments

I've got most of the way.

  • [x] Find out how to use host env's bundler ( or install bundler? )
  • [ ] Get the gems actually installing, e.g. deal with circular references

orta avatar Dec 29 '15 12:12 orta

Currently stuck figuring out how to deal with the circular references for CP and plugins depending on it.

[12:21:51] [Gems] destroot/bundle/bin/bundle-env gem install workbench/ruby/2.1.0/bundler/gems/CocoaPods-3cf3dbcde978/cocoapods-0.39.0.gem workbench/ruby/2.1.0/bundler/gems/CocoaPods-db93068587f0/cocoapods-0.39.0.gem workbench/ruby/2.1.0/bundler/gems/cocoapods-deintegrate-160752789024/cocoapods-deintegrate-0.2.1.gem workbench/ruby/2.1.0/bundler/gems/Core-9fd6c128f989/cocoapods-core-0.39.0.gem workbench/ruby/2.1.0/bundler/gems/Core-e5b64946f634/cocoapods-core-0.39.0.gem workbench/ruby/2.1.0/bundler/gems/Xcodeproj-ffeadb7ca0ed/xcodeproj-0.28.2.gem workbench/ruby/2.1.0/cache/activesupport-4.2.5.gem workbench/ruby/2.1.0/cache/claide-0.9.1.gem workbench/ruby/2.1.0/cache/cocoapods-downloader-0.9.3.gem workbench/ruby/2.1.0/cache/cocoapods-keys-1.6.0.gem workbench/ruby/2.1.0/cache/cocoapods-plugins-0.4.2.gem workbench/ruby/2.1.0/cache/cocoapods-search-0.1.0.gem workbench/ruby/2.1.0/cache/cocoapods-stats-0.6.2.gem workbench/ruby/2.1.0/cache/cocoapods-trunk-0.6.4.gem workbench/ruby/2.1.0/cache/cocoapods-try-0.5.1.gem workbench/ruby/2.1.0/cache/colored-1.2.gem workbench/ruby/2.1.0/cache/dotenv-2.0.2.gem workbench/ruby/2.1.0/cache/escape-0.0.4.gem workbench/ruby/2.1.0/cache/fuzzy_match-2.0.4.gem workbench/ruby/2.1.0/cache/i18n-0.7.0.gem workbench/ruby/2.1.0/cache/json-1.8.3.gem workbench/ruby/2.1.0/cache/minitest-5.8.3.gem workbench/ruby/2.1.0/cache/molinillo-0.4.0.gem workbench/ruby/2.1.0/cache/nap-1.0.0.gem workbench/ruby/2.1.0/cache/netrc-0.7.8.gem workbench/ruby/2.1.0/cache/osx_keychain-1.0.1.gem workbench/ruby/2.1.0/cache/RubyInline-3.12.4.gem workbench/ruby/2.1.0/cache/thread_safe-0.3.5.gem workbench/ruby/2.1.0/cache/tzinfo-1.2.2.gem workbench/ruby/2.1.0/cache/ZenTest-4.11.0.gem --no-document --env-shebang
ERROR:  While executing gem ... (Gem::Resolver::Molinillo::CircularDependencyError)
    There is a circular dependency between cocoapods-deintegrate and cocoapods

orta avatar Dec 29 '15 12:12 orta

Issue may just be rubygems not being smart about installing them all at once :( May need to install them in topological order?

segiddins avatar Dec 29 '15 14:12 segiddins

@segiddins - is there an easy way to get the topological order of the gems? ( e.g. could I ask bundler "make the "cocoapods" gem dep tree" then go from the leafs of the dep tree and do a depth first approach? )

orta avatar Apr 03 '16 09:04 orta

@orta yes. Bundler.definition.specs.to_a should do it if I'm remembering correctly. Rainforest also has a task for that.

segiddins avatar Apr 03 '16 14:04 segiddins

Interesting, I think I have a newer version of bundler, and now I don't have the issues around topological installs

orta avatar Apr 09 '16 11:04 orta

@segiddins - I'm a tough point, where I'm not 100% sure if I've hit a bundler bug

$ rake app:prerequisites

[09:01:48] [Submodules] /usr/bin/git submodule update --init --recursive
[09:01:49] [ruby-2.2.3] cd workbench/ruby-2.2.3 && /usr/bin/make install
[... a totally blank ruby is installed]

# installed bundler inside the new hosted ruby env
[09:01:59] [bundling] destroot/bundle/bin/bundle-env gem install bundler --verbose

# Use the new bundler to install our gems
[09:02:03] [bundling] destroot/bundle/bin/bundle install --gemfile bundled-Gemfile

# I get a bunch of these errors:

Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring json-1.8.2 because its extensions are not built.  Try: gem pristine json --version 1.8.2
Ignoring json-1.7.7 because its extensions are not built.  Try: gem pristine json --version 1.7.7
Ignoring kgio-2.9.2 because its extensions are not built.  Try: gem pristine kgio --version 2.9.2

# Then is starts downloading

Fetching https://github.com/CocoaPods/CocoaPods.git
Fetching https://github.com/CocoaPods/Core.git
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Installing i18n 0.7.0
Installing json 1.8.3 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

# Showing this error:

    current directory: /Users/orta/dev/mac/apps/CocoaPods-app/path/ruby/2.2.0/gems/json-1.8.3/ext/json/ext/generator
/Users/orta/dev/mac/apps/CocoaPods-app/destroot/bundle/bin/ruby -r ./siteconf20160410-46161-ao5uqb.rb extconf.rb
/Users/orta/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/source/git/git_proxy.rb:183:in `allowed_in_path': The git source https://github.com/CocoaPods/CocoaPods.git is not yet checked out. Please run `bundle install` before trying to start your application (Bundler::GitError)
    from /Users/orta/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/source/git/git_proxy.rb:47:in `revision'
    from /Users/orta/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/source/git.rb:215:in `revision'
    from /Users/orta/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/source/git.rb:87:in `install_path'
    from /Users/orta/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/source/path.rb:110:in `expanded_path'

The error message is weird though, it's the JSON gem failing, but then the message talks about how CocoaPods cannot be checked out, even though it was a few lines above, can you think if I'm doing anything odd?

orta avatar Apr 10 '16 08:04 orta

( sorry sent the message early, wrapped it up in an edit )

I wonder if it's using one bundler environment, then jumping to another, might try a different idea

orta avatar Apr 10 '16 08:04 orta

@orta that won't really happen, bundler basically just uses a single definition. If it's telling you something isn't checked out, you might need to add a resolve_remotely! to the definition to make it update the cached git repo.

segiddins avatar Apr 10 '16 17:04 segiddins