diff --git a/lib/gel/environment.rb b/lib/gel/environment.rb index 47faa96..305514c 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 ee8031b..8a94c70 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 28a6938..9cdb2e3 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 = <