heroku_mongoid 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm 1.8.7@hm --create
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in heroku_mongoid.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Heroku Mongoid
2
+
3
+ You know how when you setup MongoHQ in Heroku it creates this ENV variable
4
+ that works out of the box with MongoMapper, but it doesn't with Mongoid?
5
+
6
+ Well this gem just breaks ENV['MONGOHQ_URL'] into pieces that Mongoid can
7
+ use.
8
+
9
+ So, this:
10
+
11
+ ENV['MONGOHQ_URL'] = 'mongodb://heroku:93hk3fco1t063sftxv8z1a@flame.mongohq.com:27029/app111111'
12
+
13
+ Becomes this:
14
+
15
+ ENV['MONGOID_HOST'] = 'flame.mongohq.com'
16
+ ENV['MONGOID_PORT'] = '27029'
17
+ ENV['MONGOID_USERNAME'] = 'heroku'
18
+ ENV['MONGOID_PASSWORD'] = '93hk3fco1t063sftxv8z1a'
19
+ ENV['MONGOID_DATABASE'] = 'app111111'
20
+
21
+ ## Usage
22
+
23
+ Just include the gem on your Gemfile
24
+
25
+ gem "heroku_mongoid"
26
+
27
+ # About the Author
28
+
29
+ [Crowd Interactive](http://www.crowdint.com) is an American web design and development company that happens to work in Colima, Mexico.
30
+ We specialize in building and growing online retail stores. We don’t work with everyone – just companies we believe in. Call us today to see if there’s a fit.
31
+ Find more info [here](http://www.crowdint.com)!
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'bundler'
2
+ require 'rake/testtask'
3
+
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ task :default => :test
7
+
8
+ Rake::TestTask.new(:test) do |test|
9
+ test.libs << 'lib' << 'test'
10
+ test.pattern = 'test/**/*_test.rb'
11
+ test.verbose = true
12
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "heroku_mongoid/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "heroku_mongoid"
7
+ s.version = HerokuMongoid::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["David Padilla"]
10
+ s.email = ["david@crowdint.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Easy Mongoid settings on Heroku}
13
+ s.description = %q{Easy Mongoid settings on Heroku}
14
+
15
+ s.rubyforge_project = "heroku_mongoid"
16
+
17
+ s.add_development_dependency('minitest', '~>2.1.0')
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+ end
@@ -0,0 +1,3 @@
1
+ require 'heroku_mongoid/env'
2
+
3
+ HerokuMongoid::Env.break
@@ -0,0 +1,15 @@
1
+ module HerokuMongoid
2
+ class Env
3
+ REGEXP = /^mongodb:\/\/(\w+):(\w+)@([\w\.]+):(\d+)\/(\w+)$/
4
+
5
+ def self.break
6
+ REGEXP.match(ENV['MONGOHQ_URL'])
7
+
8
+ ENV['MONGOID_HOST'] = $3
9
+ ENV['MONGOID_PORT'] = $4
10
+ ENV['MONGOID_USERNAME'] = $1
11
+ ENV['MONGOID_PASSWORD'] = $2
12
+ ENV['MONGOID_DATABASE'] = $5
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module HerokuMongoid
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,15 @@
1
+ require 'test_helper'
2
+
3
+ describe HerokuMongoid do
4
+ it "sets the ENV variables required on Heroku" do
5
+ ENV['MONGOHQ_URL'] = 'mongodb://heroku:93hk3fco1t063sftxv8z1a@flame.mongohq.com:27029/app111111'
6
+
7
+ HerokuMongoid::Env.break
8
+
9
+ assert_equal 'flame.mongohq.com', ENV['MONGOID_HOST']
10
+ assert_equal '27029', ENV['MONGOID_PORT']
11
+ assert_equal 'heroku', ENV['MONGOID_USERNAME']
12
+ assert_equal '93hk3fco1t063sftxv8z1a', ENV['MONGOID_PASSWORD']
13
+ assert_equal 'app111111', ENV['MONGOID_DATABASE']
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'minitest/autorun'
5
+ require 'minitest/spec'
6
+
7
+ require 'heroku_mongoid'
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: heroku_mongoid
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - David Padilla
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-04-11 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: minitest
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 11
30
+ segments:
31
+ - 2
32
+ - 1
33
+ - 0
34
+ version: 2.1.0
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: Easy Mongoid settings on Heroku
38
+ email:
39
+ - david@crowdint.com
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - .gitignore
48
+ - .rvmrc
49
+ - Gemfile
50
+ - README.md
51
+ - Rakefile
52
+ - heroku_mongoid.gemspec
53
+ - lib/heroku_mongoid.rb
54
+ - lib/heroku_mongoid/env.rb
55
+ - lib/heroku_mongoid/version.rb
56
+ - test/heroku_mongoid_test.rb
57
+ - test/test_helper.rb
58
+ has_rdoc: true
59
+ homepage: ""
60
+ licenses: []
61
+
62
+ post_install_message:
63
+ rdoc_options: []
64
+
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ hash: 3
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ requirements: []
86
+
87
+ rubyforge_project: heroku_mongoid
88
+ rubygems_version: 1.3.7
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: Easy Mongoid settings on Heroku
92
+ test_files:
93
+ - test/heroku_mongoid_test.rb
94
+ - test/test_helper.rb