Skip to content
This repository has been archived by the owner. It is now read-only.

Commit a9b833b

Browse files
committed
Merge pull request #17 from VTUL/automate-readme
Automate the data-repo README steps.
2 parents bdf3b8a + b41a966 commit a9b833b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Vagrant/bootstrap.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,37 @@ $RUN_AS_INSTALLUSER git remote add origin "https://github.com/$gitrepo.git"
9292
$RUN_AS_INSTALLUSER git fetch --all
9393
$RUN_AS_INSTALLUSER git reset --hard origin/master
9494
$RUN_AS_INSTALLUSER bundle install
95+
96+
# Setup the application
97+
98+
# 1. Create a migration: rails generate migration CreateDoiRequests
99+
$RUN_AS_INSTALLUSER bundle exec rails generate migration CreateDoiRequests
100+
DOI_MIGRATION_FILE=`find db/migrate -type f -name '*_create_doi_requests.rb'|sort|tail -1`
101+
# 2. Replace the contents of the new migration with this gist: https://gist.github.com/tingtingjh/ab35348f493d565cdcc8
102+
$RUN_AS_INSTALLUSER cat > $DOI_MIGRATION_FILE <<GIST
103+
class CreateDoiRequests < ActiveRecord::Migration
104+
def change
105+
create_table :doi_requests do |t|
106+
t.string "collection_id"
107+
t.string "ezid_doi", default: "doi:pending", null: false
108+
t.string "asset_type", default: "Collection", null: false
109+
t.boolean "completed", default: false
110+
t.timestamps null: false
111+
end
112+
add_index :doi_requests, :ezid_doi
113+
add_index :doi_requests, :collection_id
114+
end
115+
end
116+
GIST
117+
# 3. Generate Role model: rails generate roles
118+
$RUN_AS_INSTALLUSER bundle exec rails generate roles
119+
# 4. Remove the before filter added to app/controllers/application_controller.rb
120+
$RUN_AS_INSTALLUSER sed -i '/^ before_filter do$/,/^ end$/d' app/controllers/application_controller.rb
121+
# 5. Migrate
122+
$RUN_AS_INSTALLUSER bundle exec rake db:migrate
123+
# 6. Create default roles and an admin user
124+
$RUN_AS_INSTALLUSER bundle exec rake datarepo:setup_defaults
125+
# 7. Install Orcid
126+
$RUN_AS_INSTALLUSER bundle exec rails generate orcid:install --skip-application-yml
127+
# 8. Revert changes already incorporated
128+
$RUN_AS_INSTALLUSER git checkout ./app/models/user.rb ./config/routes.rb

0 commit comments

Comments
 (0)