Skip to content

Commit

Permalink
[ADD] changed to connect to remote
Browse files Browse the repository at this point in the history
  • Loading branch information
bagwanpankaj committed Feb 6, 2014
1 parent 5053d4b commit 9e1f48f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012 Bagwan Pankaj
Copyright (c) 2012-2014 Bagwan Pankaj

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ There are lot of things and area to improve and develop. Since it in pre release

## Copyright

Copyright (c) 2012 [Bagwan Pankaj]. See LICENSE.txt for further details.
Copyright (c) 2012-2014 [Bagwan Pankaj]. See LICENSE.txt for further details.

2 changes: 1 addition & 1 deletion humongous.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.required_ruby_version = '>= 1.8.7'
s.authors = ["bagwanpankaj"]
s.date = "2012-02-20"
s.date = "2014-02-06"
s.description = "Humongous: A Ruby way to browse and maintain mongo instance. Using HTML5."
s.email = "bagwanpankaj@gmail.com"
s.executables = ["humongous"]
Expand Down
8 changes: 8 additions & 0 deletions lib/humongous/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ class Application < Sinatra::Base
halt 401, {'Content-Type' => 'text/javascript'}, { :errmsg => "Need to login", :ok => false }.to_json
end

error Mongo::InvalidNSName do
halt 502, headers, "Humongous is unable to find MongoDB instance. Make sure that MongoDB is running."
end

error Mongo::AuthenticationError do
halt 502, headers, "Humongous is unable to find MongoDB instance. Make sure that MongoDB is running."
end

helpers { include Humongous::Helpers::SinatraHelpers }

reciever = lambda do
Expand Down
6 changes: 3 additions & 3 deletions lib/humongous/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module SinatraHelpers

def connection(params)
opts = opts_to_connect(params)
session[:connection] ||= Mongo::Connection.new(opts[:url], opts[:port])
session[:connection] = Mongo::Connection.new(opts[:url], opts[:port])
end

def autanticate!
@connection.apply_saved_authentication and return unless @connection.auths.blank?
return if params[:auth].blank?
return if params[:auth].blank? || params[:auth][:db].blank?
@connection.add_auth(params[:auth][:db], params[:auth][:username], params[:auth][:password])
@connection.apply_saved_authentication
end
Expand All @@ -24,7 +24,7 @@ def opts_to_connect(params = {})
:password => ""
}
return @options if params.blank?
@options.merge({ :url => params[:url], :port => params[:port], :freeze => true })
@options.merge!({ :url => params[:url], :port => params[:port], :freeze => true })
end

def get_uri(params = {})
Expand Down
4 changes: 2 additions & 2 deletions lib/humongous/public/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ $(document).ready(function(){
backdrop: "static"
});
$("#login_dialog a").click( function(e){
if(validate("#login_dialog .modal-body form")){
// if(validate("#login_dialog .modal-body form")){
$("#login_dialog .modal-body form").submit();
}
// }
e.preventDefault();
});
$("#loader").bind("ajaxSend", function(){
Expand Down
2 changes: 1 addition & 1 deletion lib/humongous/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Humongous
VERSION = "0.2.0"
VERSION = "1.0.0"
end
10 changes: 6 additions & 4 deletions lib/humongous/views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<a class="brand" href="#">Humongous</a>
<ul class="nav">
<li class="active"><a href="#">Mongo</a></li>
<li><a href="#" data-target="#login_dialog" data-toggle="modal" onClick="$('#login_dialog').modal();">Login</a></li>
<li><a data-controls-modal="credits" data-backdrop="true" data-keyboard="true">About</a></li>
<li><a data-controls-modal="license" data-backdrop="true" data-keyboard="true">License</a></li>
</ul>
Expand Down Expand Up @@ -133,7 +134,7 @@
</ul>
</div>
</div>
<div class="modal-footer"><span>&copy; Bagwan Pankaj 2012</span></div>
<div class="modal-footer"><span>&copy; Bagwan Pankaj 2012-2014</span></div>
</div>

<div id="license" style="display:none" class="modal hide fade">
Expand All @@ -142,7 +143,7 @@
<h3>Humongous License</h3>
</div>
<div class="modal-body">
<p>Copyright (c) 2012 Bagwan Pankaj</p>
<p>Copyright (c) 2012-2014 Bagwan Pankaj</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand All @@ -166,7 +167,7 @@
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</p>
</div>
<div class="modal-footer"><span>&copy; Bagwan Pankaj 2012</span></div>
<div class="modal-footer"><span>&copy; Bagwan Pankaj 2012-2014</span></div>
</div>
<div id="loader" style="display:none" class="modal">
<div class="modal-body">
Expand All @@ -175,6 +176,7 @@
</div>
<div id="login_dialog" style="display:none" class="modal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<!-- <a href="#" class="close">x</a> -->
<h3>Provide MongoDB Access Credentials</h3>
</div>
Expand Down Expand Up @@ -220,7 +222,7 @@
</div>

<footer>
<p>&copy; Bagwan Pankaj 2012</p>
<p>&copy; Bagwan Pankaj 2012-2014</p>
</footer>

</div> <!-- /container -->
Expand Down

0 comments on commit 9e1f48f

Please sign in to comment.