Skip to content

Commit

Permalink
.ruby-version setup & upgrade to 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nimaai committed Apr 19, 2016
1 parent ae59795 commit 32a93d0
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 87 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -3,7 +3,6 @@
*~
.loadpath
.project
.ruby-version
.sass-cache
jhw.*
log/*
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
@@ -0,0 +1 @@
2.3.0
2 changes: 1 addition & 1 deletion app/models/item.rb
Expand Up @@ -160,7 +160,7 @@ def self.filter(params, inventory_pool = nil)
else
Model
.joins(:categories)
.where(:"model_groups.id" => \
.where("model_groups.id": \
[Category.find(params[:category_id])] \
+ Category.find(params[:category_id]).descendants)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/model.rb
Expand Up @@ -352,7 +352,7 @@ def self.filter_for_inventory_pool(models, params, inventory_pool, _category)
models = \
models
.joins(:categories)
.where(:"model_groups.id" => \
.where("model_groups.id": \
[Category.find(params[:category_id])] \
+ Category.find(params[:category_id]).descendants)
end
Expand Down
6 changes: 4 additions & 2 deletions cider-ci/bin/bundle_with_cachestamp.sh
@@ -1,12 +1,14 @@
#!/usr/bin/env bash
set -e
set -u
BUNLDE_VERSION_DIGEST=`git hash-object 'Gemfile.lock'`
BUNDLE_CACHE_STAMP_FILE="/tmp/MADEK_BUNDLED_${BUNLDE_VERSION_DIGEST}_${RBENV_VERSION}"
_RUBY_VERSION=$(cat .ruby-version)
BUNDLE_VERSION_DIGEST=`git hash-object 'Gemfile.lock'`
BUNDLE_CACHE_STAMP_FILE="/tmp/LEIHS_BUNDLED_${BUNDLE_VERSION_DIGEST}_${_RUBY_VERSION}"
if [ -e "$BUNDLE_CACHE_STAMP_FILE" ]; then
echo "BUNDLE_CACHE_STAMP_FILE ${BUNDLE_CACHE_STAMP_FILE} exists, doing nothing"
else
echo "bundling..."
bundle
echo "bundled $(date)" >> "$BUNDLE_CACHE_STAMP_FILE"
rbenv rehash
fi
23 changes: 2 additions & 21 deletions cider-ci/jobs/code-checks.yml
Expand Up @@ -13,27 +13,8 @@ jobs:

context:

task-defaults:

eager-trials: 1
max-auto-trials: 2
traits:
linux: true
rbenv: true
ruby: true

environment-variables:
RAILS_ENV: test
LANG: "en_US.UTF-8"
RBENV_VERSION: 2.1

scripts:
bundle:
exclusive-executor-resource: bundler_2.1
body: cider-ci/bin/bundle_with_cachestamp.sh
test:
start-when:
- script: bundle
_cider-ci_include:
- cider-ci/shared/code-checks-context.yml

tasks:

Expand Down
23 changes: 2 additions & 21 deletions cider-ci/jobs/leihs-admin-code-checks.yml
Expand Up @@ -13,27 +13,8 @@ jobs:

context:

task-defaults:

eager-trials: 1
max-auto-trials: 2
traits:
linux: true
rbenv: true
ruby: true

environment-variables:
RAILS_ENV: test
LANG: "en_US.UTF-8"
RBENV_VERSION: 2.1

scripts:
bundle:
exclusive-executor-resource: bundler_2.1
body: cider-ci/bin/bundle_with_cachestamp.sh
test:
start-when:
- script: bundle
_cider-ci_include:
- cider-ci/shared/code-checks-context.yml

tasks:

Expand Down
23 changes: 2 additions & 21 deletions cider-ci/jobs/procurement-code-checks.yml
Expand Up @@ -13,27 +13,8 @@ jobs:

context:

task-defaults:

eager-trials: 1
max-auto-trials: 2
traits:
linux: true
rbenv: true
ruby: true

environment-variables:
RAILS_ENV: test
LANG: "en_US.UTF-8"
RBENV_VERSION: 2.1

scripts:
bundle:
exclusive-executor-resource: bundler_2.1
body: cider-ci/bin/bundle_with_cachestamp.sh
test:
start-when:
- script: bundle
_cider-ci_include:
- cider-ci/shared/code-checks-context.yml

tasks:

Expand Down
21 changes: 10 additions & 11 deletions cider-ci/shared/code-checks-context.yml
Expand Up @@ -7,16 +7,15 @@ task-defaults:
rbenv: true
ruby: true

environment-variables:
RAILS_ENV: test
LANG: "en_US.UTF-8"
RBENV_VERSION: 2.1
environment-variables:
RAILS_ENV: test
LANG: "en_US.UTF-8"

scripts:
bundle:
exclusive-executor-resource: bundler_2.1
body: cider-ci/bin/bundle_with_cachestamp.sh
scripts:
_cider-ci_include:
- cider-ci/shared/scripts/setup-ruby.yml
- cider-ci/shared/scripts/bundle.yml

test:
start-when:
- script: bundle
test:
start-when:
- script: bundle
6 changes: 6 additions & 0 deletions cider-ci/shared/scripts/bundle.yml
@@ -0,0 +1,6 @@
bundle:
exclusive-executor-resource: bundler
timeout: 20 Minutes
body: cider-ci/bin/bundle_with_cachestamp.sh
start-when:
- script: setup-ruby
21 changes: 21 additions & 0 deletions cider-ci/shared/scripts/setup-ruby.yml
@@ -0,0 +1,21 @@
setup-ruby:
exclusive-executor-resource: rbenv
timeout: 20 Minutes
body: |
#!/usr/bin/env bash
set -eux
_RUBY_VERSION=$(cat .ruby-version)
function remove_possibly_broken_ruby {
rm -rf $HOME/.rbenv/versions/$_RUBY_VERSION
}
trap remove_possibly_broken_ruby ERR SIGINT SIGTERM
if [ ! -d $HOME/.rbenv/versions/$_RUBY_VERSION ]; then
rm -rf ~/.rbenv/plugins/*
curl --silent https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
rbenv install $_RUBY_VERSION
gem install bundler
rbenv rehash
fi
13 changes: 5 additions & 8 deletions cider-ci/shared/tests-context.yml
Expand Up @@ -6,7 +6,6 @@ task-defaults:
eager-trials: 1

environment-variables:
RBENV_VERSION: 2.1
RAILS_ENV: test
LANG: "en_US.UTF-8"
DATABASE: "leihs_test_{{CIDER_CI_TRIAL_ID}}"
Expand All @@ -30,7 +29,6 @@ task-defaults:
nodejs: true
mysql: true
rbenv: true
ruby-2.2: true
ruby: true
tightvnc: true

Expand All @@ -41,6 +39,9 @@ task-defaults:
max: 5999

scripts:
_cider-ci_include:
- cider-ci/shared/scripts/setup-ruby.yml
- cider-ci/shared/scripts/bundle.yml

configure-database:
body: |
Expand All @@ -56,10 +57,8 @@ task-defaults:
'password' => ENV['MYSQL_PASSWORD'],
'database' => ENV['DATABASE']}}
File.open('config/database.yml','w') { |file| file.write config.to_yaml }
bundle:
exclusive-executor-resource: bundler_2.1
body: cider-ci/bin/bundle_with_cachestamp.sh
start-when:
- script: setup-ruby

create-database:
body: echo $DATABASE && mysqladmin --user=$MYSQL_USER --password=$MYSQL_PASSWORD create $DATABASE
Expand All @@ -76,8 +75,6 @@ task-defaults:
- script: create-database

test:
environment-variables:
RBENV_VERSION: 2.1
body: |
export DISPLAY=":$XVNC_PORT" \
# && rm -rf coverage \
Expand Down

0 comments on commit 32a93d0

Please sign in to comment.