Steps to follow, Ref:
- Update Gemfile
bundle installrails g rspec:install- Edit
.rspec
| 1) backup production database: | |
| heroku pgbackups:capture --expire --remote production | |
| 2) obtain url string to backup from step 1: | |
| heroku pgbackups:url --app production_app_name --remote production_app_branch_name | |
| 3) transfer backup from production to staging app: | |
| heroku pgbackups:restore DATABASE 'production_app_backup_url_string_from_step_2' --app production_app_name --app staging_app_branch_name |
| #!/usr/bin/env ruby | |
| # encoding: UTF-8 | |
| # Simple password generation in Ruby. | |
| # | |
| # Generate reasonably secure random passwords of any chosen length, | |
| # designed to be somewhat easy for humans to read and remember. | |
| # Each password has a capitalized letter and a digit. | |
| # | |
| # Example: |
Steps to follow, Ref:
bundle installrails g rspec:install.rspec| <% | |
| require 'cgi' | |
| require 'uri' | |
| begin | |
| uri = URI.parse(ENV["DATABASE_URL"]) | |
| rescue URI::InvalidURIError | |
| raise "Invalid DATABASE_URL" | |
| end |
| require 'texticle/searchable' | |
| class Book | |
| # :title, String | |
| # :author, String | |
| extend Searchable(:title) | |
| end | |
| Book.create :title => "Poignant Guide to Ruby", :author => "_why" |
| class Address | |
| # :street, String | |
| # :city, String | |
| # :state, String | |
| # :country, String | |
| scope :local, lambda { |query| search_by_street_or_city(query, query) } | |
| scope :national, lambda {|query| search_by_state_or_country(query, query) } | |
| end |
| heroku addons:add pgbackups --remote staging | |
| heroku addons:add pgbackups --remote production | |
| heroku pgbackups:capture --remote production | |
| heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging |
| (Operating system is Fedora 2.6.40.6-0.fc15.i686) | |
| Hi there quiet recently I had a big problem with this guy - gem install pg | |
| It threw me : | |
| $ gem install pg | |
| Building native extensions. This could take a while... | |
| ERROR: Error installing pg: | |
| ERROR: Failed to build gem native extension. |
| <% [:notice, :error, :alert].each do |level| %> | |
| <% unless flash[level].blank? %> | |
| <div class="alert-message <%= flash_class(level) %>"> | |
| <a class="close" href="#">×</a> | |
| <%= content_tag :p, flash[level] %> | |
| </div> | |
| <% end %> | |
| <% end %> |
These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).
First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.
Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.