Last active
July 24, 2019 08:18
-
-
Save pinzolo/7599006 to your computer and use it in GitHub Desktop.
Redmine のプラグインを Travis-ci でテストするための各種スクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: ruby | |
rvm: | |
- 1.9.3 | |
- 2.0.0 | |
before_install: sh travis/before_install.sh | |
script: sh travis/exec_test.sh | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
REDMINE_VERSION="2.4.0" | |
PLUGIN_NAME="<plugin_name>" | |
# Get & deploy Redmine | |
wget http://www.redmine.org/releases/redmine-${REDMINE_VERSION}.tar.gz | |
tar zxf redmine-${REDMINE_VERSION}.tar.gz | |
# Copy plugin files to plugin directory | |
mkdir redmine-${REDMINE_VERSION}/plugins/${PLUGIN_NAME} | |
mv app redmine-${REDMINE_VERSION}/plugins/${PLUGIN_NAME}/app | |
mv assets redmine-${REDMINE_VERSION}/plugins/${PLUGIN_NAME}/assets | |
mv config redmine-${REDMINE_VERSION}/plugins/${PLUGIN_NAME}/config | |
mv db redmine-${REDMINE_VERSION}/plugins/${PLUGIN_NAME}/db | |
mv lib redmine-${REDMINE_VERSION}/plugins/${PLUGIN_NAME}/lib | |
mv spec redmine-${REDMINE_VERSION}/plugins/${PLUGIN_NAME}/spec | |
mv Gemfile redmine-${REDMINE_VERSION}/plugins/${PLUGIN_NAME}/Gemfile | |
mv init.rb redmine-${REDMINE_VERSION}/plugins/${PLUGIN_NAME}/init.rb | |
# Create necessary files | |
cat > redmine-${REDMINE_VERSION}/config/database.yml <<_EOS_ | |
test: | |
adapter: sqlite3 | |
database: db/redmine_test.db | |
_EOS_ | |
cp redmine-${REDMINE_VERSION}/plugins/${PLUGIN_NAME}/test/fixtures/* redmine-${REDMINE_VERSION}/test/fixtures/ | |
# All move to work directory | |
mv redmine-${REDMINE_VERSION}/* . | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
export REDMINE_LANG=en | |
export RAILS_ENV=test | |
# Initialize redmine | |
bundle exec rake generate_secret_token | |
bundle exec rake db:migrate | |
bundle exec rake redmine:load_default_data | |
# Copy assets & execute plugin's migration | |
bundle exec rake redmine:plugins NAME=<plugin_name> | |
# Initialize RSpec | |
bundle exec rails g rspec:install | |
# Execute test by RSpec | |
bundle exec rspec plugins/<plugin_name>/spec -c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment