Permalink
Browse files

Actual initial commit.

  • Loading branch information...
bobthecow committed Oct 2, 2011
1 parent 654140b commit 0dbff4a3bf71b153b5c59937317ba907f9427052
Showing with 16,898 additions and 2 deletions.
  1. +2 −0 .gitignore
  2. +7 −0 .htaccess
  3. +9 −0 Gemfile
  4. +43 −0 Gemfile.lock
  5. +22 −0 LICENSE
  6. +17 −2 README.markdown
  7. +162 −0 Rakefile
  8. +3 −0 TODO.markdown
  9. +789 −0 genghis.php
  10. +48 −0 src/css/apprise.less
  11. +30 −0 src/css/base.less
  12. +275 −0 src/css/content.less
  13. +89 −0 src/css/overrides.less
  14. +98 −0 src/css/prettyprint.less
  15. +10 −0 src/css/style.less
  16. BIN src/img/favicon.png
  17. +1,158 −0 src/js/backbone.js
  18. +227 −0 src/js/bootstrap-modal.js
  19. +13 −0 src/js/extensions.js
  20. +36 −0 src/js/genghis/base/row_view.js
  21. +79 −0 src/js/genghis/base/section_view.js
  22. +11 −0 src/js/genghis/bootstrap.js
  23. +17 −0 src/js/genghis/collections/alerts.js
  24. +3 −0 src/js/genghis/collections/collections.js
  25. +3 −0 src/js/genghis/collections/databases.js
  26. +12 −0 src/js/genghis/collections/documents.js
  27. +3 −0 src/js/genghis/collections/servers.js
  28. +6 −0 src/js/genghis/models/alert.js
  29. +1 −0 src/js/genghis/models/collection.js
  30. +1 −0 src/js/genghis/models/database.js
  31. +38 −0 src/js/genghis/models/document.js
  32. +18 −0 src/js/genghis/models/pagination.js
  33. +107 −0 src/js/genghis/models/selection.js
  34. +1 −0 src/js/genghis/models/server.js
  35. +73 −0 src/js/genghis/router.js
  36. +155 −0 src/js/genghis/util.js
  37. +23 −0 src/js/genghis/views/alert.js
  38. +17 −0 src/js/genghis/views/alerts.js
  39. +58 −0 src/js/genghis/views/app.js
  40. +3 −0 src/js/genghis/views/collection_row.js
  41. +8 −0 src/js/genghis/views/collections.js
  42. +20 −0 src/js/genghis/views/database_row.js
  43. +8 −0 src/js/genghis/views/databases.js
  44. +16 −0 src/js/genghis/views/document.js
  45. +129 −0 src/js/genghis/views/document_view.js
  46. +43 −0 src/js/genghis/views/documents.js
  47. +26 −0 src/js/genghis/views/documents_header.js
  48. +72 −0 src/js/genghis/views/nav.js
  49. +29 −0 src/js/genghis/views/nav_section.js
  50. +63 −0 src/js/genghis/views/new_document.js
  51. +61 −0 src/js/genghis/views/pagination.js
  52. +3 −0 src/js/genghis/views/server_row.js
  53. +8 −0 src/js/genghis/views/servers.js
  54. +106 −0 src/js/jquery.hoverIntent.js
  55. +9 −0 src/js/jquery.hoverintent.min.js
  56. +9,044 −0 src/js/jquery.js
  57. +1,031 −0 src/js/jquery.tablesorter.js
  58. +839 −0 src/js/underscore.js
  59. +521 −0 src/php/Api.php
  60. +200 −0 src/php/App.php
  61. +34 −0 src/php/AssetResponse.php
  62. +17 −0 src/php/HttpException.php
  63. +549 −0 src/php/JsonDecoder.php
  64. +18 −0 src/php/JsonResponse.php
  65. +14 −0 src/php/RedirectResponse.php
  66. +63 −0 src/php/Response.php
  67. +32 −0 src/templates/error.html.mustache.erb
  68. +22 −0 src/templates/genghis.php.erb
  69. +39 −0 src/templates/index.html.mustache.erb
  70. +8 −0 src/templates/partials/alert.html.js
  71. +12 −0 src/templates/partials/collection-row.html.js
  72. +21 −0 src/templates/partials/collections.html.js
  73. +12 −0 src/templates/partials/database-row.html.js
  74. +21 −0 src/templates/partials/databases.html.js
  75. +14 −0 src/templates/partials/document-view.html.js
  76. +2 −0 src/templates/partials/document.html.js
  77. +10 −0 src/templates/partials/documents.html.js
  78. +10 −0 src/templates/partials/nav-section-menu.html.js
  79. +2 −0 src/templates/partials/nav-section.html.js
  80. +6 −0 src/templates/partials/nav.html.js
  81. +15 −0 src/templates/partials/new-document.html.js
  82. +25 −0 src/templates/partials/pagination.html.js
  83. +7 −0 src/templates/partials/popover.html.js
  84. +21 −0 src/templates/partials/server-row.html.js
  85. +21 −0 src/templates/partials/servers.html.js
View
@@ -0,0 +1,2 @@
+tmp/*
+pkg/*
View
@@ -0,0 +1,7 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+ # RewriteBase /genghis
+
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule (.*) genghis.php/$1 [L,QSA]
+</IfModule>
View
@@ -0,0 +1,9 @@
+source :rubygems
+gem 'rake'
+gem 'kicker'
+gem 'active_support'
+gem 'less'
+gem 'rainpress'
+gem 'uglifier'
+gem 'html_compressor'
+gem 'closure-compiler'
View
@@ -0,0 +1,43 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ POpen4 (0.1.4)
+ Platform (>= 0.4.0)
+ open4
+ Platform (0.4.0)
+ active_support (3.0.0)
+ activesupport (= 3.0.0)
+ activesupport (3.0.0)
+ closure-compiler (1.1.3)
+ execjs (1.2.4)
+ multi_json (~> 1.0)
+ html_compressor (0.0.3)
+ POpen4 (>= 0.1.4)
+ kicker (2.3.1)
+ rb-fsevent
+ less (2.0.6)
+ therubyracer (~> 0.9.2)
+ libv8 (3.3.10.2)
+ multi_json (1.0.3)
+ open4 (1.1.0)
+ rainpress (1.0)
+ rake (0.9.2)
+ rb-fsevent (0.4.3.1)
+ therubyracer (0.9.4)
+ libv8 (~> 3.3.10)
+ uglifier (1.0.3)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ active_support
+ closure-compiler
+ html_compressor
+ kicker
+ less
+ rainpress
+ rake
+ uglifier
View
22 LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2011 Justin Hileman
+
+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.
View
@@ -1,6 +1,21 @@
Genghis
=======
-A single-file MongoDB web client by Justin Hileman.
+A single-file MongoDB admin app by Justin Hileman.
-http://github.com/bobthecow/genghis
+http://genghisapp.com
+
+
+Installation
+------------
+
+Put `genghis.php` somewhere web accessible. If you want pretty urls, add `.htaccess` as well.
+
+That's pretty much it.
+
+
+License
+-------
+
+ * Copyright 2011 [Justin Hileman](http://justinhileman.com)
+ * Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)
View
162 Rakefile
@@ -0,0 +1,162 @@
+require 'rake/clean'
+require 'rake/packagetask'
+require 'yaml'
+require 'erb'
+require 'less'
+require 'rainpress'
+require 'uglifier'
+require 'closure-compiler'
+require 'html_compressor'
+require 'digest/md5'
+require 'base64'
+
+# sweet mixin action
+class String
+ def unindent
+ gsub(/^#{self[/\A\s*/]}/, '')
+ end
+end
+
+desc "Compile Genghis"
+task :build => 'build:all'
+
+namespace :build do
+ desc "Compile Genghis CSS assets"
+ task :css => [ 'tmp/style.css' ]
+
+ desc "Compile Genghis JavaScript assets"
+ task :js => [ 'tmp/script.js' ]
+
+ task :all => [ 'genghis.php', 'build:js', 'build:css' ]
+end
+
+directory 'tmp'
+
+file 'tmp/style.css' => FileList['tmp', 'src/css/*.less'] do
+ File.open('tmp/style.css', 'w') do |file|
+ file << <<-doc.unindent
+ /**
+ * Genghis
+ *
+ * The single-file MongoDB admin app
+ *
+ * http://genghisapp.com
+ *
+ * @author Justin Hileman <justin@justinhileman.info>
+ */
+ doc
+
+ parser = Less::Parser.new(:paths => ['./src/css'], :filename => 'src/css/style.less')
+ css = parser.parse(File.read('src/css/style.less')).to_css
+ file << (ENV['NOCOMPRESS'] ? css : Rainpress.compress(css))
+ end
+end
+
+script_files = FileList[
+ # vendor libraries
+ 'src/js/jquery.js',
+ 'src/js/jquery.hoverintent.js',
+ 'src/js/jquery.tablesorter.js',
+ 'src/js/bootstrap-modal.js',
+ 'src/js/underscore.js',
+ 'src/js/backbone.js',
+ 'vendor/ace/ace-uncompressed.js',
+ 'vendor/ace/mode-json.js',
+ 'vendor/ace/theme-git_hubby.js',
+ 'vendor/apprise/apprise-1.5.full.js',
+ 'vendor/bootstrap/js/bootstrap-twipsy.js',
+
+ # extensions
+ 'src/js/extensions.js',
+
+ # genghis app
+ 'src/js/genghis/bootstrap.js',
+ 'src/js/genghis/util.js',
+ 'src/js/genghis/base/**/*',
+ 'src/js/genghis/models/**/*',
+ 'src/js/genghis/collections/**/*',
+ 'src/js/genghis/views/**/*',
+ 'src/js/genghis/router.js'
+]
+file 'tmp/script.js' => ['tmp'] + script_files do
+ # ugly = Uglifier.new(:copyright => false)
+ ugly = Closure::Compiler.new
+ File.open('tmp/script.js', 'w') do |file|
+ file << <<-doc.unindent
+ /**
+ * Genghis
+ *
+ * The single-file MongoDB admin app
+ *
+ * http://genghisapp.com
+ *
+ * @author Justin Hileman <justin@justinhileman.info>
+ */
+ doc
+
+ js_src = script_files.map{ |s| File.read(s) }.join(";\n")
+ file << (ENV['NOCOMPRESS'] ? js_src : ugly.compile(js_src))
+ end
+end
+
+file 'tmp/index.html.mustache' => FileList[
+ 'tmp', 'src/templates/partials/*.html.js',
+ 'src/templates/index.html.mustache.erb', 'src/img/favicon.png'
+] do
+ File.open('tmp/index.html.mustache', 'w') do |file|
+ packer = HtmlCompressor::HtmlCompressor.new
+ # include partials
+ templates = FileList['src/templates/partials/*.html.js'].map do |name|
+ {
+ :name => name.sub(/^src\/templates\/partials\/(.*)\.html\.js$/, '\1'),
+ :content => ENV['NOCOMPRESS'] ? File.read(name) : packer.compress(File.read(name))
+ }
+ end
+
+ favicon_uri = "data:image/png;base64,#{Base64.encode64(File.read('src/img/favicon.png'))}"
+
+ index = ERB.new(File.read('src/templates/index.html.mustache.erb')).result(binding)
+ if ENV['NOCOMPRESS']
+ file << index
+ else
+ file << packer.compress(index)
+ end
+ end
+end
+
+file 'tmp/error.html.mustache' => FileList['tmp', 'src/templates/index.html.mustache.erb'] do
+ File.open('tmp/error.html.mustache', 'w') do |file|
+ packer = HtmlCompressor::HtmlCompressor.new
+
+ tpl = ERB.new(File.read('src/templates/error.html.mustache.erb')).result(binding)
+ if ENV['NOCOMPRESS']
+ file << tpl
+ else
+ file << packer.compress(tpl)
+ end
+ end
+end
+
+include_files = FileList['src/php/**/*.php']
+asset_files = ['tmp/index.html.mustache', 'tmp/error.html.mustache', 'tmp/style.css', 'tmp/script.js']
+file 'genghis.php' => include_files + asset_files do
+ File.open('genghis.php', 'w') do |file|
+ template = ERB.new(File.read('src/templates/genghis.php.erb'))
+
+ includes = include_files.map { |inc| ENV['NOCOMPRESS'] ? File.read(inc) : `php -w #{inc}` }
+ assets = asset_files.map do |asset|
+ content = File.read(asset)
+ { :name => asset.sub(/^tmp\//, ''), :content => content, :etag => Digest::MD5.hexdigest(content) }
+ end
+
+ file << template.result(binding)
+ end
+end
+
+Rake::PackageTask.new('genghis', :noversion) do |p|
+ p.need_tar = true
+ p.package_files.include('genghis.php', '.htaccess', 'README.markdown')
+end
+
+CLEAN.include('tmp/*')
+CLOBBER.include('tmp/*', 'genghis.php')
View
@@ -0,0 +1,3 @@
+ * history push back button quirks
+ * re-enable doubleclick to edit?
+ * more error messages
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,48 @@
+/* Apprise.less
+ * Thunk Apprise.js to work with Twitter Bootstrap styles.
+ * ------------------------------------------------------- */
+
+.appriseOverlay {
+ .modal-backdrop;
+}
+.appriseOuter {
+ .modal;
+
+ // Reset a few things
+ width: auto;
+ top: inherit;
+ left: inherit;
+ margin: 0;
+
+ // And apply the Apprise styles
+ min-width:200px;
+ min-height:50px;
+ max-width:75%;
+ display: none;
+}
+.appriseInner {
+ .modal-body;
+
+ button {
+ .btn;
+ &[value="ok"] {
+ .btn.primary;
+ }
+ &:last-child {
+ margin-left: 0;
+ }
+ }
+}
+.aButtons {
+ .modal-footer;
+ margin: 20px -15px -15px;
+ button {
+ .modal-footer .btn;
+ }
+}
+.aTextbox {
+ width: 94%;
+ min-width:180px;
+ display: block;
+ margin: 20px auto 0;
+}
View
@@ -0,0 +1,30 @@
+/* base styles */
+html, body {
+ margin: 0;
+ padding: 0;
+ color: @blackish;
+ background-color: #C4C4C4;
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAHJ0lEQVRo3n2aoU4sQRBF2z//kv0tNJqPwKMQaDQaNJoEh0YhkCRoNO/dSc7m7KUGMZnZme7q6urbVbeqd318fPz5/v7++/86fH5+Hp6eng55vr+/P7y8vGzPeff+/r59513uX19f23Nf5+fnh9fX1+17+uVOv1x3d3ebrDzzLWOkD+3SL1eeHx8fT+TnfWSk/cPDQ3T/szKJNLSCDMJAfrZCFsxz+ua6vb3d2mfAvM+gfKNt2nR/DIgRWgf6o0fkZg6LDwxoRRGUAfM+19nZ2dbWg8eathrWzCCsJPco5QmxciABxZHn91xtzLTfJoIwZt5KMShCuWNl+vt5b0Uju1eQOyuEbGShONCPjFzAK99WGmK5nqWXESsiPEIYGGF+tjGmCbCqGCqQYrzWJcqzmq0jSFrG7GRFY5eNa2tG8YaFlx8roghyLIPfNzc3R8XYI978+YaBGZPva8+iCEuHVj5CM2jvJe7p48kh03J4F0Wurq5OIDYZsp1QxsoYx4ng8tzIwrx8bPh+9sQDN2Dl70zcq5F3duMoZmcwvUu/TN57aSHcmHYnvE9DhzsrlP7EmQyeyQMp2k8bv+OUJ9p7BefSOqT/stUmKCGMy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4I3Ki6PPeCqXxcDmlCyVzzhpi3eIyiIJ+s6VxsQ4wbKqw9UcHVdZ53qr+3P96g2RvAJ1pSMOdGaDoT2KpAn7Bf8+04QtPUoATW0HBA73rDvULprXE2JuljnHL1P1nAgCwt11LRVUI7jtM4a3c7Wor33HzmEOZPdtQsUPuzpAkYX9tbectniQK3h1rWrqSLiqqRhbAVNY+xe+3wEw9h7Imd1atvLO1UQfRRBRogHsfXp46xxsuhe5ujg2S7cBsvzms5FJgLndJW8hT3k9na1XQezBzQc++SLc5Y+KZuK4sfN7rKj3aWtiVCUNM9xTDAkO9vsAOmYNTHkPs7AwA3jI9dyFT4vbQnTDLDYHqcL3s3TTEEyYAKmvU/vTRuxjWG636XW1UWDvdJNl3g6RTWc8F6d/PTpVbtcUx2Cr0umEyFF59XstAe3tadqeVdB7FYnZu2zxCaM8Kk+BJoojPfWttmBT9eW2NwM3MfCU7XPk2nv1XsAJcyfrKDdOumCEzf3iY6rc4lOZR11/UwfLO+95Qk4djQMJ3hOJdpOa1klG3mZErvj3inS3hGA+VDnIc1ym0HsHd81lKZJgYjVFQ0fiHolzLE6c2todTUkXMv/Euqo38dxPnfxeD6I9UHUds7+/Pz8lz+oOHW0i5yODzrb6xUyN6KQxwmwvZMDnQt6U2DFI3bdYPub0/X19fGPZ13qD8+3ICf//X8Tp8YOes53+qCI+rIVnpzCNCbGeHt72/549g/AFPWhrmuyXQAAAABJRU5ErkJggg==");
+}
+body {
+ padding-top: 60px;
+}
+h1, h2, h3, body > footer {
+ font-family: "Rokkitt", serif;
+ font-weight: 700;
+}
+body > footer {
+ font-weight: 400;
+ text-align: center;
+}
+a:link, a:visited {
+ color: #0058e1;
+}
+a:hover, a:active {
+ color: #111;
+}
+noscript h1 {
+ font-size: 2.2em;
+ text-align: center;
+ margin: 80px 40px;
+}
Oops, something went wrong.

0 comments on commit 0dbff4a

Please sign in to comment.