igor-makarov / xcake

:cake: Describe Xcode projects in a human readable format and (re)generate one on demand.
MIT License
634 stars 48 forks source link

Undefined method `deep_merge` #164

Closed colinta closed 7 years ago

colinta commented 7 years ago

Long time no see! Starting a new toy project, and I'm gonna rely on Xcake again. I just reinstalled, and using Ruby 2.3.1 I got this error right off the bat.

I fixed it locally by adding the deep_merge gem, and this change:

diff --git a/lib/xcake/constants.rb b/lib/xcake/constants.rb
index b123ee7..d41e19b 100644
--- a/lib/xcake/constants.rb
+++ b/lib/xcake/constants.rb
@@ -2,7 +2,7 @@ require 'active_support/core_ext/hash/deep_merge'

 module Xcake
   module Constants
-    COMMON_BUILD_SETTINGS = Xcodeproj::Constants::COMMON_BUILD_SETTINGS.deep_merge(
+    COMMON_BUILD_SETTINGS = Xcodeproj::Constants::COMMON_BUILD_SETTINGS.dup.deep_merge(
       [:ios, :unit_test_bundle] => {
         'LD_RUNPATH_SEARCH_PATHS' => [
           '$(inherited)',
colinta commented 7 years ago

I'll open a PR if you think this is a valid change.

colinta commented 7 years ago

Ah, I see it's required via require 'active_support/core_ext/hash/deep_merge', which I don't have installed. gemspec issue?

colinta commented 7 years ago

Adding require 'active_support/core_ext/hash/deep_merge' to my gem's copy of constants.rb fixes the issue. 0.8.10 should include this fix, whenever it's released.

jcampbell05 commented 7 years ago

Yeah 😀 seemed like I had this gem on my machine because of rails

RikkiGibson commented 7 years ago

Yeah, I found the same thing and sent a PR for it. Looking forward to a release version that incorporates the fix.

I guess in the meantime, I could tell people to install Rails. I don't know a lot about Ruby but it seems strange that installing a web framework would make extra stuff visible to scripts without the appropriate require statements.

leohidalgo commented 7 years ago

Solution?

RikkiGibson commented 7 years ago

It's possible that installing Rails will fix the issue as this doesn't seem to occur in @jcampbell05's environment.

You can refer to this GitHub repo from your Gemfile to get the latest version, which has the fix. https://stackoverflow.com/questions/2577346/how-to-install-gem-from-github-source

You can also forego some of the more recent features (which you may not need) and specify version 0.7.1 when installing.

$ gem install xcake -v 0.7.1