Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/2.3.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
bobthecow committed Jun 25, 2013
2 parents 5273971 + e111bae commit 2bdd2c7
Show file tree
Hide file tree
Showing 17 changed files with 4,616 additions and 5,341 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## v2.3.6

* Change grippie cursor to `row-resize` — Thanks @Zatsugami.
* Fix "unable to connect" errors for some driver versions (PHP backend) — Thanks @redexp.
* [Fix #117][i117] — Update JSON gem dependency (Ruby backend).
* [Fix #112][i112] — Add support for Sinatra v1.4.0 (Ruby backend).
* Support latest Mongo driver version (Ruby backend).
* Update to latest Bootstrap, CodeMirror, Esprima, Hogan.js, jQuery, Mousetrap and tablesorter vendor libraries.

[i117]: https://github.com/bobthecow/genghis/issues/117
[i112]: https://github.com/bobthecow/genghis/issues/112


## v2.3.5

* Improve "remove server" button and confirmation dialog to clarify that this removes settings but not data.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.5
2.3.6
40 changes: 20 additions & 20 deletions genghis.php

Large diffs are not rendered by default.

52 changes: 28 additions & 24 deletions genghis.rb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions genghisapp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Gem::Specification.new do |gem|
gem.rubyforge_project = 'genghisapp'

gem.add_dependency 'vegas', '~> 0.1.8'
gem.add_dependency 'sinatra', '~> 1.3.3'
gem.add_dependency 'sinatra-contrib', '~> 1.3.1'
gem.add_dependency 'sinatra', '>= 1.3.3', '< 1.5.0'
gem.add_dependency 'sinatra-contrib', '>= 1.3.1', '< 1.5.0'
gem.add_dependency 'sinatra-mustache', '>= 0.0.4', '< 0.2.0'
gem.add_dependency 'mongo', '~> 1.8.0'
gem.add_dependency 'json', '~> 1.7.0'
gem.add_dependency 'mongo', '>= 1.8.0', '<= 1.9.0'
gem.add_dependency 'json', '>= 1.7.0', '< 1.9.0'

gem.add_development_dependency 'rake'
gem.add_development_dependency 'active_support'
Expand Down
1 change: 1 addition & 0 deletions src/css/navbar.less
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
background-position: center center;
background-repeat: repeat-x;
border: none;
cursor: row-resize;
.opacity(50);
&:hover {
.opacity(100);
Expand Down
12 changes: 10 additions & 2 deletions src/php/Genghis/Models/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Genghis_Models_Server implements ArrayAccess, Genghis_JsonEncodable
public $default;
public $db;
public $error;
public $defaultOptions = array();

private $connection;
private $databases = array();
Expand All @@ -16,6 +17,12 @@ public function __construct($dsn, $default = false)
{
$this->default = $default;

if (version_compare(phpversion("mongo"), '1.3.4', '>=')) {
$this->defaultOptions['connectTimeoutMS'] = 1000;
} else {
$this->defaultOptions['timeout'] = 1000;
}

try {
$config = self::parseDsn($dsn);
$this->name = $config['name'];
Expand Down Expand Up @@ -60,7 +67,8 @@ public function offsetGet($name)
public function getConnection()
{
if (!isset($this->connection)) {
$this->connection = new Mongo($this->dsn, array_merge(array('connectTimeoutMS' => 1000), $this->options));
$class = class_exists('MongoClient') ? 'MongoClient' : 'Mongo';
$this->connection = new $class($this->dsn, array_merge($this->defaultOptions, $this->options));
}

return $this->connection;
Expand Down Expand Up @@ -149,7 +157,7 @@ public function asJson()
'databases' => $dbs,
));
} catch (Exception $e) {
$server['error'] = sprintf("Unable to connect to Mongo server at '%s'", $this->name);
$server['error'] = $e->getMessage();

return $server;
}
Expand Down
8 changes: 6 additions & 2 deletions src/rb/genghis/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ def page_param
end

def request_json
::JSON.parse request.body.read rescue raise Genghis::MalformedDocument.new
@request_json ||= ::JSON.parse request.body.read
rescue
raise Genghis::MalformedDocument.new
end

def request_genghis_json
::Genghis::JSON.decode request.body.read rescue raise Genghis::MalformedDocument.new
@request_genghis_json ||= ::Genghis::JSON.decode request.body.read
rescue
raise Genghis::MalformedDocument.new
end

def thunk_mongo_id(id)
Expand Down
10 changes: 5 additions & 5 deletions src/rb/genghis/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ def error_response(status, message)
end
end

not_found do
error_response(404, env['sinatra.error'].message.sub(/^Sinatra::NotFound$/, 'Not Found'))
end

error do
error 400..599 do
err = env['sinatra.error']
error_response(err.respond_to?(:http_status) ? err.http_status : 500, err.message)
end

not_found do
error_response(404, env['sinatra.error'].message.sub(/^Sinatra::NotFound$/, 'Not Found'))
end


### Asset routes ###

Expand Down
2 changes: 1 addition & 1 deletion src/templates/partials/servers.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</div>
<div class="add-form inactive form-horizontal">
<span class="input-append">
<input class="name span4" type="text" size="30"><span class="add-on help" title="user:pass@localhost:27017\db">?</span>
<input class="name span4" type="text" size="30"><span class="add-on help" title="user:pass@localhost:27017/db">?</span>
</span>
<button class="show btn">Add server</button>
<button class="add btn btn-primary">Add server</button>
Expand Down
2 changes: 1 addition & 1 deletion vendor/bootstrap
2 changes: 1 addition & 1 deletion vendor/codemirror
2 changes: 1 addition & 1 deletion vendor/esprima
2 changes: 1 addition & 1 deletion vendor/hogan
Submodule hogan updated 3 files
+5 −0 .npmignore
+1 −1 README.md
+1 −1 package.json
Loading

0 comments on commit 2bdd2c7

Please sign in to comment.