Skip to content

Instantly share code, notes, and snippets.

View francois's full-sized avatar

François Beausoleil francois

  • Sherbrooke, QC, Canada
View GitHub Profile
$ ls -l db/production.sql.gz
lrwxr-xr-x 1 francois staff 43 20 mar 09:01 db/production.sql.gz -> db/acctsoft-production-20090320-1301.sql.gz
$ rake backup:push
File.file?(db/production.sql.gz) false
$ irb
>> File.file?("db/production.sql.gz")
=> false
>> File.symlink?("db/production.sql.gz")
=> true
$ gpush heroku
Counting objects: 15, done.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (13/13), 1.44 KiB, done.
Total 13 (delta 7), reused 0 (delta 0)
-----> Heroku receiving push
-----> Installing gem hpricot >= 0.2 from http://code.whytheluckystiff.net
Building native extensions. This could take a while...
$ sudo gem install --no-rdoc --no-ri inochi
ERROR: Error installing inochi:
inochi requires erbook (~> 6, runtime)
$ sudo gem install --no-rdoc --no-ri erbook
ERROR: Error installing erbook:
erbook requires inochi (~> 0, runtime)
$ ruby19 -v
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9.6.0]
$ irb19
> puts Benchmark.realtime { 10000.times { Time.mktime(2008, 7, 15, 0, 0, 0) } }
0.101713895797729
> puts Benchmark.realtime { 10000.times { Date.civil(2008, 7, 15) } }
0.100281000137329
(posted here because http://blog.pluron.com/2009/04/ruby-date-class.html did not accept my comment)
@francois
francois / heroku.rake
Created May 8, 2009 02:07
A Rake task that generates Heroku's .gems file from the existing Gem configuration
namespace :heroku do
desc "Generates the .gems dependencies from the config.gem directives of the current environment"
task :gems => :environment do
File.open(".gems", "w") do |io|
# If we have vendored Rails, no need to specify a dependency
io.printf "%-30s --version %-12s\n", "rails", Rails.version.to_s.inspect unless Rails.vendor_rails?
Rails.configuration.gems.each do |gem|
next if gem.vendor_gem? # Don't install gems that we've vendored
1) Failure:
test: Pets::Dog should flunk. (Pets::DogTest)
[./test/unit/dog_test.rb:10
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load'
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader.rb:5
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader.rb:5:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader.rb:5]:
require File.dirname(__FILE__) + '/../spec_helper'
describe "The RUBYOPT environment variable" do
it "is parsed for '-d'" do
ruby_exe("fixtures/debug.rb", :dir => File.dirname(__FILE__), :env => "RUBYOPT=-d").chomp.should == "true"
end
it "is parsed for '-r'" do
ruby_exe("fixtures/require.rb", :env => "RUBYOPT='-r fixtures/test_file'", :dir => File.dirname(__FILE__)).chomp.should include("fixtures/test_file.rb")
end
should_create(Similarity) do |sim|
assert_equal @project, sim.project
assert_equal @jane, sim.user0
assert_equal @jane.connections_updated_at, sim.user0_connections_updated_at
assert_equal @joe, sim.user1
assert_equal @joe.connections_updated_at, sim.user1_connections_updated_at
end
module AssertForm
# assert_form posts_url, :put do
# assert_text_field :post, :title
# assert_text_area :post, :body
# assert_submit
# end
def assert_form(url, http_method = :post)
http_method, hidden_http_method = form_http_method(http_method)
assert_select "form[action=?][method=#{http_method}]", url do
if hidden_http_method
diff --git a/app/controllers/titles_controller.rb b/app/controllers/titles_controller.rb
index f681879..03dd863 100644
--- a/app/controllers/titles_controller.rb
+++ b/app/controllers/titles_controller.rb
@@ -23,12 +23,10 @@ class TitlesController < ApplicationController
@msg = "Title " + @tsr.title_no + " is being downloaded."
end
- respond_to do |format|
- format.js {render :text => @msg}