-
Notifications
You must be signed in to change notification settings - Fork 123
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
Guide should describe how to set up a ruby gem #22
Comments
I'm pretty sure your problem is some load path issue, but I'm not sure what it is without taking a closer look at your app. As for keeping your Rakefile up to date: you don't have to do that. The core idea is that you take our binaries and drop them in a package. If your Rakefile works, you never have to update it again. The Rakefile is also designed to be customized. But I agree that it should be easier to create Traveling Ruby-based packages. We should have a tool that can automatically create a package, given a gemspec. |
I tried integrating into deliver. I'd like to get started for all my open source tools (linked on top of the README) You think the Have you tried setting up The load path problem is a result of moving the Thanks for your help @FooBarWidget 👍 |
I do not say that our Rakefile will never change. I say that your Rakefile does not have to change. |
@FooBarWidget What I did:
Problems I have:
The full source can be found on the Thanks for creating |
I solved this problem in my gems by just putting the contents of vendor into the app directory, so bundler can resolve paths properly for the gemspec to build. Any specific reason why this is bad idea? |
We're consolidating all issues concerning gems and gem support to work on in the next few weeks. Thank you for reporting this! |
@FloorD We found the example Rakefile to be pretty annoying. Additionally, hardcording gem names inside the Rakefile isn't nice. Gemfile is the place where project dependencies and versions are to be defined. I came up with a way of marking gems as Traveling Ruby gems directly in Gemfile. This makes every developer aware of the fact a given gem is not to be messed with unless the version exists in Traveling Ruby. Moreover, an explicit Traveling Ruby gem has to have a version number defined. With this approach, all is clear, explicit and self-contained in Gemfile. My work is below. It might not be a copy-and-paste replacement for one's Rakefile but the overall approach is way better than the original one. Hope this makes its way to the official Traveling Ruby. #!/usr/bin/env bash
set -x
cd "$(dirname "$0")/.." # Start from webapp root
TARGET='linux-x86_64'
VERSION='20170106-2.3.3'
URL="https://OUROWNMIRROR/traveling-ruby/$VERSION"
PACKAGE_NAME='virtkick-webapp'
rm -rf packaging/tmp packaging/vendor
mkdir -p packaging/tmp packaging/tmp/engines packaging/vendor packaging/traveling
cp Gemfile packaging/tmp/
function copy_engine {
if [[ -n "$1" && "$1" != 'basic' ]]; then
cp -r "engines/$1" packaging/tmp/engines || exit 1
fi
}
copy_engine "$MODULE"
(
cd packaging/tmp && env BUNDLE_IGNORE_CONFIG=1 NOKOGIRI_USE_SYSTEM_LIBRARIES=1 PACKAGING=1 \
bundle install -j20 --path ../vendor --without development test || exit 1
) || exit 1
rm -rf packaging/vendor/*/*/cache/*
rm -rf packaging/vendor/ruby/*/extensions
find packaging/vendor/ruby/*/gems -name '*.so' -exec rm -f {} \;
find packaging/vendor/ruby/*/gems -name '*.bundle' -exec rm -f {} \;
echo 'Downloading Traveling Ruby'
wget --quiet -c "${URL}/traveling-ruby-${TARGET}.tar.gz" -P packaging/traveling || exit 1
echo 'Copying webapp'
package_dir="${PACKAGE_NAME}-${TARGET}"
rm -rf "${package_dir}"
mkdir "${package_dir}"
mkdir -p "${package_dir}/lib/app"
cp -r config.ru Rakefile bin app config lib spec db frontend package.json "${package_dir}/lib/app/" || exit 1
rm -rf "${package_dir}/lib/app/vendor/cache" "${package_dir}"/lib/app/db/*.sqlite3 "${package_dir}/lib/app/config/database.yml"
mkdir "${package_dir}/lib/ruby"
tar -xzf "packaging/traveling/traveling-ruby-${TARGET}.tar.gz" -C "${package_dir}/lib/ruby" || exit 1
cp packaging/wrapper-common.sh "${package_dir}/lib" || exit 1
cp -pR packaging/vendor "${package_dir}/lib/" || exit 1
cp packaging/tmp/Gemfile packaging/tmp/Gemfile.lock "${package_dir}/lib/vendor/" || exit 1
rm -rf 'packaging/tmp'
mkdir "${package_dir}/lib/vendor/.bundle"
cp packaging/bundler-config "${package_dir}/lib/vendor/.bundle/config"
grep -F '# TravelingRuby' Gemfile | while read -r line; do
GEM=$(echo "$line" | awk -F "'" "{print \$2}")
GEM_VER=$(echo "$line" | awk -F "'" "/$GEM/ {print \$4}")
echo "Downloading from Traveling Ruby: $GEM $GEM_VER"
wget -c "${URL}/${GEM}-${GEM_VER}.tar.gz" -P packaging/traveling || exit 1
tar -xzf "packaging/traveling/${GEM}-${GEM_VER}.tar.gz" -C "${package_dir}/lib/vendor/ruby" || exit 1
done gem 'rails'
gem 'whatever'
def traveling_ruby_gem name, version
if ENV['UPDATE_GEMS']
gem name
else
gem name, version
end
end
# These require native extensions. Ensure Traveling Ruby provides an appropriate version before bumping.
# Traveling Ruby binaries are here: http://traveling-ruby.s3-us-west-2.amazonaws.com/list.html
# Do NOT remove a comment on their right! We grep for this comment in packaging/build.sh.
traveling_ruby_gem 'bcrypt', '3.1.11' # TravelingRuby
traveling_ruby_gem 'binding_of_caller', '0.7.2' # TravelingRuby |
I maintain 5 ruby gems, which could be delivered using
Traveling Ruby
for easier install.Right now, it's quite a pain to adapt the
Rakefile
to make it work with a ruby gem:I changed the following:
to
and
to
Unfortunately I haven't yet got it to work, since I've got problems with the path:
I'm pretty sure some things will change from time to time in the proposed
Rakefile
described in the guide. How should I keep up to date with the changes?Maybe I'm missing something here?
Traveling Ruby
looks really promising, but is very hard to set up and maintain for me right now.The text was updated successfully, but these errors were encountered: