mongo_web 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/README.markdown +31 -0
- data/bin/mongo-web +12 -0
- data/lib/server/views/collection.haml +15 -0
- data/lib/server/views/database.haml +15 -0
- data/lib/server/views/layout.haml +11 -0
- data/lib/server/views/overview.haml +7 -0
- data/lib/server/views/stylesheet.css +28 -0
- data/lib/server/views/stylesheet.sass +49 -0
- data/lib/server.rb +52 -0
- data/spec/mongo_web_spec.rb +6 -0
- metadata +110 -0
data/README.markdown
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Mongo_Web
|
2
|
+
========
|
3
|
+
|
4
|
+
Mongo_Web is the stylish way of inspecting MongoDB databases.
|
5
|
+
|
6
|
+
Installing
|
7
|
+
----------
|
8
|
+
|
9
|
+
gem install mongo_web
|
10
|
+
|
11
|
+
Usage
|
12
|
+
-----
|
13
|
+
|
14
|
+
Starting MongoWeb is simple
|
15
|
+
|
16
|
+
$ mongo-web
|
17
|
+
|
18
|
+
You can also pass it a specific port
|
19
|
+
|
20
|
+
$ mongo-web -p 6969
|
21
|
+
|
22
|
+
TODO
|
23
|
+
-----------
|
24
|
+
|
25
|
+
Support for:
|
26
|
+
* GridFS
|
27
|
+
* Editing Data
|
28
|
+
* Ports
|
29
|
+
* Usernames, passwords
|
30
|
+
|
31
|
+
![Screenshot] (http://img.skitch.com/20100430-jdmu6nxijpbmq5ur72gwayghs7.jpg)
|
data/bin/mongo-web
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
4
|
+
begin
|
5
|
+
require 'vegas'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'vegas'
|
9
|
+
end
|
10
|
+
require 'server'
|
11
|
+
|
12
|
+
Vegas::Runner.new(MongoWeb::Server, 'mongo-web')
|
@@ -0,0 +1,15 @@
|
|
1
|
+
-name = params[:name]
|
2
|
+
-collection = params[:collection]
|
3
|
+
|
4
|
+
%h2 #{name} >> #{collection} >> documents
|
5
|
+
|
6
|
+
%table
|
7
|
+
%tr
|
8
|
+
%th
|
9
|
+
%h3 Id
|
10
|
+
%th
|
11
|
+
%h3 Values
|
12
|
+
-for document in documents(name, collection)
|
13
|
+
%tr
|
14
|
+
%td= document['_id']
|
15
|
+
%td= document.inspect
|
@@ -0,0 +1,11 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title MongoWeb
|
5
|
+
%link{ :href => '/stylesheet.css', :media => 'screen', :rel => 'stylesheet', :type => 'text/css'}
|
6
|
+
%body
|
7
|
+
#wrapper
|
8
|
+
%h1 MongoWeb
|
9
|
+
#site= yield
|
10
|
+
%a{ :href => 'http://mongodb.org' }
|
11
|
+
%img{ :src => 'http://api.mongodb.org/wiki/current/attachments/132305/1605648.png' }
|
@@ -0,0 +1,28 @@
|
|
1
|
+
html {
|
2
|
+
background-color: #f6f4cd; }
|
3
|
+
|
4
|
+
#wrapper {
|
5
|
+
width: 800px;
|
6
|
+
margin-right: auto;
|
7
|
+
margin-left: auto; }
|
8
|
+
#wrapper #site {
|
9
|
+
padding: 15px;
|
10
|
+
background-color: #fdfcf7; }
|
11
|
+
#wrapper #site table {
|
12
|
+
border-collapse: collapse;
|
13
|
+
width: 100%;
|
14
|
+
text-align: left; }
|
15
|
+
#wrapper #site table a {
|
16
|
+
text-decoration: none;
|
17
|
+
color: black;
|
18
|
+
font-size: 1.2em;
|
19
|
+
font-weight: 600; }
|
20
|
+
#wrapper #site table a:hover {
|
21
|
+
text-decoration: underline; }
|
22
|
+
#wrapper #site table td {
|
23
|
+
padding: 10px;
|
24
|
+
border: 1px solid black; }
|
25
|
+
|
26
|
+
img {
|
27
|
+
float: right;
|
28
|
+
margin-top: 10 px; }
|
@@ -0,0 +1,49 @@
|
|
1
|
+
!dark_brown = #402817
|
2
|
+
!light_brown = #F6F4CD
|
3
|
+
!light_gray = #FDFCF7
|
4
|
+
|
5
|
+
=plain_anchor
|
6
|
+
a
|
7
|
+
text-decoration: none
|
8
|
+
color: black
|
9
|
+
font:
|
10
|
+
size: 1.2em
|
11
|
+
weight: 600
|
12
|
+
a:hover
|
13
|
+
text-decoration: underline
|
14
|
+
|
15
|
+
html
|
16
|
+
background-color= !light_brown
|
17
|
+
|
18
|
+
h2
|
19
|
+
margin: 0px
|
20
|
+
font-size: 1.3em
|
21
|
+
|
22
|
+
h3
|
23
|
+
margin:
|
24
|
+
top: 15px
|
25
|
+
bottom: 5px
|
26
|
+
|
27
|
+
#wrapper
|
28
|
+
width: 800px
|
29
|
+
margin:
|
30
|
+
right: auto
|
31
|
+
left: auto
|
32
|
+
#site
|
33
|
+
-webkit-border-radius: 15px
|
34
|
+
-moz-border-radius: 15px
|
35
|
+
border: 2px solid
|
36
|
+
color= !dark_brown
|
37
|
+
padding: 15px
|
38
|
+
background-color= !light_gray
|
39
|
+
table
|
40
|
+
+plain_anchor
|
41
|
+
border-collapse: collapse
|
42
|
+
width: 100%
|
43
|
+
text-align: left
|
44
|
+
td
|
45
|
+
padding: 10px
|
46
|
+
border: 1px solid black
|
47
|
+
img
|
48
|
+
float: right
|
49
|
+
margin-top: 10px
|
data/lib/server.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sinatra'
|
3
|
+
require 'haml'
|
4
|
+
require 'mongo'
|
5
|
+
|
6
|
+
module MongoWeb
|
7
|
+
class Server < Sinatra::Base
|
8
|
+
dir = File.dirname(File.expand_path(__FILE__))
|
9
|
+
set :views, "#{dir}/server/views"
|
10
|
+
set :static, true
|
11
|
+
set :haml, { :format => :html5 }
|
12
|
+
|
13
|
+
helpers do
|
14
|
+
def mongo
|
15
|
+
@mongo ||= Mongo::Connection.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def databases
|
19
|
+
mongo.database_names
|
20
|
+
end
|
21
|
+
|
22
|
+
def collections(database_name)
|
23
|
+
mongo.db(database_name).collections
|
24
|
+
end
|
25
|
+
|
26
|
+
def documents(database_name, collection_name)
|
27
|
+
mongo.db(database_name)[collection_name].find()
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
get '/' do
|
32
|
+
redirect '/overview'
|
33
|
+
end
|
34
|
+
|
35
|
+
get '/overview' do
|
36
|
+
haml :overview
|
37
|
+
end
|
38
|
+
|
39
|
+
get '/database/:name' do
|
40
|
+
haml :database
|
41
|
+
end
|
42
|
+
|
43
|
+
get '/database/:name/:collection' do
|
44
|
+
haml :collection
|
45
|
+
end
|
46
|
+
|
47
|
+
get '/stylesheet.css' do
|
48
|
+
content_type 'text/css', :charset => 'utf-8'
|
49
|
+
sass :stylesheet
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mongo_web
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Ethan Gunderson
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-30 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: mongo
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: vegas
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
segments:
|
40
|
+
- 0
|
41
|
+
- 1
|
42
|
+
- 2
|
43
|
+
version: 0.1.2
|
44
|
+
type: :runtime
|
45
|
+
version_requirements: *id002
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sinatra
|
48
|
+
prerelease: false
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
- 9
|
56
|
+
- 2
|
57
|
+
version: 0.9.2
|
58
|
+
type: :runtime
|
59
|
+
version_requirements: *id003
|
60
|
+
description: " Mongo_Web is a sinatra application for viewing MongoDB databases.\n \n If the code looks a lot like resque_web, that would be because I borrowed heavily from their implementation.\n"
|
61
|
+
email: ethan@ethangunderson.com
|
62
|
+
executables:
|
63
|
+
- mongo-web
|
64
|
+
extensions: []
|
65
|
+
|
66
|
+
extra_rdoc_files: []
|
67
|
+
|
68
|
+
files:
|
69
|
+
- README.markdown
|
70
|
+
- lib/server/views/collection.haml
|
71
|
+
- lib/server/views/database.haml
|
72
|
+
- lib/server/views/layout.haml
|
73
|
+
- lib/server/views/overview.haml
|
74
|
+
- lib/server/views/stylesheet.css
|
75
|
+
- lib/server/views/stylesheet.sass
|
76
|
+
- lib/server.rb
|
77
|
+
- bin/mongo-web
|
78
|
+
- spec/mongo_web_spec.rb
|
79
|
+
has_rdoc: true
|
80
|
+
homepage: http://github.com/ethangunderson/mongo_web
|
81
|
+
licenses: []
|
82
|
+
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
requirements: []
|
103
|
+
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 1.3.6
|
106
|
+
signing_key:
|
107
|
+
specification_version: 3
|
108
|
+
summary: A web interface for viewing MongoDB databases
|
109
|
+
test_files: []
|
110
|
+
|