Skip to content

Commit

Permalink
Initial Release, code name: Simona
Browse files Browse the repository at this point in the history
  • Loading branch information
florinpatrascu committed Jul 16, 2012
1 parent 83ab967 commit 6e843e4
Show file tree
Hide file tree
Showing 70 changed files with 20,547 additions and 3 deletions.
Binary file added .DS_Store
Binary file not shown.
15 changes: 15 additions & 0 deletions .gitignore
@@ -1,3 +1,18 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global

# Ignore bundler config
/.bundle

# Ignore all logfiles and tempfiles.
/log/*.log
/tmp

.idea/*
/coverage
*.gem
*.rbc
.bundle
Expand Down
2 changes: 2 additions & 0 deletions .rspec
@@ -0,0 +1,2 @@
--colour
--format progress
3 changes: 3 additions & 0 deletions CHANGES.md
@@ -0,0 +1,3 @@
## 0.1.0 (2012-07-16)

* Initial Release, code name: Simona
3 changes: 3 additions & 0 deletions Gemfile
@@ -0,0 +1,3 @@
source 'http://rubygems.org'

gemspec
138 changes: 138 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,138 @@
PATH
remote: .
specs:
mongo_fe (0.1.0)
bson
bson_ext
chronic (~> 0.6.7)
coderay (~> 1.0.5)
haml (~> 3.1.4)
hashie
json
mongo (~> 1.6.2)
redcarpet (~> 2.1.0)
sinatra (~> 1.3.2)
sinatra-contrib (~> 1.3.1)
tilt (~> 1.3.0)
vegas (~> 0.1.11)
will_paginate (>= 3.0.0)
will_paginate-bootstrap
yajl-ruby

GEM
remote: http://rubygems.org/
specs:
activesupport (3.2.6)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.8)
appraisal (0.4.1)
bundler
rake
backports (2.6.1)
bson (1.6.4)
bson_ext (1.6.4)
bson (~> 1.6.4)
builder (3.0.0)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
childprocess (0.3.3)
ffi (~> 1.0.6)
chronic (0.6.7)
coderay (1.0.7)
cucumber (1.2.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.0)
json (>= 1.4.6)
diff-lcs (1.1.3)
eventmachine (0.12.10)
factory_girl (3.5.0)
activesupport (>= 3.0.0)
ffi (1.0.11)
gherkin (2.11.1)
json (>= 1.4.6)
haml (3.1.6)
hashie (1.2.0)
i18n (0.6.0)
json (1.7.3)
libwebsocket (0.1.3)
addressable
logger (1.2.8)
mime-types (1.19)
mongo (1.6.4)
bson (~> 1.6.4)
multi_json (1.3.6)
nokogiri (1.5.5)
rack (1.4.1)
rack-protection (1.2.0)
rack
rack-test (0.6.1)
rack (>= 1.0)
rake (0.9.2.2)
redcarpet (2.1.1)
rspec (2.9.0)
rspec-core (~> 2.9.0)
rspec-expectations (~> 2.9.0)
rspec-mocks (~> 2.9.0)
rspec-core (2.9.0)
rspec-expectations (2.9.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.9.0)
rubyzip (0.9.9)
selenium-webdriver (2.24.0)
childprocess (>= 0.2.5)
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
shoulda-matchers (1.1.0)
activesupport (>= 3.0.0)
simplecov (0.6.4)
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
sinatra-contrib (1.3.1)
backports (>= 2.0)
eventmachine
rack-protection
rack-test
sinatra (~> 1.3.0)
tilt (~> 1.3)
tilt (1.3.3)
vegas (0.1.11)
rack (>= 1.0.0)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
will_paginate (3.0.3)
will_paginate-bootstrap (0.2.1)
will_paginate (>= 3.0.3)
xpath (0.1.4)
nokogiri (~> 1.3)
yajl-ruby (1.1.0)

PLATFORMS
ruby

DEPENDENCIES
appraisal (~> 0.4.1)
bundler (~> 1.1.0)
capybara (~> 1.1.2)
cucumber
factory_girl (~> 3.0)
logger
mongo_fe!
rspec (~> 2.9.0)
shoulda-matchers (~> 1.1.0)
simplecov (>= 0.4.2)
webrat (~> 0.7.3)
22 changes: 22 additions & 0 deletions LICENSE
@@ -0,0 +1,22 @@
Copyright (c) 2012 Florin T.PĂTRAŞCU

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 2 additions & 0 deletions Procfile
@@ -0,0 +1,2 @@
# if you're using homebrew
mongodb: mongod run --rest --config /usr/local/Cellar/mongodb/2.0.6-x86_64/mongod.conf
74 changes: 71 additions & 3 deletions README.md
@@ -1,4 +1,72 @@
mongo_fe
========
# MongoFe

A simple Sinatra based web front-end that can be used for experimenting and learning MongoDB. It is also a Ruby gem :)
This is a simple Sinatra based web front-end that can be used for experimenting and learning MongoDB. The MongoFe gem can also be used for simple administrative tasks, managing collections and document basic operations such as: create new documents, delete existing ones, search by various criteria and document indexing.

## Installation

$ gem install mongo_fe

## Credentials

Create a file in your home directory called: `.mongo_fe`

In this file add the following:

uri: mongodb://localhost:27017

Examples:

uri: mongodb://nemo:clownfish@ds02231897.mongolab.com:33897/Reef

## Usage

Verify first that you have access to a MongoDB instance. [See the install guides](http://www.mongodb.org/display/DOCS/Quickstart/), if need be. I used the [Homebrew](http://mxcl.github.com/homebrew/) package manager to install mongodb. If you have Homebrew, run the following commands:

$ brew update
$ brew install mongodb

To start the MongoFe web server:

$ mongofe

or you can start the web server pointing it to a remote MongoDB url, example:

$ mongofe -C mongodb://sheppard:arterius@masseffect3.mongolab.com:33897/datamelee
$ mongofe -C mongodb://Genetically:Enhanced@"spiritual_successor.mongohq.com:10075/BioShock

(fictive links, real syntax)

MongoFe works well with remote MongoDB instances, see: [mongolab.com](https://mongolab.com/home) or [mongohq.com](https://mongohq.com), for example.

To stop the server:

$ mongofe -K

## Screenshots

In the mean time, I'd love for you to check out these screenshots to get a feel for MongoFe and see some of the administrative interfaces designed to make your day to day tasks easier.

**database info**
![Database info](https://img.skitch.com/20120716-g4cbs3yrrwifa5pscnafitw3hw.png)

**documents query and management**
![Documents view](https://img.skitch.com/20120716-nhjfsadxug7shnkfqmui5wc7qp.png)

**index management**
![Indexes view](https://img.skitch.com/20120716-c7bwmw31wr3kmsb9ebsufhsrtj.png)

Have fun!


## Contributing

* Fork it
* Create your feature branch (``git checkout -b my-new-feature``)
* Add some tests and please make sure they pass
* Commit your changes (``git commit -am 'Added some feature'``)
* Push to the branch (``git push origin my-new-feature``)
* Create new Pull Request

## License
MIT License

14 changes: 14 additions & 0 deletions Rakefile
@@ -0,0 +1,14 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"
require 'rspec/core/rake_task'

Bundler::GemHelper.install_tasks

desc 'Default: run tests.'
task :default => [:spec]

task :spec do
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = './spec/**/*_spec.rb'
end
end
9 changes: 9 additions & 0 deletions TODO.tasks
@@ -0,0 +1,9 @@
The following describes and discusses a set of functions to be added in the next releases

- improve the connection implementation
- enable the Javascript JSON editor; it is loaded but dormant right now
- add support for importing/exporting documents
- add support for geospatial indexes
- finalize and deploy the 'Collection::Tools' TAB, a set of useful MongoDB commands such as: find/replace/reindex/etc.
- add support for saving and restoring user preferences, including query objects
✓ make this list ;)
28 changes: 28 additions & 0 deletions bin/config.ru
@@ -0,0 +1,28 @@
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')

require 'bundler'
require "hashie/mash"
require 'cgi'
require "yaml"
require 'sinatra/base'
require 'mongo'
require 'mongo_fe'

begin
config = Hashie::Mash.new (YAML.load(File.new(File.expand_path('~/.mongo_fe')))) || 'localhost:27017'
MongoFe::MongoDB.uri = config.uri
rescue
$stderr.print "You must create a file in your home directory called .mongo_fe; error: #{$!.message}"
exit 1
end

# Encoding.default_internal = 'utf-8'
# Encoding.default_external = 'utf-8'

Dir.glob('../lib/{mongo_fe,mongo_fe/helpers,mongo_fe/controllers}/*.rb').each { |file| require file }

use MongoFe::ApplicationController
use MongoFe::DatabasesController
use MongoFe::CollectionsController

run Sinatra::Base
54 changes: 54 additions & 0 deletions bin/mongofe
@@ -0,0 +1,54 @@
#!/usr/bin/env ruby

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib])

require "hashie/mash"
require 'cgi'
require "yaml"
require 'sinatra/base'
require 'sinatra/contrib'
require 'mongo'
require 'mongo_fe'
require 'vegas'
require "uri"

require "mongo_fe/application_controller"
require "mongo_fe/controllers/databases_controller"
require "mongo_fe/controllers/collections_controller"
require "mongo_fe/helpers/helpers"

begin
config = Hashie::Mash.new (YAML.load(File.new(File.expand_path('~/.mongo_fe')))) || 'mongodb://localhost:27017'
MongoFe::MongoDB.uri = config.uri
rescue
$stderr.puts "You must create a file in your home directory called .mongo_fe; error: #{$!.message}"
exit 1
end

app = Rack::Builder.new do
# Dir.glob('../lib/{mongo_fe,mongo_fe/helpers,mongo_fe/controllers}/*.rb').each { |file| require file }

begin
use MongoFe::ApplicationController
use MongoFe::DatabasesController
use MongoFe::CollectionsController

run Sinatra::Base
rescue => e
$stderr.puts "Cannot load the app; error: #{$!.message}"
exit 1
end

end

Vegas::Runner.new( app, 'mongofe', {
:before_run => lambda { |v|
path = (ENV['MONGO_FE_CONFIG'] || v.args.first)
load path.to_s.strip if path
}
}) do |runner, opts, app|

opts.on('-C uri', "--connect uri", "set the MongodDB connection string") { |uri|
MongoFe::MongoDB.uri = uri
}
end

0 comments on commit 6e843e4

Please sign in to comment.