Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. @banker banker revised this gist Jan 28, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Rails MongoMapper Template.rb
    Original file line number Diff line number Diff line change
    @@ -63,7 +63,7 @@
    class ActiveSupport::TestCase
    # Drop all columns after each test case.
    # Drop all collections after each test case.
    def teardown
    MongoMapper.database.collections.each do |coll|
    coll.remove
  2. @banker banker revised this gist Dec 30, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Rails MongoMapper Template.rb
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@
    if defined?(PhusionPassenger)
    PhusionPassenger.on_event(:starting_worker_process) do |forked|
    MongoMapper.database.connect_to_master if forked
    MongoMapper.connection.connect_to_master if forked
    end
    end
    CODE
  3. @banker banker revised this gist Dec 17, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Rails MongoMapper Template.rb
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@
    run "rm public/javascripts/prototype.js"

    # add basic layout to start
    file 'app/views/layouts/application.html.erb', <<-HTML
    file 'app/views/layouts/application.html.erb', <<HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
  4. @banker banker revised this gist Nov 9, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Rails MongoMapper Template.rb
    Original file line number Diff line number Diff line change
    @@ -65,7 +65,7 @@
    class ActiveSupport::TestCase
    # Drop all columns after each test case.
    def teardown
    MongoMapper.connection.db('news-test').collections.each do |coll|
    MongoMapper.database.collections.each do |coll|
    coll.remove
    end
    end
  5. @banker banker revised this gist Nov 6, 2009. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions Rails MongoMapper Template.rb
    Original file line number Diff line number Diff line change
    @@ -34,6 +34,12 @@

    initializer 'database.rb', <<-CODE
    MongoMapper.database = "#{db_name}-\#{Rails.env}"
    if defined?(PhusionPassenger)
    PhusionPassenger.on_event(:starting_worker_process) do |forked|
    MongoMapper.database.connect_to_master if forked
    end
    end
    CODE

    file 'config/database.yml', <<-CODE
  6. @banker banker revised this gist Nov 2, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Rails MongoMapper Template.rb
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@
    db_name = ask('What should I call the database? ')

    initializer 'database.rb', <<-CODE
    MongoMapper.database = "#{db_name}-#{Rails.env}"
    MongoMapper.database = "#{db_name}-\#{Rails.env}"
    CODE

    file 'config/database.yml', <<-CODE
  7. @banker banker renamed this gist Nov 2, 2009. 1 changed file with 0 additions and 0 deletions.
  8. @banker banker revised this gist Nov 2, 2009. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions Rails MongoMapper Template
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,23 @@ run "rm public/javascripts/dragdrop.js"
    run "rm public/javascripts/effects.js"
    run "rm public/javascripts/prototype.js"

    # add basic layout to start
    file 'app/views/layouts/application.html.erb', <<-HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <title>Application!</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
    <%= stylesheet_link_tag 'global' %>
    </head>
    <body>
    <%= yield %>
    </body>
    </html>
    HTML

    # MongoDB FTW!
    db_name = ask('What should I call the database? ')

  9. @banker banker revised this gist Nov 2, 2009. 1 changed file with 0 additions and 17 deletions.
    17 changes: 0 additions & 17 deletions Rails MongoMapper Template
    Original file line number Diff line number Diff line change
    @@ -12,23 +12,6 @@ run "rm public/javascripts/dragdrop.js"
    run "rm public/javascripts/effects.js"
    run "rm public/javascripts/prototype.js"

    # add basic layout to start
    file 'app/views/layouts/application.html.erb', <<-HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <title>Application!</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
    <%= stylesheet_link_tag 'global' %>
    </head>
    <body>
    <%= yield %>
    </body>
    </html>
    HTML

    # MongoDB FTW!
    db_name = ask('What should I call the database? ')

  10. @banker banker renamed this gist Nov 2, 2009. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Rails MongoMapper Template.rb → Rails MongoMapper Template
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@
    run "rm public/javascripts/prototype.js"

    # add basic layout to start
    file 'app/views/layouts/application.html.erb', <<ERB
    file 'app/views/layouts/application.html.erb', <<-HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    @@ -27,7 +27,7 @@
    <%= yield %>
    </body>
    </html>
    ERB
    HTML

    # MongoDB FTW!
    db_name = ask('What should I call the database? ')
  11. @banker banker revised this gist Nov 2, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Rails MongoMapper Template.rb
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@
    run "rm public/javascripts/prototype.js"

    # add basic layout to start
    file 'app/views/layouts/application.html.erb', <<-ERB
    file 'app/views/layouts/application.html.erb', <<ERB
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
  12. @banker banker revised this gist Nov 2, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Rails MongoMapper Template.rb
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@
    db_name = ask('What should I call the database? ')

    initializer 'database.rb', <<-CODE
    MongoMapper.database = "#{db_name}-\#{Rails.env}"
    MongoMapper.database = "#{db_name}-#{Rails.env}"
    CODE

    file 'config/database.yml', <<-CODE
  13. @banker banker renamed this gist Nov 2, 2009. 1 changed file with 0 additions and 0 deletions.
  14. @banker banker revised this gist Nov 2, 2009. 1 changed file with 32 additions and 3 deletions.
    35 changes: 32 additions & 3 deletions Rails MongoMapper Template
    Original file line number Diff line number Diff line change
    @@ -46,10 +46,39 @@ environment 'config.frameworks -= [:active_record]'
    # MongoMapper
    gem 'mongo_mapper'

    # Testing
    # Testing Helper
    file 'test/test_helper.rb', <<-CODE
    ENV['RAILS_ENV'] = 'test'
    require File.expand_path(File.dirname(__FILE__) + '/../config/environment')
    require 'test_help'
    require 'shoulda'
    require 'mocha'
    require 'factory_girl'


    class ActiveSupport::TestCase
    # Drop all columns after each test case.
    def teardown
    MongoMapper.connection.db('news-test').collections.each do |coll|
    coll.remove
    end
    end

    # Make sure that each test case has a teardown
    # method to clear the db after each test.
    def inherited(base)
    base.define_method teardown do
    super
    end
    end
    end
    CODE

    # Testing tools
    gem 'redgreen'
    gem 'shoulda'
    gem 'factory_girl'
    gem 'mocha'
    gem 'thoughtbot-shoulda', :lib => 'shoulda/rails', :source => 'http://gems.github.com'

    # Gem management
    rake 'gems:install'
    @@ -70,4 +99,4 @@ FILES

    git :init
    git :add => '.'
    git :commit => '-a -m "Initial commit"'
    git :commit => '-a -m "Initial commit"'
  15. @banker banker revised this gist Nov 2, 2009. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Rails MongoMapper Template
    Original file line number Diff line number Diff line change
    @@ -52,6 +52,7 @@ gem 'mocha'
    gem 'thoughtbot-shoulda', :lib => 'shoulda/rails', :source => 'http://gems.github.com'

    # Gem management
    rake 'gems:install'
    rake 'gems:unpack'
    rake 'rails:freeze:gems'

  16. @banker banker revised this gist Oct 27, 2009. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Rails MongoMapper Template
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    # mongo_template.rb
    # fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
    #
    # To use:
    # rails project_name -m http://gist.github.com/gists/219223.txt

    # remove unneeded defaults
    run "rm public/index.html"
  17. @banker banker revised this gist Oct 27, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Rails MongoMapper Template
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # mongo_template.rb
    # fork of Ben Scofield's Rails Template (http://gist.github.com/181842)
    # fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)

    # remove unneeded defaults
    run "rm public/index.html"
  18. @banker banker renamed this gist Oct 27, 2009. 1 changed file with 5 additions and 7 deletions.
    12 changes: 5 additions & 7 deletions gistfile1.rb → Rails MongoMapper Template
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # mongo_template.rb
    # fork of Ben Scofield's Rails Template (http://gist.github.com/181842)

    # remove unneeded defaults
    run "rm public/index.html"
    @@ -36,24 +37,21 @@
    # Using MongoDB
    CODE

    # Don't need ActiveRecord
    environment 'config.frameworks -= [:active_record]'

    gem 'mongomapper'
    # MongoMapper
    gem 'mongo_mapper'

    # Testing and Cucumber
    # Testing
    gem 'redgreen'
    gem 'mocha'
    gem 'thoughtbot-shoulda', :lib => 'shoulda/rails', :source => 'http://gems.github.com'
    gem "cucumber"
    gem "webrat"

    # Gem management
    rake 'gems:unpack'
    rake 'rails:freeze:gems'

    # Finish Cucumber
    run './script/generate cucumber'

    # source control
    file '.gitignore', <<-FILES
    .DS_Store
  19. @bscofield bscofield revised this gist Sep 7, 2009. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -51,6 +51,9 @@
    rake 'gems:unpack'
    rake 'rails:freeze:gems'

    # Finish Cucumber
    run './script/generate cucumber'

    # source control
    file '.gitignore', <<-FILES
    .DS_Store
  20. @bscofield bscofield created this gist Sep 6, 2009.
    68 changes: 68 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    # mongo_template.rb

    # remove unneeded defaults
    run "rm public/index.html"
    run "rm public/images/rails.png"
    run "rm public/javascripts/controls.js"
    run "rm public/javascripts/dragdrop.js"
    run "rm public/javascripts/effects.js"
    run "rm public/javascripts/prototype.js"

    # add basic layout to start
    file 'app/views/layouts/application.html.erb', <<-ERB
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <title>Application!</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
    <%= stylesheet_link_tag 'global' %>
    </head>
    <body>
    <%= yield %>
    </body>
    </html>
    ERB

    # MongoDB FTW!
    db_name = ask('What should I call the database? ')

    initializer 'database.rb', <<-CODE
    MongoMapper.database = "#{db_name}-\#{Rails.env}"
    CODE

    file 'config/database.yml', <<-CODE
    # Using MongoDB
    CODE

    environment 'config.frameworks -= [:active_record]'

    gem 'mongomapper'

    # Testing and Cucumber
    gem 'redgreen'
    gem 'mocha'
    gem 'thoughtbot-shoulda', :lib => 'shoulda/rails', :source => 'http://gems.github.com'
    gem "cucumber"
    gem "webrat"

    # Gem management
    rake 'gems:unpack'
    rake 'rails:freeze:gems'

    # source control
    file '.gitignore', <<-FILES
    .DS_Store
    **/.DS_Store
    log/*
    tmp/*
    tmp/**/*
    config/database.yml
    coverage/*
    coverage/**/*
    FILES

    git :init
    git :add => '.'
    git :commit => '-a -m "Initial commit"'