如何从源 https://github.com/cmedley/terraforming 构建和安装这个 gem 包?

How to build and install this gem package from source https://github.com/cmedley/terraforming?

我想构建并使用这个 github 项目 https://github.com/cmedley/terraforming

我正在尝试按照此处的说明 https://github.com/cmedley/terraforming#development 构建和 运行 包。

然而,当我 运行 ./script/setup 我得到

Traceback (most recent call last):
    2: from /usr/local/bin/bundle:23:in `<main>'
    1: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
/usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

我有没有漏掉任何明显的东西?我没有多少 ruby 经验,而且我完全不熟悉 Ruby 生态系统。

问题中显示的错误已根据Max Pleaner的建议解决。

 gem install bundler

然而很快又遇到了第二个问题:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/antkong/Documents/Personal/wd/terraforming-assume-role/bin/ruby/2.3.0/gems/json-2.2.0/ext/json/ext/generator /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20191105-34055-mnnpg3.rb extconf.rb mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Users/antkong/Documents/Personal/wd/terraforming-assume-role/bin/ruby/2.3.0/gems/json-2.2.0
for inspection.
Results logged to
/Users/antkong/Documents/Personal/wd/terraforming-assume-role/bin/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/json-2.2.0/gem_make.out

An error occurred while installing json (2.2.0), and Bundler cannot continue.
Make sure that `gem install json -v '2.2.0' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  coveralls was resolved to 0.8.21, which depends on
    simplecov was resolved to 0.14.1, which depends on
      json

按照这个答案中的说明解决:

我重现以下步骤:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
sudo xcodebuild -license accept
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
shareeditflag