23 Commits

Author SHA1 Message Date
dearblue 80d0f4e243 Fixed wrong MRuby::Build.current at the top level of mrbgem.rake
Until now, GEMS added via `gem.add_dependency` retained the last `MRuby::Build.current` from the build configuration file, which was accessible from the top level of `mrbgem.rake`.
2025-09-17 22:27:36 +09:00
John Bampton 88e2eb0188 Fix spelling 2024-06-21 08:14:17 +10:00
dearblue 8284234229 Get from local only if there is no default branch name
The branch name of the cloned repository should be determined by the build configuration file.

fixes #6087
2023-10-28 19:02:50 +09:00
John Bampton 2438195289 ruby: remove unneeded parenthesis from methods
commit eeb33da43035b5400f8d1830ea52a68691b3a678
Author: John Bampton <jbampton@gmail.com>
Date:   Mon Oct 31 23:53:43 2022 +1000

    Fix up

commit 80923c8f92a58b2f33a36d6403de7f6341973110
Merge: bc89500f6 416f012f6
Author: John Bampton <jbampton@users.noreply.github.com>
Date:   Mon Oct 31 20:12:59 2022 +1000

    Merge branch 'master' into ruby-remove-parenthesis

commit bc89500f6357c453b457516452ffcc7fd03fee88
Author: John Bampton <jbampton@gmail.com>
Date:   Mon Oct 31 14:39:20 2022 +1000

    ruby: remove unneeded parenthesis from methods
2022-11-01 00:25:09 +10:00
John Bampton ea8964ef35 ruby: standardize whitespace 2022-10-31 16:25:56 +10:00
dearblue b012ebfa79 Ignore git checkout if nil commit-hash
If there is no `.lock` file and no commit hash specified, avoid `git checkout --detach`.
This behavior will be the same as up to mruby-3.1.

ref. #5638
2022-07-14 21:58:20 +09:00
Chris Reuter b297809b51 Fix conf.gem path: build_config argument.
The mrbgem guide (`doc/guides/mrbgems.md`) documents the `path:`
argument for `conf.gem` as being used to point to the root directory
of a gem when that gem is retrieved via git but is located in a
subdirectory of the checkout.

The actual code does not do this.  Instead, it treats path as (mostly)
identical to the `gemdir:` argument; that is, it points to a local
directory containing the gem.

This change fixes this by making `path:` behave as documented.
2022-05-18 14:02:47 -04:00
Chris Reuter 73df87f7bd Added a dependency on 'yaml' to load_gems.rb.
It appears that some execution paths no longer load YAML before it is
needed so we explicitly `require` it here.
2022-02-23 14:23:57 -05:00
Chris Reuter 8d1ffa8a11 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.
2022-02-23 16:08:15 +09:00
Takashi Kokubun 6ac79a2c44 Skip --depth=1 when it's locked 2021-02-16 20:56:13 -08:00
Yukihiro "Matz" Matsumoto ddfac9aba0 Search gem from MRUBY_ROOT if build config is in build_config. 2020-11-02 15:14:36 +09:00
Yukihiro "Matz" Matsumoto 24ffa4386a The path of the gem should be relative from MRUBY_ROOT.
It was relative from the directory of the build configuration file, but
the document says it's relative from `MRUBY_ROOT`. When the default
configuration file was `MRUBY_ROOT/build_config.rb`, it was OK for most
of the cases.
2020-10-29 11:49:05 +09:00
Yukihiro "Matz" Matsumoto 41d5df03ed Use Dir.glob instead of map. 2020-10-29 10:43:09 +09:00
Yukihiro "Matz" Matsumoto 2bb84f1f1a Update build process for both host and cross compile. 2020-10-12 16:21:52 +09:00
KOBAYASHI Shuji 26e6e75ba6 Use Rake DSL instead of commands of FileUtils
- Respect `--verbose(-v)` and `--dry-run(-n)` options.
- Silence warnings to keyword arguments on Ruby 2.7.
2019-12-27 16:49:32 +09:00
dearblue f08d9b288d Use git checkout instead of git reset
With this change, if the checkout fails, it will stop with an error.

The purpose is to avoid deleting working branch history when
developing gem.
2019-12-22 15:09:29 +09:00
KOBAYASHI Shuji b5946822af Defer getting caller_dir until needed in MRuby::LoadGems#gem 2019-11-10 19:40:07 +09:00
take-cheeze f7616c4287 Add mrbgem version field to lock file 2019-10-09 02:22:33 +09:00
KOBAYASHI Shuji e312842a18 Refine processing for gem lock file
- Defer YAML library and lock file loading until needed.
- Don't write empty parts into lock file.
- Extract code to read/write lock file to `MRuby::Lockfile`.
- `MRuby::Lockfile.disable` disables the use of lock file.
2019-08-22 21:40:01 +09:00
take-cheeze b6850f88a1 Support lock file for git. 2018-12-06 11:47:17 +09:00
Takeshi Watanabe 4940ddb9fc Add :path option for git repository. 2018-03-22 12:42:41 +09:00
Uchio KONDO 9c2db2e134 Move class/module definitions to normal .rb files 2017-04-04 12:03:43 +09:00
Uchio KONDO 86b69d7c5d Initial skelton for class/module def 2017-04-04 11:57:17 +09:00