From 7057fc32cc3729625b1035bc369d42d8bdd9025a Mon Sep 17 00:00:00 2001 From: Tim Lange Date: Thu, 25 Apr 2019 21:48:36 +0200 Subject: [PATCH] NEW: Added github git source --- lib/gel/environment.rb | 8 ++++++ lib/gel/gemfile_parser.rb | 2 +- test/resolve_test.rb | 55 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/lib/gel/environment.rb b/lib/gel/environment.rb index 47faa965..305514cb 100644 --- a/lib/gel/environment.rb +++ b/lib/gel/environment.rb @@ -163,6 +163,14 @@ def self.lock(store: store(), output: nil, gemfile: Gel::Environment.load_gemfil else [o[:git], :ref, o[:ref]] end + elsif o[:github] + if o[:branch] + ["https://github.com/" + o[:github], :branch, o[:branch]] + elsif o[:tag] + ["https://github.com/" + o[:github], :tag, o[:tag]] + else + ["https://github.com/" + o[:github], :ref, o[:ref]] + end end }.compact.uniq diff --git a/lib/gel/gemfile_parser.rb b/lib/gel/gemfile_parser.rb index ee8031b4..8a94c704 100644 --- a/lib/gel/gemfile_parser.rb +++ b/lib/gel/gemfile_parser.rb @@ -122,7 +122,7 @@ def flatten(options, stack) def add_gem(name, requirements, options) return if name == "bundler" - raise "Only git sources can specify a :branch" if options[:branch] && !options[:git] + raise "Only git sources can specify a :branch" if options[:branch] && !options[:git] && !options[:github] raise "Duplicate entry for gem #{name.inspect}" if @gems.assoc(name) @gems << [name, requirements, options] diff --git a/test/resolve_test.rb b/test/resolve_test.rb index 28a69386..9cdb2e35 100644 --- a/test/resolve_test.rb +++ b/test/resolve_test.rb @@ -462,6 +462,61 @@ def test_git_gems_get_considered_too end end + def test_github_is_automatic_git_source + skip if ENV["CI"] # FIXME + + Dir.mktmpdir do |shush_dir| + + gemfile = <= 9.0) + activesupport (5.2.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (9.0.0) + concurrent-ruby (1.1.4) + i18n (1.3.0) + concurrent-ruby (~> 1.0) + minitest (5.11.3) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + activerecord + example-ruby-gem +LOCKFILE + end + end + def test_conflicting_version_constraints gemfile = <