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

NEW: Added github git source #45

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/gel/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/gel/gemfile_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
55 changes: 55 additions & 0 deletions test/resolve_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <<GEMFILE
source "https://gem-mimer.org"

gem "activerecord"
gem "example-ruby-gem", github: "jsyeo/example-ruby-gem", branch: "master"
GEMFILE

stub_gem_mimer

assert_equal <<LOCKFILE, lockfile_for_gemfile(gemfile)
GIT
remote: https://github.com/jsyeo/example-ruby-gem
revision: 59d40dc55382c9df042ef56ea6a1b4eeaddf929c
branch: master
specs:
example-ruby-gem (0.1.0)

GEM
remote: https://gem-mimer.org/
specs:
activemodel (5.2.2)
activesupport (= 5.2.2)
activerecord (5.2.2)
activemodel (= 5.2.2)
activesupport (= 5.2.2)
arel (>= 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 = <<GEMFILE
source "https://gem-mimer.org"
Expand Down