├── tmp └── pids │ └── empty ├── .ruby-version ├── tasks ├── rakehelper.rb ├── gem.rake ├── job.rake └── heroku.rake ├── .coveralls.yml ├── .gitignore ├── test ├── examples │ └── sample-blog.git │ │ ├── HEAD │ │ ├── refs │ │ └── heads │ │ │ └── master │ │ ├── description │ │ ├── config │ │ ├── objects │ │ ├── 11 │ │ │ └── 992faecf562bbb2c61b2204a3127de2ee12334 │ │ ├── 26 │ │ │ └── 39904f3862ce5d03e5b2e170623e82db429759 │ │ ├── 27 │ │ │ └── 74b7649263d005cb3f20fe10433b2b4a38331c │ │ ├── 31 │ │ │ └── e1656029f748f12f2bafb16d178f2dc750898f │ │ ├── 41 │ │ │ └── 8d02bb8f340b39b22187accfb6eafba2dc371b │ │ ├── 45 │ │ │ └── eff3004e279198ef929df9b5cd8e3a4acd6f83 │ │ ├── 61 │ │ │ └── b271f3c22b5cced7ccb68e000287e73575ae19 │ │ ├── 72 │ │ │ └── cf7cd00432b7fa1b1a5a6c9816a8f40475c02d │ │ ├── 76 │ │ │ └── a56d9261863c7e4c0627105258cfcfdc9eb8ee │ │ ├── 09 │ │ │ └── 38f453a21cc470d172d353aaa6d1cc9a3665dd │ │ ├── 4f │ │ │ └── b2e631f02920ff5a32483f0a45510b2a06d835 │ │ ├── 6d │ │ │ └── 67c09ede6bf1dd09c61c175c9007ed1b06d9fd │ │ ├── 9c │ │ │ └── 3fff779a5b5706a180c3a84c3ed46317d1037e │ │ ├── 9d │ │ │ ├── b41e9e0deb7f6ffa7e4d06dc56c9eb1316b693 │ │ │ └── e0c333998d31283a90e0983e1e865e1333318d │ │ ├── bc │ │ │ └── da5867b55a878660b3431b815e7cb7c051bf64 │ │ ├── c0 │ │ │ └── 50d75c623cd4a558b8caa010feb487c8786eca │ │ ├── c1 │ │ │ └── 3b61a6115adef8fb9b87fb87a818b4095b7ea8 │ │ ├── d1 │ │ │ └── 1e3c9e553731278e9db746e6b2e204df247526 │ │ ├── d4 │ │ │ └── c6b64e785d44c6f97e00483fe26ad1ea269a26 │ │ ├── d6 │ │ │ └── ecb16f4ecb3c8a0cb3752c2e447e622e458d91 │ │ ├── dd │ │ │ └── 0d7ed109642d315916857fe9846cb352952b87 │ │ ├── e4 │ │ │ └── 3b74d098c234eb1d05925c71f43da6a49fabd5 │ │ └── fa │ │ │ └── a2241ced67495f860ab37e0c79932bd5b3b5e1 │ │ ├── hooks │ │ ├── post-commit.sample │ │ ├── post-update.sample │ │ ├── pre-applypatch.sample │ │ ├── applypatch-msg.sample │ │ ├── post-receive.sample │ │ ├── commit-msg.sample │ │ ├── prepare-commit-msg.sample │ │ ├── pre-commit.sample │ │ ├── update.sample │ │ └── pre-rebase.sample │ │ └── info │ │ └── exclude ├── helper.rb └── test_app.rb ├── .env ├── test.rb ├── unicorn.rb ├── lib ├── pagoda │ ├── public │ │ ├── images │ │ │ ├── fullscreen.png │ │ │ └── apple-touch-icon.png │ │ ├── js │ │ │ ├── jquery.autosize.js │ │ │ ├── keymaster.min.js │ │ │ ├── screenfull.js │ │ │ ├── jquery.tiptip.min.js │ │ │ ├── editor.coffee │ │ │ └── editor.js │ │ └── css │ │ │ ├── tiptip.css │ │ │ ├── pagoda.scss │ │ │ └── pagoda.css │ ├── views │ │ ├── settings.rb │ │ ├── home.rb │ │ ├── new_post.rb │ │ ├── edit.rb │ │ └── layout.rb │ ├── templates │ │ ├── settings.mustache │ │ ├── editor_area.mustache │ │ ├── new_post.mustache │ │ ├── layout.mustache │ │ ├── home.mustache │ │ └── edit.mustache │ ├── config.rb │ ├── jekyll_mod.rb │ ├── helper.rb │ └── app.rb └── workers │ ├── sidekiq.rb │ └── push_commit.rb ├── .travis.yml ├── config.rb ├── Gemfile ├── Rakefile ├── bin ├── pagoda-local.ru └── pagoda ├── config.ru ├── Changelog.md ├── LICENSE ├── pagoda.gemspec ├── Gemfile.lock └── README.md /tmp/pids/empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 1.9.3 2 | -------------------------------------------------------------------------------- /tasks/rakehelper.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.coveralls.yml: -------------------------------------------------------------------------------- 1 | service_name: travis-ci -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .sass-cache 2 | *gem 3 | coverage 4 | tmp/repo 5 | -------------------------------------------------------------------------------- /test/examples/sample-blog.git/HEAD: -------------------------------------------------------------------------------- 1 | ref: refs/heads/master 2 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | JEKYLL_REPO=git@github.com:alagu/pagoda-demo-blog.git 2 | PUSH_VIA_QUEUE=true -------------------------------------------------------------------------------- /test.rb: -------------------------------------------------------------------------------- 1 | puts File.dirname(File.expand_path File.dirname(File.dirname(__FILE__))) 2 | -------------------------------------------------------------------------------- /unicorn.rb: -------------------------------------------------------------------------------- 1 | pid "./tmp/pids/unicorn.pid" 2 | listen "unix:./tmp/sock/unicorn.sock" 3 | -------------------------------------------------------------------------------- /test/examples/sample-blog.git/refs/heads/master: -------------------------------------------------------------------------------- 1 | 72cf7cd00432b7fa1b1a5a6c9816a8f40475c02d 2 | -------------------------------------------------------------------------------- /test/examples/sample-blog.git/description: -------------------------------------------------------------------------------- 1 | Unnamed repository; edit this file 'description' to name the repository. 2 | -------------------------------------------------------------------------------- /lib/pagoda/public/images/fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/lib/pagoda/public/images/fullscreen.png -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | rvm: 2 | - 1.9.3 3 | notifications: 4 | email: 5 | - alagu@alagu.net 6 | before_install: 7 | - sudo apt-get update -------------------------------------------------------------------------------- /lib/pagoda/public/images/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/lib/pagoda/public/images/apple-touch-icon.png -------------------------------------------------------------------------------- /test/examples/sample-blog.git/config: -------------------------------------------------------------------------------- 1 | [core] 2 | repositoryformatversion = 0 3 | filemode = true 4 | bare = true 5 | ignorecase = true 6 | -------------------------------------------------------------------------------- /lib/pagoda/views/settings.rb: -------------------------------------------------------------------------------- 1 | module Shwedagon 2 | module Views 3 | class Settings < Layout 4 | 5 | def title 6 | "Settings" 7 | end 8 | end 9 | end 10 | end -------------------------------------------------------------------------------- /lib/pagoda/views/home.rb: -------------------------------------------------------------------------------- 1 | module Shwedagon 2 | module Views 3 | class Home < Layout 4 | attr_reader :drafts 5 | attr_reader :published 6 | 7 | 8 | end 9 | end 10 | end -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/09/38f453a21cc470d172d353aaa6d1cc9a3665dd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/09/38f453a21cc470d172d353aaa6d1cc9a3665dd -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/11/992faecf562bbb2c61b2204a3127de2ee12334: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/11/992faecf562bbb2c61b2204a3127de2ee12334 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/26/39904f3862ce5d03e5b2e170623e82db429759: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/26/39904f3862ce5d03e5b2e170623e82db429759 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/27/74b7649263d005cb3f20fe10433b2b4a38331c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/27/74b7649263d005cb3f20fe10433b2b4a38331c -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/31/e1656029f748f12f2bafb16d178f2dc750898f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/31/e1656029f748f12f2bafb16d178f2dc750898f -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/41/8d02bb8f340b39b22187accfb6eafba2dc371b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/41/8d02bb8f340b39b22187accfb6eafba2dc371b -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/45/eff3004e279198ef929df9b5cd8e3a4acd6f83: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/45/eff3004e279198ef929df9b5cd8e3a4acd6f83 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/4f/b2e631f02920ff5a32483f0a45510b2a06d835: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/4f/b2e631f02920ff5a32483f0a45510b2a06d835 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/61/b271f3c22b5cced7ccb68e000287e73575ae19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/61/b271f3c22b5cced7ccb68e000287e73575ae19 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/6d/67c09ede6bf1dd09c61c175c9007ed1b06d9fd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/6d/67c09ede6bf1dd09c61c175c9007ed1b06d9fd -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/72/cf7cd00432b7fa1b1a5a6c9816a8f40475c02d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/72/cf7cd00432b7fa1b1a5a6c9816a8f40475c02d -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/76/a56d9261863c7e4c0627105258cfcfdc9eb8ee: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/76/a56d9261863c7e4c0627105258cfcfdc9eb8ee -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/9c/3fff779a5b5706a180c3a84c3ed46317d1037e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/9c/3fff779a5b5706a180c3a84c3ed46317d1037e -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/9d/b41e9e0deb7f6ffa7e4d06dc56c9eb1316b693: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/9d/b41e9e0deb7f6ffa7e4d06dc56c9eb1316b693 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/9d/e0c333998d31283a90e0983e1e865e1333318d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/9d/e0c333998d31283a90e0983e1e865e1333318d -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/bc/da5867b55a878660b3431b815e7cb7c051bf64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/bc/da5867b55a878660b3431b815e7cb7c051bf64 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/c0/50d75c623cd4a558b8caa010feb487c8786eca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/c0/50d75c623cd4a558b8caa010feb487c8786eca -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/c1/3b61a6115adef8fb9b87fb87a818b4095b7ea8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/c1/3b61a6115adef8fb9b87fb87a818b4095b7ea8 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/d1/1e3c9e553731278e9db746e6b2e204df247526: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/d1/1e3c9e553731278e9db746e6b2e204df247526 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/d4/c6b64e785d44c6f97e00483fe26ad1ea269a26: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/d4/c6b64e785d44c6f97e00483fe26ad1ea269a26 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/d6/ecb16f4ecb3c8a0cb3752c2e447e622e458d91: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/d6/ecb16f4ecb3c8a0cb3752c2e447e622e458d91 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/dd/0d7ed109642d315916857fe9846cb352952b87: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/dd/0d7ed109642d315916857fe9846cb352952b87 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/e4/3b74d098c234eb1d05925c71f43da6a49fabd5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/e4/3b74d098c234eb1d05925c71f43da6a49fabd5 -------------------------------------------------------------------------------- /test/examples/sample-blog.git/objects/fa/a2241ced67495f860ab37e0c79932bd5b3b5e1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alagu/pagoda/HEAD/test/examples/sample-blog.git/objects/fa/a2241ced67495f860ab37e0c79932bd5b3b5e1 -------------------------------------------------------------------------------- /lib/workers/sidekiq.rb: -------------------------------------------------------------------------------- 1 | 2 | $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) 3 | 4 | require 'rubygems' 5 | require 'pagoda/app' 6 | require 'workers/push_commit' 7 | require 'dotenv' 8 | 9 | Dotenv.load -------------------------------------------------------------------------------- /lib/pagoda/views/new_post.rb: -------------------------------------------------------------------------------- 1 | module Shwedagon 2 | module Views 3 | class NewPost < Layout 4 | attr_reader :ptitle 5 | 6 | def title 7 | @ptitle 8 | end 9 | 10 | end 11 | end 12 | end -------------------------------------------------------------------------------- /config.rb: -------------------------------------------------------------------------------- 1 | http_path = "" 2 | css_dir = "lib/pagoda/public/css" 3 | sass_dir = "lib/pagoda/public/css" 4 | output_style = :expanded 5 | line_comments = false 6 | preferred_syntax = :scss 7 | relative_assets = true 8 | fonts_dir = "" -------------------------------------------------------------------------------- /test/examples/sample-blog.git/hooks/post-commit.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script that is called after a successful 4 | # commit is made. 5 | # 6 | # To enable this hook, rename this file to "post-commit". 7 | 8 | : Nothing 9 | -------------------------------------------------------------------------------- /test/examples/sample-blog.git/hooks/post-update.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to prepare a packed repository for use over 4 | # dumb transports. 5 | # 6 | # To enable this hook, rename this file to "post-update". 7 | 8 | exec git update-server-info 9 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | ruby '1.9.3' 2 | 3 | source 'https://rubygems.org' 4 | 5 | gemspec 6 | gem 'rake', '~> 10.0.3' 7 | 8 | # Test related 9 | gem 'simplecov', :require => false, :group => :test 10 | gem 'coveralls', require: false 11 | gem 'sshkey' 12 | gem 'highline' 13 | gem 'sidekiq' -------------------------------------------------------------------------------- /lib/pagoda/views/edit.rb: -------------------------------------------------------------------------------- 1 | module Shwedagon 2 | module Views 3 | class Edit < Layout 4 | attr_accessor :title 5 | attr_accessor :content 6 | attr_accessor :name 7 | attr_accessor :draft 8 | attr_accessor :data_array 9 | 10 | end 11 | end 12 | end -------------------------------------------------------------------------------- /test/examples/sample-blog.git/info/exclude: -------------------------------------------------------------------------------- 1 | # git ls-files --others --exclude-from=.git/info/exclude 2 | # Lines that start with '#' are comments. 3 | # For a project mostly in C, the following would be a good set of 4 | # exclude patterns (uncomment them if you want to use them): 5 | # *.[oa] 6 | # *~ 7 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'bundler' 3 | require 'rake' 4 | 5 | Bundler.setup 6 | 7 | Dir["tasks/*.rake"].sort.each { |ext| load ext } 8 | 9 | require 'rake/testtask' 10 | Rake::TestTask.new(:test) do |test| 11 | test.libs << 'lib' << 'test' 12 | test.pattern = 'test/**/test_*.rb' 13 | test.verbose = true 14 | end 15 | 16 | task :default => :test -------------------------------------------------------------------------------- /lib/pagoda/views/layout.rb: -------------------------------------------------------------------------------- 1 | require 'cgi' 2 | 3 | module Shwedagon 4 | module Views 5 | class Layout < Mustache 6 | include Rack::Utils 7 | alias_method :h, :escape_html 8 | 9 | attr_reader :name, :path 10 | 11 | def title 12 | "Home" 13 | end 14 | 15 | def base_url 16 | @base_url 17 | end 18 | 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /test/examples/sample-blog.git/hooks/pre-applypatch.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to verify what is about to be committed 4 | # by applypatch from an e-mail message. 5 | # 6 | # The hook should exit with non-zero status after issuing an 7 | # appropriate message if it wants to stop the commit. 8 | # 9 | # To enable this hook, rename this file to "pre-applypatch". 10 | 11 | . git-sh-setup 12 | test -x "$GIT_DIR/hooks/pre-commit" && 13 | exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"} 14 | : 15 | -------------------------------------------------------------------------------- /tasks/gem.rake: -------------------------------------------------------------------------------- 1 | require 'rake' 2 | 3 | # Publishing gem: 4 | # 5 | # $ bundle exec rake gem:publish 6 | 7 | namespace :gem do 8 | 9 | task :cleanup do 10 | puts "Cleaning up old gems" 11 | system "rm pagoda-jekyll*gem" 12 | end 13 | 14 | task :create do 15 | puts "Building new gem" 16 | system "gem build pagoda.gemspec" 17 | end 18 | 19 | task :publish => [:cleanup, :create] do 20 | gem_zip = `ls pagoda-jekyll*gem`.gsub("\n", "") 21 | command = "gem push #{gem_zip}" 22 | system command 23 | end 24 | end -------------------------------------------------------------------------------- /lib/pagoda/templates/settings.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | « Admin 5 |

SETTINGS

6 | 7 | 12 |
13 | -------------------------------------------------------------------------------- /test/examples/sample-blog.git/hooks/applypatch-msg.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to check the commit log message taken by 4 | # applypatch from an e-mail message. 5 | # 6 | # The hook should exit with non-zero status after issuing an 7 | # appropriate message if it wants to stop the commit. The hook is 8 | # allowed to edit the commit message file. 9 | # 10 | # To enable this hook, rename this file to "applypatch-msg". 11 | 12 | . git-sh-setup 13 | test -x "$GIT_DIR/hooks/commit-msg" && 14 | exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} 15 | : 16 | -------------------------------------------------------------------------------- /lib/workers/push_commit.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path(File.join(File.dirname(File.dirname(__FILE__)), "pagoda/helper")) 2 | 3 | 4 | class PushCommitWorker 5 | include Sidekiq::Worker 6 | 7 | def perform 8 | # Figure out how to include the common functions from helper to here. 9 | repo_path = File.expand_path("../../../", __FILE__) + "/tmp/repo" 10 | git_opts = {:raise=>true, :timeout=>false, :chdir => repo_path} 11 | 12 | repo = Grit::Repo.new(repo_path) 13 | Dir.chdir(repo_path) 14 | 15 | repo.git.push(git_opts, ["origin"]) 16 | end 17 | end -------------------------------------------------------------------------------- /bin/pagoda-local.ru: -------------------------------------------------------------------------------- 1 | $:.unshift File.join(File.dirname(__FILE__), *%w[lib]) 2 | 3 | require 'rubygems' 4 | require 'pagoda/app' 5 | require 'digest/md5' 6 | require 'sidekiq/web' 7 | require 'dotenv' 8 | 9 | Dotenv.load 10 | 11 | use Rack::ShowExceptions 12 | 13 | puts "\n============================\n\n\n" 14 | puts "Starting up Pagoda with #{ENV['JEKYLL_REPO']} as the remote repo" 15 | puts "\n\n============================\n" 16 | 17 | Shwedagon::App.set :repo_src, ENV['JEKYLL_REPO'] 18 | map ('/admin') { run Shwedagon::App.new } 19 | map ('/sidekiq') { run Sidekiq::Web.new } -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | $:.unshift File.join(File.dirname(__FILE__), *%w[lib]) 2 | 3 | require 'rubygems' 4 | require 'pagoda/app' 5 | require 'digest/md5' 6 | 7 | use Rack::ShowExceptions 8 | 9 | if ENV.has_key? 'HTTP_MESSAGE' 10 | message = ENV['HTTP_MESSAGE'] 11 | else 12 | message = "Private Blog" 13 | end 14 | 15 | use Rack::Auth::Basic, message do |username, password| 16 | md5_pass = Digest::MD5.hexdigest(password) 17 | [username, md5_pass] == [ENV['LOGIN_USER'], ENV['LOGIN_PASS']] 18 | end 19 | 20 | Shwedagon::App.set :repo_src, ENV['JEKYLL_REPO'] 21 | 22 | map ('/admin') { run Shwedagon::App.new } -------------------------------------------------------------------------------- /Changelog.md: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | 5 | **09 June 2013 - Configurable default YAML Structure** 6 | Version: 0.0.11 7 | 8 | 9 | **09 June 2013 - YAML Editor and UI Changes** 10 | Version: 0.0.10 11 | 12 | **YAML Editor** 13 | 14 | ![http://cl.ly/image/1K1B2y3O1241/Screen%20Shot%202013-06-09%20at%201.29.11%20PM.png](http://cl.ly/image/1K1B2y3O1241/Screen%20Shot%202013-06-09%20at%201.29.11%20PM.png) 15 | 16 | **Drafts UI minor change** 17 | 18 | 19 | ![http://cl.ly/image/0e1D0J1I202F/Screen%20Shot%202013-06-09%20at%201.30.14%20PM.png](http://cl.ly/image/0e1D0J1I202F/Screen%20Shot%202013-06-09%20at%201.30.14%20PM.png) 20 | -------------------------------------------------------------------------------- /lib/pagoda/config.rb: -------------------------------------------------------------------------------- 1 | # Configuration for the pagoda app 2 | module Shwedagon 3 | class App < Sinatra::Base 4 | 5 | register Mustache::Sinatra 6 | register Sinatra::Reloader 7 | 8 | 9 | dir = File.dirname(File.expand_path(__FILE__)) 10 | set :public_folder, "#{dir}/public" 11 | set :static, true 12 | 13 | set :mustache, { 14 | # Tell mustache where the Views constant lives 15 | :namespace => Shwedagon, 16 | 17 | # Mustache templates live here 18 | :templates => "#{dir}/templates", 19 | 20 | # Tell mustache where the views are 21 | :views => "#{dir}/views" 22 | } 23 | end 24 | end -------------------------------------------------------------------------------- /test/examples/sample-blog.git/hooks/post-receive.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script for the "post-receive" event. 4 | # 5 | # The "post-receive" script is run after receive-pack has accepted a pack 6 | # and the repository has been updated. It is passed arguments in through 7 | # stdin in the form 8 | # 9 | # For example: 10 | # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master 11 | # 12 | # see contrib/hooks/ for a sample, or uncomment the next line and 13 | # rename the file to "post-receive". 14 | 15 | #. /usr/share/doc/git-core/contrib/hooks/post-receive-email 16 | -------------------------------------------------------------------------------- /tasks/job.rake: -------------------------------------------------------------------------------- 1 | require 'rake' 2 | namespace :job do 3 | task :watch do 4 | coffee_pid = Process.spawn "coffee --compile --watch lib/pagoda/public/js/*.coffee" 5 | compass_pid = Process.spawn "compass watch ." 6 | 7 | [coffee_pid, compass_pid].each { |pid| Process.wait(pid) } 8 | end 9 | 10 | task :run do 11 | pagoda_pid = Process.spawn "bin/pagoda ../example-jekyll" 12 | coffee_pid = Process.spawn "coffee --compile --watch lib/pagoda/public/js/*.coffee" 13 | compass_pid = Process.spawn "compass watch ." 14 | 15 | [pagoda_pid, coffee_pid, compass_pid].each { |pid| Process.wait(pid) } 16 | end 17 | end 18 | 19 | task :watch => ["job:watch"] 20 | task :run => ["job:run"] -------------------------------------------------------------------------------- /lib/pagoda/templates/editor_area.mustache: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 | 6 | 7 |
8 | 9 |
10 | 11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /lib/pagoda/templates/new_post.mustache: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 |
6 | 7 | 8 | {{>editor_area}} 9 | 10 |
11 |
12 |
13 |
14 | « Admin 15 |
16 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 | 25 | -------------------------------------------------------------------------------- /lib/pagoda/jekyll_mod.rb: -------------------------------------------------------------------------------- 1 | module Jekyll 2 | class Site 3 | 4 | # Read all the files in //_posts and create a new Post 5 | # object only for draft items 6 | # 7 | # dir - The String relative path of the directory to read. 8 | # 9 | # Returns nothing. 10 | def read_drafts(dir = '') 11 | if self.respond_to? 'get_entries' 12 | entries = get_entries(dir, '_posts') 13 | else 14 | base = File.join(self.source, dir, '_posts') 15 | return unless File.exists?(base) 16 | entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } 17 | end 18 | 19 | drafts = [] 20 | 21 | # first pass processes, but does not yet render post content 22 | entries.each do |f| 23 | if Post.valid?(f) 24 | post = Post.new(self, self.source, dir, f) 25 | 26 | if (not post.published ) 27 | drafts << post 28 | end 29 | end 30 | end 31 | 32 | drafts 33 | end 34 | 35 | end 36 | end -------------------------------------------------------------------------------- /test/examples/sample-blog.git/hooks/commit-msg.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to check the commit log message. 4 | # Called by "git commit" with one argument, the name of the file 5 | # that has the commit message. The hook should exit with non-zero 6 | # status after issuing an appropriate message if it wants to stop the 7 | # commit. The hook is allowed to edit the commit message file. 8 | # 9 | # To enable this hook, rename this file to "commit-msg". 10 | 11 | # Uncomment the below to add a Signed-off-by line to the message. 12 | # Doing this in a hook is a bad idea in general, but the prepare-commit-msg 13 | # hook is more suited to it. 14 | # 15 | # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') 16 | # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" 17 | 18 | # This example catches duplicate Signed-off-by lines. 19 | 20 | test "" = "$(grep '^Signed-off-by: ' "$1" | 21 | sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { 22 | echo >&2 Duplicate Signed-off-by lines. 23 | exit 1 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2007-2009 Allagappan Muthuraman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /bin/pagoda: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) 4 | 5 | 6 | 7 | help = < 4567, 'bind' => '0.0.0.0' } 24 | 25 | opts = OptionParser.new do |opts| 26 | opts.banner = help 27 | 28 | opts.on("--port [PORT]", "Bind port (default 4567).") do |port| 29 | options['port'] = port.to_i 30 | end 31 | end 32 | 33 | if ARGV.length == 0 34 | puts "Hello, please pass repository as a parameter.\n\n" 35 | puts " $ bin/pagoda git@github.com:user/repo\n\n" 36 | exit 37 | else 38 | repo_src = ARGV.first 39 | end 40 | 41 | # Read command line options into `options` hash 42 | begin 43 | opts.parse! 44 | 45 | rescue OptionParser::InvalidOption 46 | puts "pagoda: #{$!.message}" 47 | puts "pagoda: try 'pagoda --help' for more information" 48 | exit 49 | end 50 | 51 | Shwedagon::App.set :repo_src, repo_src 52 | Shwedagon::App.run!(options) -------------------------------------------------------------------------------- /lib/pagoda/templates/layout.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | {{title}} 24 | 25 | 26 | {{{yield}}} 27 | 28 | -------------------------------------------------------------------------------- /test/examples/sample-blog.git/hooks/prepare-commit-msg.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to prepare the commit log message. 4 | # Called by "git commit" with the name of the file that has the 5 | # commit message, followed by the description of the commit 6 | # message's source. The hook's purpose is to edit the commit 7 | # message file. If the hook fails with a non-zero status, 8 | # the commit is aborted. 9 | # 10 | # To enable this hook, rename this file to "prepare-commit-msg". 11 | 12 | # This hook includes three examples. The first comments out the 13 | # "Conflicts:" part of a merge commit. 14 | # 15 | # The second includes the output of "git diff --name-status -r" 16 | # into the message, just before the "git status" output. It is 17 | # commented because it doesn't cope with --amend or with squashed 18 | # commits. 19 | # 20 | # The third example adds a Signed-off-by line to the message, that can 21 | # still be edited. This is rarely a good idea. 22 | 23 | case "$2,$3" in 24 | merge,) 25 | /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; 26 | 27 | # ,|template,) 28 | # /usr/bin/perl -i.bak -pe ' 29 | # print "\n" . `git diff --cached --name-status -r` 30 | # if /^#/ && $first++ == 0' "$1" ;; 31 | 32 | *) ;; 33 | esac 34 | 35 | # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') 36 | # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" 37 | -------------------------------------------------------------------------------- /lib/pagoda/templates/home.mustache: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 |
6 |

Drafts New Draft

7 |
8 | 12 |
13 | 14 |
    15 | {{#drafts}} 16 |
  • 17 |

    18 | {{title}} 19 | 20 | view 21 | x 22 | 23 |

    24 |
  • 25 | {{/drafts}} 26 |
27 |
28 | 29 |
30 |

Published 31 | Settings

32 |
    33 | {{#published}} 34 |
  • 35 |

    36 | {{title}} 37 | 38 | view 39 | x 40 | 41 |

    42 |
  • 43 | {{/published}} 44 |
45 | 46 |
47 |
-------------------------------------------------------------------------------- /test/examples/sample-blog.git/hooks/pre-commit.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to verify what is about to be committed. 4 | # Called by "git commit" with no arguments. The hook should 5 | # exit with non-zero status after issuing an appropriate message if 6 | # it wants to stop the commit. 7 | # 8 | # To enable this hook, rename this file to "pre-commit". 9 | 10 | if git rev-parse --verify HEAD >/dev/null 2>&1 11 | then 12 | against=HEAD 13 | else 14 | # Initial commit: diff against an empty tree object 15 | against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 16 | fi 17 | 18 | # If you want to allow non-ascii filenames set this variable to true. 19 | allownonascii=$(git config hooks.allownonascii) 20 | 21 | # Cross platform projects tend to avoid non-ascii filenames; prevent 22 | # them from being added to the repository. We exploit the fact that the 23 | # printable range starts at the space character and ends with tilde. 24 | if [ "$allownonascii" != "true" ] && 25 | # Note that the use of brackets around a tr range is ok here, (it's 26 | # even required, for portability to Solaris 10's /usr/bin/tr), since 27 | # the square bracket bytes happen to fall in the designated range. 28 | test "$(git diff --cached --name-only --diff-filter=A -z $against | 29 | LC_ALL=C tr -d '[ -~]\0')" 30 | then 31 | echo "Error: Attempt to add a non-ascii file name." 32 | echo 33 | echo "This can cause problems if you want to work" 34 | echo "with people on other platforms." 35 | echo 36 | echo "To be portable it is advisable to rename the file ..." 37 | echo 38 | echo "If you know what you are doing you can disable this" 39 | echo "check using:" 40 | echo 41 | echo " git config hooks.allownonascii true" 42 | echo 43 | exit 1 44 | fi 45 | 46 | exec git diff-index --check --cached $against -- 47 | -------------------------------------------------------------------------------- /pagoda.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.specification_version = 2 if s.respond_to? :specification_version= 3 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= 4 | s.rubygems_version = '1.3.5' 5 | s.required_ruby_version = ">= 1.8.7" 6 | 7 | s.name = 'pagoda-jekyll' 8 | s.version = '0.0.11' 9 | s.date = '2013-06-09' 10 | s.rubyforge_project = 'pagoda-jekyll' 11 | 12 | s.summary = "A simple admin for Jekyll" 13 | s.description = "Admin interface for Jekyll that makes you comfortable writing" 14 | 15 | s.authors = ["Alagu"] 16 | s.email = 'alagu@alagu.net' 17 | s.homepage = 'http://github.com/alagu/pagoda' 18 | 19 | s.require_paths = %w[lib] 20 | 21 | s.executables = ["pagoda"] 22 | 23 | s.rdoc_options = ["--charset=UTF-8"] 24 | s.extra_rdoc_files = %w[README.md LICENSE] 25 | 26 | s.add_dependency('jekyll') 27 | s.add_dependency('grit') 28 | s.add_dependency('json') 29 | s.add_dependency('stringex') 30 | s.add_dependency('sinatra-mustache') 31 | s.add_dependency('sinatra') 32 | s.add_dependency('sinatra-reloader') 33 | 34 | s.add_development_dependency('compass') 35 | s.add_development_dependency('fssm') 36 | s.add_development_dependency('rack-test') 37 | s.add_development_dependency('dotenv') 38 | s.add_development_dependency('shoulda') 39 | s.add_development_dependency('minitest-reporters') 40 | 41 | 42 | # = MANIFEST = 43 | s.files = Dir['bin/*'] + Dir['lib/**/*'] + 44 | %w[ 45 | config.rb 46 | config.ru 47 | Gemfile 48 | Gemfile.lock 49 | LICENSE 50 | pagoda.gemspec 51 | Rakefile 52 | unicorn.rb 53 | ] 54 | # = MANIFEST = 55 | 56 | s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ } 57 | end 58 | -------------------------------------------------------------------------------- /lib/pagoda/templates/edit.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 | {{>editor_area}} 7 |
8 |
9 |
10 |
11 | « ADMIN 12 | {{alagu}} 13 |
14 |
15 |
16 |
    17 | {{#data_array}} 18 |
  • 19 |
    20 |
    21 |
  • 22 | {{/data_array}} 23 |
  • Add new item
  • 24 |
25 |
26 |
27 | DATA 28 |
29 |
30 |
31 | 32 |
33 | DRAFT 34 | DONE 35 |
36 | 37 |
38 |
39 |
40 |
41 |
42 | 46 |
47 | 48 | -------------------------------------------------------------------------------- /lib/pagoda/public/js/jquery.autosize.js: -------------------------------------------------------------------------------- 1 | /*! 2 | jQuery Autosize v1.16.7 3 | (c) 2013 Jack Moore - jacklmoore.com 4 | updated: 2013-03-20 5 | license: http://www.opensource.org/licenses/mit-license.php 6 | */ 7 | (function(e){var t,o,n={className:"autosizejs",append:"",callback:!1},i="hidden",s="border-box",a="lineHeight",l='