1. Open sqlite database
$ sqlite3 db/development.sqlite32. List down tables
sqlite> .tables3. Look at the schema
sqlite> .schema4. Exit
sqlite> .exit
$ sqlite3 db/development.sqlite32. List down tables
sqlite> .tables3. Look at the schema
sqlite> .schema4. Exit
sqlite> .exit
$ p4 client2. Populate workspace with files from server
$ p4 sync $ p4 sync * - only files from current dir $ p4 sync ... - current path, all folders and files underneath $ p4 sync -f filename - force the sync, override no clobber (lose all local changes) $ p4 sync @490807 - sync to changelist number $ p4 sync @=490807 - sync only the files revised within that changelist3. Check out a file for edit
$ p4 edit filename4. See checked out files
$ p4 opened $ p4 have filename - what version you have $ p4 filelog filename - check history5. View local changes
$ p4 diff $ p4 diff filename | p4c.rb - colored diff $ p4 diff -db filename - disregard whitespace $ p4 diff -t filename - even though files aren't text6. Create new changelist
$ p4 change $ p4 change -u changelist_number - update submitted changelist7. Add files for addition to the depot
$ p4 add $ p4 add -c change_number -f filenames - add files to changelist $ p4 add -f filenames - add files to default changelist $ p4 add -c change_number * */* - add files in current dir and next dir to default changelist $ "find . -type f | p4 -x - add" - cmd inside quotes would find all files in a directory structure and add them all in8. Get info about a changelist, listing files that are included
$ p4 describe change_number9. Get a list of your changes
$ p4 changes -u username $ p4 changes -u username -s pending10. Discard changes made to open files
$ p4 revert -c change_number - reverts only those files in the specified changelist $ p4 revert filename - reverts only this file11. Submit changes for code review
$ /auto/tools/bin/post-review change_number12. Checkin your changes
$ p4 submit $ p4 submit -c change_number13. Delete pending changelist
$ p4 changes -u username -s pending $ p4 revert -c 12345 //... - revert all files in my pending changelist 12345 $ p4 change -d 12345 - delete the now-empty changelist14. Print detailed information about file revisions.
$ p4 filelog filename15. Add opened files to a specific changelist
$ p4 reopen -c 431494 */*16. Get specific change information
$ p4 changes //prod/main/...\@445029,445029 Change 445029 on 2014/08/10 by sdc@main:sdc 'Integrate change 444241 from 5.'17. Move (or rename) a file from one location to another
$ p4 move deploy/deploy_change util/deploy_change18. Move a directory
$ p4 edit 5.5/*/baseline.xml $ p4 move 5.5/... 5.5_old/...18. Take a peek at the branches available
$ p4 branches | grep "5\.6\.0"19. Delete file
$ p4 delete filename20. Change file type into executable
$ p4 edit -t +x watchdog
$ git config --global --add user.name "Sam Dela Cruz" $ git config --global --add user.email "samdc@mail.com"2. Verify configuration
$ git config --global --list user.name=Sam Dela Cruz user.email=samdc@mail.com3. Tell git which files are not be be version controlled
$ vi .gitignore
# See https://help.github.com/articles/ignoring-files for more about ignoring files. # # If you find yourself ignoring temporary files generated by your text editor # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile '~/.gitignore_global' # Ignore bundler config. /.bundle # Ignore the default SQLite database. /db/*.sqlite3 /db/*.sqlite3-journal # Ignore all logfiles and tempfiles. /log/*.log /tmp4. Initialize repository
$ git init5. Add all files
$ git add .6. Commit
$ git commit -m "Project Scaffold"============
$ git log -L :start_perfcloud_run:./api/api/orchestrator/tasks/job_tasks.py
$ rails new demo2. Examine installation
$ cd demo $ rake about3. Start the application
$ rails server4. Create a controller and actions
$ rails generate controller Say hello goodbye $ rails generate controller Store index5. Generate a scaffold
$ rails generate scaffold Product title:string description:text image_url:string price:decimal $ rails generate scaffold_controller LdapUsers # generate only controller and views, say if model had been predefined.With relationships
$ rails generate scaffold LineItem product:references cart:belongs_toDestroy just created scaffold
$ rails destroy scaffold LineItem6. Apply the migration
$ rake db:migrate7. Run the tests
$ rake test $ rake test:models - only the models directory8. Populate table with test data
$ rake db:seed9. Rollback the migration
$ rake db:rollback10. Open up rails console
$ rails console $ rails c11. Add a column to a table
$ rails generate migration add_quantity_to_line_items quantity:integer12. Create a migration
$ rails generate migration combine_items_in_cart13. Clear the logs
$ rake log:clear LOGS=test14. Create a mailer
$ rails generate mailer OrderNotifier received shipped15. Create an integration test
$ rails generate integration_test user_stories16. Generate documentation in HTML format. First modify README.doc then...
$ rake doc:app17. See how much code is written
$ rake stats18. Loading production db
$ rake db:setup RAILS_ENV="production"19. Generate rake task
$ rails g task perfdb get_baselines create lib/tasks/perfdb.rake
$ sudo yum install sqlite-devel nodejs openssl2. Set rvm_path
$ echo 'rvm_path="$HOME/.rvm"' >> ~/.rvmrc3. Install RVM as a single user ( background info: https://rvm.io/rvm/install)
$ \curl -L https://get.rvm.io | bash -s stable4. At this point, RVM should have been installed, check if rvm was installed correctly by loading it then checking it’s type:
$ source ~/.rvm/scripts/rvm $ type rvm | head -n 1 rvm is a function5. Make sure that the latest version is installed
$ rvm get stable6. Run the rvm requirements to get all the dependencies for RVM, this might prompt for your password when it needed to install missing packages:
$ rvm requirements Checking requirements for fedora. Installing requirements for fedora. Updating system Installing required packages: patch, gcc-c++, patch, readline-devel, zlib-devel, libyaml-devel, libffi-devel, openssl-devel, autoconf, automake, libtool, bisondelacs password required for '/usr/bin/env PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/local/bin/Aptana_Studio_3:/auto/home3/delacs/bin:/auto/home3/delacs/.rvm/bin:/sbin yum install -y patch gcc-c++ patch readline-devel zlib-devel libyaml-devel libffi-devel openssl-devel autoconf automake libtool bison': .................................................................................................................................................................................................................... Requirements installation successful.
$ rvm install 2.0.08. The above command should install RubyGems with it, if in case there is an issue such that RubyGems was not able to install due to some checksum error, go to one version below the latest, e.g.,
$ rvm rubygems latest9. Let’s tell RVM to use Ruby 2.0.0 as our default
$ rvm use ruby-2.0.0-p247 --default Using /home/samdc/.rvm/gems/ruby-2.0.0-p24710. Let’s check the version of Ruby in our environment
$ ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
:ssl_verify_mode: 0 :sources: - http://rubygems.org/ - http://gems.github.com gem: --no-rdoc --no-riThe last line is to not install rdoc and ri
$ rvm gemset create RailsDev gemset created RailsDev => /auto/home3/delacs/.rvm/gems/ruby-2.0.0-p247@RailsDev13. Let’s use that GemSet:
$ rvm gemset use RailsDev Using ruby-2.0.0-p247 with gemset RailsDevLet’s check if we are using that gemset
$ rvm gemset name RailsDev14. Now let’s install all gems that we need
$ gem install rails --version 4.0.115. Lets verify the installation
$ rails -v Rails 4.0.116. To make use of this RVM environment, we can specify 2 files in the project’s root folder:
$ cat .ruby-gemset RailsDev $ cat .ruby-version ruby-2.0.0-p247To learn more about RVM and its environment, refer to these posts: http://yakiloo.com/using-rvm/ http://stackoverflow.com/questions/15708916/use-rvmrc-or-ruby-version-file-to-set-a-project-gemset-with-rvm
rvm_install_on_use_flag=118. You also make bootstrapping a project happen via cd into the project directory, by adding this to ~/.rvmrc
export rvm_project_rvmrc=119. To access webrick from another system, firewall needs to be opened up for port 3000 as follows:
$ sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp $ sudo systemctl restart firewalld.service