-
Notifications
You must be signed in to change notification settings - Fork 1
Quick Reference
Glen Horton edited this page Mar 1, 2018
·
39 revisions
cd curate_fork
bundle exec rake jetty:start
-
bundle exec rake spec
or if the test app doesn't exist yetbundle exec rake clean generate spec
bundle exec rake spec
cd curate_fork
bundle exec rake jetty:start
BUNDLE_GEMFILE=./spec/internal/Gemfile bundle exec rspec path/to/spec.rb:LINE
cd scholar_uc
bundle exec rake jetty:start
bundle exec rake spec
cd scholar_uc
bundle exec rake jetty:start
rspec path/to/spec.rb:LINE
AdminSet.find('admin_set/default').delete
ActiveFedora::Base.eradicate('admin_set/default')
- Reindex:
bundle exec rake solr:reindex
(background workers need to be running) - Reindex via the Rails console:
ActiveFedora::Base.reindex_everything
- Remove a single item from the solr index:
ActiveFedora::SolrService.delete(id)
- Find a user:
User.find_by_email('user@exmaple.com')
- Find a user by a column:
User.where(email: 'user@example.com')
- Display certain fields:
User.select('first_name,last_name,email').all
- Display results in yaml format:
y User.all
- Mass update a column for multiple users:
User.update_all(department: 'IT')
- Grep methods for a class:
User.methods.grep(/email/)
- Change a user's password from console
u=User.where(:email => 'usermail@example.com').first
u.password='userpassword'
u.password_confirmation='userpassword'
u.save
- Install a gem:
gem install <gem name>
- List installed versions of a gem:
gem list <gem name>
- Delete a version of an installed gem:
gem uninstall <gem name>
- Put
=begin
above first line and=end
below last line.
bundle exec rake db:reset
- Add the byebug gem to your app:
gem 'byebug'
- Add
byebug
to spot you want a breakpoint in your code - Start rails server and watch the logging output
- Byebug commands:
- help OR help
- n - next line
- c - continue
- eval - change data
- finish
- step - run one executable unit
- q - quit
- p OR display - display value of a variable
- break <step #> - adds a breakpoint at <step #>
- If you've done this before you'll need to clear host fingerprint for 127.0.0.1 at: ~/.ssh/known_hosts
- First, on your local machine, run:
ssh -L 1234:SERVER_NAME:22 USERNAME@SECRET_SERVER_GATEWAY
(1234 could be any other unused port; SERVER_NAME is the target server; 22 is the standard port for ssh) - In a new session on your local machine, run:
scp -P 1234 USERNAME@127.0.0.1:/path/to/file /path/to/file
rsync -avz -e ssh --delete /path/to/files username@larry.libraries.uc.edu:~/path/to/files