Summary
以前は pages.github.com/versions で確認できていた GitHub Pagesで利用しているGemのバージョンの確認方法が変更になっていた。curl https://pages.github.com/versions.json | jq Reference
GitHub Pages - versions.jsonhttps://pages.github.com/versions.json
curl https://pages.github.com/versions.json | jq compiling closure.c
closure.c:264:14: error: implicit declaration of function 'ffi_prep_closure' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
result = ffi_prep_closure(pcl, cif, callback, (void *)self);
^
1 error generated.
make[2]: *** [closure.o] Error 1
make[1]: *** [ext/fiddle/all] Error 2
make: *** [build-ext] Error 2
$ git clone https://github.com/postmodern/ruby-install.git
$ cd ruby-install
$ ./bin/ruby-install ruby 2.7.1 -c -- --with-arch=arm64 --prefix=$(rbenv root)/versions/2.7.1-arm64 CFLAGS=-DUSE_FFI_CLOSURE_ALLOC=1checking for ruby... $HOME/.anyenv/envs/rbenv/shims/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... Invalid configuration `arm64-apple-darwin20.2.0': machine `arm64-apple' not recognized
configure: error: /bin/sh tool/config.sub arm64-apple-darwin20.2.0 failed$ rbenv install --patch 2.7.2 <<(curl -sSL https://gist.githubusercontent.com/xight/2518f1c28d28a1925d80e786ae34b1c2/raw/5b52a565add497c7e311808da838160d05ee7cc4/config.sub.patch)$ cd /var/folders/PATH/TO/ruby-build.YYYYMMDDhhmmss.xxxxx.XXXXXX/ruby-2.7.2/tool
$ mv config.sub config.sub.bak
$ wget https://raw.githubusercontent.com/gcc-mirror/gcc/master/config.sub
$ cd ..
$ ./configure --prefix=$(rbenv root)/versions/2.7.2-arm64
$ make
$ make install$ rbenv global 2.7.2-arm64
$ ruby --version
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]
$ lipo -archs $(rbenv prefix)/bin/ruby
arm64$GEM_HOME/gems/psych-3.2.1/lib/psych.bundle: mach-o, but wrong architecture$ mv $GEM_HOME/gem $GEM_HOME/gem-x86_64
$ gem updatebundle config --local build.nokogiri --use-system-libraries
bundle install --path vendor/bundlebundle config --local build.nokogiri --use-system-libraries=true --with-xml2-include="$(xcrun --show-sdk-path)"/usr/include/libxml2
bundle install --path vendor/bundlebundle config --local build.nokogiri --use-system-libraries --with-iconv-dir="$(brew --prefix libiconv)" --with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config" --with-xslt-config="$(brew --prefix libxslt)/bin/xslt-config"
bundle install --path vendor/bundlerequire 'mechanize'
agent = Mechanize.new
agent.pluggable_parser['text/html'] = PlainFile
page = agent.get("http://example.com/")
p page#<Mechanize::Page
{url #<URI::HTTP http://ill-formed.com/>}
{meta_refresh}
{title "ill-formed.com"}
{iframes}
{frames}
{links}
{forms}>
require 'mechanize'
class PlainFile < Mechanize::File; end
agent = Mechanize.new
agent.pluggable_parser['text/html'] = PlainFile
page = agent.get("http://example.com/")
p page#<PlainFile:0x00007fb8d2077910
@body=
"<!doctype html>\n" +
"<html>\n" +
"<head>\n" +
" <title>ill-formed.com</title>\n" +
"\n" +
" <meta charset=\"utf-8\" />\n" +
" <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />\n" +
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n" +
"\t<link rel=\"stylesheet\" type=\"text/css\" href=\"main.css\" />\n" +
"</head>\n" +
"\n" +
"<body>\n" +
"<div>\n" +
" <h1>ill-formed.com</h1>\n" +
"\t<p>This domain is established to be used for ill-formed HTML test. <!-- </p> -->\n" +
"<!-- </div> -->\n" +
"<!-- </body> -->\n" +
"<!-- </html> -->\n",
@code="200",
@filename="index.html",
@full_path=false,
@response=
{"server"=>"GitHub.com",
"date"=>"Thu, 05 Oct 2017 14:55:52 GMT",
"content-type"=>"text/html; charset=utf-8",
"transfer-encoding"=>"chunked",
"last-modified"=>"Thu, 05 Oct 2017 14:55:35 GMT",
"access-control-allow-origin"=>"*",
"expires"=>"Thu, 05 Oct 2017 15:05:52 GMT",
"cache-control"=>"max-age=600",
"content-encoding"=>"gzip",
"x-github-request-id"=>"F5F8:1F5B:54E8B4B:7C0A75B:59D647F8"},
@uri=#<URI::HTTP http://ill-formed.com/>>
gem uninstall -aIx $(gem list --no-versions | grep -v -E "bigdecimal|io-console|json|openssl|psych|rdoc")gem uninstall -aIx (gem list --no-versions | grep -v -E "bigdecimal|io-console|json|openssl|psych|rdoc")" clipboard sharing
set clipboard+=unnamed
$ brew install -f openssl
$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.1.3
$ rbenv global 2.1.3
$ ruby -ropenssl -e 'p RUBY_VERSION, OpenSSL::OPENSSL_VERSION'
"2.1.3"
"OpenSSL 1.0.1i 6 Aug 2014"
$ anyenv install rbenv
$ rbenv install X.X.X
(snip)
$ rbenv global X.X.X
$ rbenv rehash
$ rbenv exec gem install bundler
$ vi Gemfile
$ bundle install --path vendor/bundle
$ bundle exec ruby example.rb
function gem(){
$RBENV_ROOT/shims/gem $*
if [ "$1" = "install" ] || [ "$1" = "i" ] || [ "$1" = "uninstall" ] || [ "$1" = "uni" ]
then
rbenv rehash
rehash
fi
}
$ brew list |grep env
plenv
pyenv
pyenv-virtualenv
rbenv
$ brew remove plenv
$ brew remove pyenv
$ brew remove pyenv-virutalenv
$ brew remove rbenv
$ git clone https://github.com/riywo/anyenv ~/.anyenv
if [ -d $HOME/.anyenv ] ; then
export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"
for D in `ls $HOME/.anyenv/envs`
do
export PATH="$HOME/.anyenv/envs/$D/shims:$PATH"
done
fi
$ exec $SHELL -l
$ anyenv install plenv
$ anyenv install pyenv
$ anyenv install rbenv
$ anyenv install phpenv
$ mkdir -p $(anyenv root)/plugins
$ git clone https://github.com/znz/anyenv-update.git $(anyenv root)/plugins/anyenv-update
$ anyenv update
$ mkdir -p $(anyenv root)/plugins
$ git clone git://github.com/aereal/anyenv-exec.git $(anyenv root)/plugins/anyenv-exe
$ anyenv --version
$ mkdir -p $(anyenv root)/plugins
$ git clone https://github.com/znz/anyenv-git.git $(anyenv root)/plugins/anyenv-git
$ anyenv git gc
/path/to/net/http.rb:920:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
% ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_DIR'
/usr/local/etc/openssl/certs
% ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE'
/usr/local/etc/openssl/cert.pem
% wget http://curl.haxx.se/ca/cacert.pem
https = Net::HTTP.new('example.com', 443)
https.open_timeout = SYSTEM_TIMEOUT_SEC
https.read_timeout = SYSTEM_TIMEOUT_SEC
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
https.verify_depth = 5
https.ca_file = "./cacert.pem" # <= 追加OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE# gem install less
style.less にソースコードを書いて、ジェネレート。
$ lessc style.less
# gem install termtter