Skip to content
This repository
Browse code

Add postgres hstore recipe for adding hstore module to postgres 8.4

  • Loading branch information...
commit 7c007dcac23d0f7301c5f5ad24fdbdc29d6ea97f 1 parent dc23bfb
Valentino codenamev authored
7 lib/moonshine/manifest/rails/postgresql.rb
@@ -68,6 +68,13 @@ def postgresql_database
68 68 :notify => exec('rails_bootstrap')
69 69 end
70 70
  71 + # Include contrib module
  72 + def postgresql_hstore
  73 + exec "postgresql_hstore",
  74 + :command => "/usr/bin/psql -U postgres -d #{database_environment[:database]} -f /usr/share/postgresql/#{postgresql_version}/contrib/hstore.sql",
  75 + :user => 'postgres'
  76 + end
  77 +
71 78 private
72 79
73 80 def psql(query, options = {})
15 spec/moonshine/manifest/rails_spec.rb
@@ -450,6 +450,21 @@ def search(gem_pattern, platform_only = false)
450 450 @manifest.should exec_command('/usr/bin/createdb -O pg_username pg_database')
451 451 end
452 452
  453 + specify "#postgresql_hstore" do
  454 + @manifest.should_receive(:postgresql_version).and_return('8.4')
  455 + @manifest.should_receive(:database_environment).at_least(:once).and_return({
  456 + :username => 'pg_username',
  457 + :database => 'pg_database',
  458 + :password => 'pg_password'
  459 + })
  460 +
  461 + @manifest.postgresql_server
  462 + @manifest.postgresql_user
  463 + @manifest.postgresql_database
  464 +
  465 + @manifest.should exec_command('/usr/bin/psql -U postgres -d pg_database -f /usr/share/postgresql/8.4/contrib/hstore.sql')
  466 + end
  467 +
453 468 describe "#gem" do
454 469 before do
455 470 @manifest.gem 'rmagick'

0 comments on commit 7c007dc

Please sign in to comment.
Something went wrong with that request. Please try again.