mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Refactored load_gems.rb to be simpler and easier to understand:
- Converted LoadGems::load_special_path_gems() into a class, then subdivided the various types of gem dependencies into smaller private methods. - Added class GemDepDetails to hold the relationship between a gem's location on the local disk and its upstream repository. This will be used later. - Removed the last remains of the '--pull-gems' option from the code base and documentation. This is no longer present and the dead code is clutter. Gracefully handle the case where multiple gems use the same git checkout path. Previously, if two gems had the same directory name when cloning them from git, mrbgems would assume they were the same gem. This also applied to different branches and/or commits of the same repository. This led to a strange situation where the first `conf.gem` statement "won" in cloning the repository but the last `conf.gem` ended up choosing the branch/commit-id to use. This change detects this situation and makes it an error. It also allows the config writer to explicitly specify a gem checkout to use in place of the others.
This commit is contained in:
committed by
Yukihiro "Matz" Matsumoto
parent
776be1b397
commit
8d1ffa8a11
+20
-3
@@ -33,6 +33,9 @@ conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
|
||||
conf.gem :bitbucket => 'mruby/mrbgems-example', :branch => 'master'
|
||||
```
|
||||
|
||||
NOTE: `:bitbucket` option supports only git. Hg is unsupported in this
|
||||
version.
|
||||
|
||||
You can specify the subdirectory of the repository with `:path` option:
|
||||
|
||||
```ruby
|
||||
@@ -55,10 +58,24 @@ conf.gem mgem: 'mruby-redis', checksum_hash: '3446d19fc4a3f9697b5ddbf2a904f301c4
|
||||
If there are missing dependencies, mrbgem dependencies solver will reference
|
||||
mrbgem from the core or mgem-list.
|
||||
|
||||
To pull all gems from remote GIT repository on build, call `rake -p`,
|
||||
or `rake --pull-gems`.
|
||||
Note that if more than one git-based gem has the same base name
|
||||
(i.e. the default checkout directory name), it is (now) an error
|
||||
**UNLESS** they are have the same repository URL, branch name and
|
||||
commit-id (i.e. checksum hash). You can bypass this by explicitly
|
||||
importing your preferred version **first** and setting the
|
||||
`canonical:` option to `true`:
|
||||
|
||||
NOTE: `:bitbucket` option supports only git. Hg is unsupported in this version.
|
||||
```ruby
|
||||
conf.gem github: 'me/mruby-yaml', branch: 'my-hacked-branch', canonical: true
|
||||
```
|
||||
|
||||
If you do this, the system will (mostly) silently ignore other
|
||||
attempts to clone a gem with this name.
|
||||
|
||||
Note that this only affects cloning the gem from git. It does not
|
||||
resolve version conflicts. If the version as specified in the gem's
|
||||
rakefile is incompatible with a dependency, your build will still
|
||||
fail.
|
||||
|
||||
## GemBox
|
||||
|
||||
|
||||
Reference in New Issue
Block a user