humongous 0.1.1.pre → 0.1.2.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +11 -23
- data/VERSION +1 -1
- data/lib/humongous/application.rb +22 -28
- data/lib/humongous/public/javascripts/application.js +35 -22
- data/lib/humongous/public/styles/application.css +16 -0
- data/lib/humongous/views/index.erb +1 -1
- metadata +13 -13
data/README.markdown
CHANGED
@@ -4,41 +4,28 @@ Humongous: A Ruby way to browse and maintain MongoDB instances, using HTML5.
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
gem 'humongous', '0.1.0.pre'
|
10
|
-
|
11
|
-
then run
|
12
|
-
|
13
|
-
bundle install
|
7
|
+
#### Command Line Utility
|
14
8
|
|
15
|
-
|
9
|
+
Install the gem by running:
|
16
10
|
|
17
11
|
gem install humongous --pre
|
18
12
|
|
19
|
-
|
20
|
-
|
21
|
-
just require it by running
|
22
|
-
|
23
|
-
require 'humongous'
|
13
|
+
and run on terminal/console
|
24
14
|
|
25
|
-
|
26
|
-
|
27
|
-
Humongous.run!
|
28
|
-
|
29
|
-
#### Command Line Utility
|
15
|
+
humongous
|
30
16
|
|
31
|
-
|
17
|
+
And you are good to go it will open this in a browser or you can navigate it on port [9000](http://0.0.0.0:9000)
|
18
|
+
to stope the server run the command again with -K option
|
32
19
|
|
33
|
-
|
20
|
+
humongous -K
|
34
21
|
|
35
|
-
|
22
|
+
Command line options:
|
36
23
|
|
37
24
|
| **Options** | **What value do they take** |
|
38
25
|
|:----------------------|--------------------------------------------------------------------:|
|
39
26
|
| -K or --kill | kill the running process and exit |
|
40
27
|
| -S, --status | display the current running PID and URL then quit |
|
41
|
-
| -s, --server SERVER |
|
28
|
+
| -s, --server SERVER | serve using SERVER (thin/mongrel/webrick) |
|
42
29
|
| -o, --host HOST | listen on HOST (default: 0.0.0.0) |
|
43
30
|
| -p, --port PORT | use PORT (default: 9000) |
|
44
31
|
| -x, --no-proxy | ignore env proxy settings (e.g. http_proxy) |
|
@@ -48,6 +35,7 @@ on console/terminal run
|
|
48
35
|
| --app-dir APP_DIR | set the app dir where files are stored("~/.humongous") |
|
49
36
|
| -h, --help | Show this message |
|
50
37
|
|
38
|
+
|
51
39
|
## Credits
|
52
40
|
|
53
41
|
* [MongoHub](http://mongohub.todayclose.com/) (For giving inspiration for simplest UI and navigation.)
|
@@ -68,7 +56,7 @@ There are lot of things and area to improve and develop. Since it in pre release
|
|
68
56
|
* Better documentation
|
69
57
|
* Example series
|
70
58
|
|
71
|
-
## Contributing to
|
59
|
+
## Contributing to Humongous
|
72
60
|
|
73
61
|
* Fork, branch, code, and then send me a pull request. :)
|
74
62
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2.pre
|
@@ -6,9 +6,7 @@ module Humongous
|
|
6
6
|
username: "",
|
7
7
|
password: ""
|
8
8
|
}
|
9
|
-
|
10
|
-
set :port, 9494
|
11
|
-
|
9
|
+
|
12
10
|
dir = File.dirname(File.expand_path(__FILE__))
|
13
11
|
|
14
12
|
set :views, "#{dir}/views"
|
@@ -22,11 +20,25 @@ module Humongous
|
|
22
20
|
set :static, true
|
23
21
|
|
24
22
|
before do
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
@connection = Mongo::Connection.from_uri(get_uri)
|
24
|
+
end
|
25
|
+
|
26
|
+
error Mongo::ConnectionFailure do
|
27
|
+
[502, headers, "Humongous is unable to find MongoDB instance. Check your MongoDB connection."]
|
28
|
+
end
|
29
|
+
|
30
|
+
helpers do
|
31
|
+
|
32
|
+
def get_uri(params = {})
|
33
|
+
@options = DEFAULT_OPTIONS
|
34
|
+
@options = @options.merge(params)
|
35
|
+
unless @options[:username].empty? && @options[:password].empty?
|
36
|
+
"mongodb://#{@options[:username]}:#{@options[:password]}@#{@options[:url]}:#{@options[:port]}"
|
37
|
+
else
|
38
|
+
"mongodb://#{@options[:url]}:#{@options[:port]}"
|
39
|
+
end
|
29
40
|
end
|
41
|
+
|
30
42
|
end
|
31
43
|
|
32
44
|
get '/' do
|
@@ -42,7 +54,7 @@ module Humongous
|
|
42
54
|
content_type :json
|
43
55
|
{ collections: @database.collection_names, stats: @database.stats, header: @header_string }.to_json
|
44
56
|
end
|
45
|
-
|
57
|
+
|
46
58
|
get "/database/:db_name/collection/:collection_name" do
|
47
59
|
@database = @connection.db(params[:db_name])
|
48
60
|
@collection = @database.collection(params[:collection_name])
|
@@ -70,11 +82,7 @@ module Humongous
|
|
70
82
|
content_type :json
|
71
83
|
@records.to_json
|
72
84
|
end
|
73
|
-
|
74
|
-
get "/connection_failed" do
|
75
|
-
"<h1>Your Mongo Instance does not seems to be running</h1>"
|
76
|
-
end
|
77
|
-
|
85
|
+
|
78
86
|
post "/database/:db_name/collection/:collection_name/save" do
|
79
87
|
@database = @connection.db(params[:db_name])
|
80
88
|
@collection = @database.collection(params[:collection_name])
|
@@ -84,20 +92,6 @@ module Humongous
|
|
84
92
|
{ status: "OK", saved: true }.to_json
|
85
93
|
end
|
86
94
|
|
87
|
-
private
|
88
|
-
|
89
|
-
def load_defaults
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
def get_uri(params = {})
|
94
|
-
@options = DEFAULT_OPTIONS
|
95
|
-
@options = @options.merge(params)
|
96
|
-
unless @options[:username].empty? && @options[:password].empty?
|
97
|
-
"mongodb://#{@options[:username]}:#{@options[:password]}@#{@options[:url]}:#{@options[:port]}"
|
98
|
-
else
|
99
|
-
"mongodb://#{@options[:url]}:#{@options[:port]}"
|
100
|
-
end
|
101
|
-
end
|
102
95
|
end
|
96
|
+
|
103
97
|
end
|
@@ -1,30 +1,26 @@
|
|
1
1
|
$(document).ready(function(){
|
2
|
-
$('.database_list
|
3
|
-
|
4
|
-
|
2
|
+
$('.database_list tr').click( function( e ){
|
3
|
+
var data_source = $( e.target ).attr( "data-source" );
|
4
|
+
$( this ).siblings().removeClass('active');
|
5
|
+
$( this ).addClass( 'active' );
|
6
|
+
app.ax({
|
7
|
+
url: data_source,
|
8
|
+
type: 'GET',
|
5
9
|
success: function( data ){
|
6
|
-
console.log(data)
|
7
10
|
if( data && data.header ) app.helpers.header( data.header, false );
|
11
|
+
app.storage.remove("collection");
|
8
12
|
app.storage.set("database", $(e.target).text());
|
9
13
|
$( app.html.collection.create( data.collections ) ).appendTo( '.collections_list' );
|
10
14
|
app.helpers.yielder( app.html.stats, data.stats );
|
11
15
|
}
|
12
16
|
})
|
13
|
-
e.preventDefault();
|
14
|
-
} );
|
15
|
-
$('.collections_list a').live( 'click', function( e ){
|
16
|
-
$.ajax({
|
17
|
-
url: e.target,
|
18
|
-
success: function( data ){
|
19
|
-
if( data && data.header ) app.helpers.header( data.header, true );
|
20
|
-
app.storage.set("collection", $(e.target).text());
|
21
|
-
app.helpers.yielder( app.html.stats, data.stats );
|
22
|
-
// $( app.html.collection.create( JSON.parse( data ) ) ).appendTo( '.collections_list' );
|
23
|
-
}
|
24
|
-
})
|
25
|
-
e.preventDefault();
|
26
17
|
} );
|
27
18
|
$( '.query_link' ).live( 'click', function( e ){
|
19
|
+
var db = app.storage.get("database"), coll = app.storage.get("collection")
|
20
|
+
if(db && !coll){
|
21
|
+
alert("Please choose a collection first.")
|
22
|
+
return false;
|
23
|
+
}
|
28
24
|
app.helpers.yielder( app.html.query_browser, {} );
|
29
25
|
e.preventDefault();
|
30
26
|
} );
|
@@ -51,7 +47,11 @@ app.helpers.yielder = function( cb_function, arguments ){
|
|
51
47
|
app.helpers.header = function( new_header, query ){
|
52
48
|
query = query || false
|
53
49
|
$( '.header' ).text( new_header );
|
54
|
-
if(query)
|
50
|
+
if(query){
|
51
|
+
$( '.query_link' ).html( '<a href="#", class="btn primary">Query</a>' );
|
52
|
+
}else{
|
53
|
+
$( '.query_link' ).html( '' );
|
54
|
+
}
|
55
55
|
};
|
56
56
|
app.html.collection = {
|
57
57
|
selector: '.collections_list',
|
@@ -60,14 +60,13 @@ app.html.collection = {
|
|
60
60
|
},
|
61
61
|
create: function( collections ){
|
62
62
|
this.clear();
|
63
|
+
var self = this;
|
63
64
|
var db = app.storage.get("database");
|
64
65
|
var get_children = function( collections ){
|
65
66
|
var res = []
|
66
67
|
$.each( collections, function( _, v ){
|
67
|
-
res.push({ tag: "TR", children: [
|
68
|
-
{ tag: "TD",
|
69
|
-
{ tag: "A", href: '/database/' + db + '/collection/' + v, text: v }
|
70
|
-
] }
|
68
|
+
res.push({ tag: "TR", onClick: self._collection_handler, children: [
|
69
|
+
{ tag: "TD", "data-source": '/database/' + db + '/collection/' + v, text: v }
|
71
70
|
] });
|
72
71
|
} );
|
73
72
|
return res;
|
@@ -78,6 +77,20 @@ app.html.collection = {
|
|
78
77
|
] }
|
79
78
|
)
|
80
79
|
},
|
80
|
+
_collection_handler: function( e ){
|
81
|
+
var data_source = $( e.target ).attr( "data-source" );
|
82
|
+
$( this ).siblings().removeClass('active');
|
83
|
+
$( this ).addClass( 'active' );
|
84
|
+
app.ax({
|
85
|
+
url: data_source,
|
86
|
+
type: 'GET',
|
87
|
+
success: function( data ){
|
88
|
+
if( data && data.header ) app.helpers.header( data.header, true );
|
89
|
+
app.storage.set("collection", $(e.target).text());
|
90
|
+
app.helpers.yielder( app.html.stats, data.stats );
|
91
|
+
}
|
92
|
+
})
|
93
|
+
},
|
81
94
|
_el: function(){
|
82
95
|
return $(this.selector);
|
83
96
|
}
|
@@ -70,4 +70,20 @@ input.number{
|
|
70
70
|
}
|
71
71
|
.query_result{
|
72
72
|
min-height: 300;
|
73
|
+
}
|
74
|
+
tr.active{
|
75
|
+
color: #ffffff;
|
76
|
+
background-color: #0064cd;
|
77
|
+
background-repeat: repeat-x;
|
78
|
+
background-image: -khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd));
|
79
|
+
background-image: -moz-linear-gradient(top, #049cdb, #0064cd);
|
80
|
+
background-image: -ms-linear-gradient(top, #049cdb, #0064cd);
|
81
|
+
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd));
|
82
|
+
background-image: -webkit-linear-gradient(top, #049cdb, #0064cd);
|
83
|
+
background-image: -o-linear-gradient(top, #049cdb, #0064cd);
|
84
|
+
background-image: linear-gradient(top, #049cdb, #0064cd);
|
85
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0);
|
86
|
+
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
87
|
+
border-color: #0064cd #0064cd #003f81;
|
88
|
+
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
73
89
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: humongous
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2.pre
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-21 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: vegas
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153710460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.1.8
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153710460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sinatra
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153709700 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - =
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.3.2
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153709700
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bson_ext
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153705480 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - =
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.5.2
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153705480
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mongo
|
49
|
-
requirement: &
|
49
|
+
requirement: &2153704700 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - =
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.5.2
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2153704700
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: json
|
60
|
-
requirement: &
|
60
|
+
requirement: &2153703720 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - =
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.6.5
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2153703720
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: crack
|
71
|
-
requirement: &
|
71
|
+
requirement: &2153703200 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - =
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: 0.3.1
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2153703200
|
80
80
|
description: ! 'Humongous: A Ruby way to browse and maintain mongo instance. Using
|
81
81
|
HTML5.'
|
82
82
|
email: bagwanpankaj@gmail.com
|