GLI basics, with Aruba/Cucumber in place. Note that there is Gemfile in octopress subdir - what is going to be the new root structure at some point.

This commit is contained in:
Adam Williams 2011-12-15 11:04:12 -05:00
parent fca7f10fe9
commit dc99730a8b
12 changed files with 234 additions and 0 deletions

1
octopress/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
vendor/ruby

2
octopress/Gemfile Normal file
View File

@ -0,0 +1,2 @@
source :rubygems
gemspec

50
octopress/Gemfile.lock Normal file
View File

@ -0,0 +1,50 @@
PATH
remote: .
specs:
octopress (0.0.1)
gli (~> 1.4.0)
GEM
remote: http://rubygems.org/
specs:
aruba (0.4.9)
childprocess (>= 0.2.3)
cucumber (>= 1.1.1)
ffi (= 1.0.11)
rspec (>= 2.7.0)
builder (3.0.0)
childprocess (0.2.3)
ffi (~> 1.0.6)
cucumber (1.1.4)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.7.1)
json (>= 1.4.6)
term-ansicolor (>= 1.0.6)
diff-lcs (1.1.3)
ffi (1.0.11)
gherkin (2.7.1)
json (>= 1.4.6)
gli (1.4.0)
json (1.6.3)
rake (0.9.2.2)
rdoc (3.11)
json (~> 1.4)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)
term-ansicolor (1.0.7)
PLATFORMS
ruby
DEPENDENCIES
aruba (~> 0.4.9)
octopress!
rake
rdoc

6
octopress/README.rdoc Normal file
View File

@ -0,0 +1,6 @@
= octopress
Describe your project here
:include:octopress.rdoc

24
octopress/Rakefile Normal file
View File

@ -0,0 +1,24 @@
require 'rake/clean'
require 'rubygems'
require 'rubygems/package_task'
require 'rdoc/task'
Rake::RDocTask.new do |rd|
rd.main = "README.rdoc"
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
rd.title = 'Octopress'
end
spec = eval(File.read('octopress.gemspec'))
Gem::PackageTask.new(spec) do |pkg|
end
require 'cucumber'
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "features --format pretty -x"
t.fork = false
end
task :default => :features

52
octopress/TODO.txt Normal file
View File

@ -0,0 +1,52 @@
octopress --global-option command -d myblog
octopress --path /my/blog post --option new "Hello"
todo -f /path/to/file.txt add -f "Call brandon"
# Replace the install command of the Rakefile
octopress
create [DIRECTORY] # Create a new Jekyll blog.
--theme=classic (aliases -t)
--deploy={rsync,github,aws,heroku}
--root-dir=/
clean # Clean out caches: .pygments-cache,
.gist-cache, .sass-cache
deploy # Deploy compiled site
--default={rsync,github,aws,heroku}
--rsync
--github
--aws
--heroku
generate
octopress new-page TITLE
SYNOPSIS
octopress new-post [-s]
-s FILENAME, --slug
-i, --isolate
SYNOPSIS
git add [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
[--edit | -e] [--all | [--update | -u]] [--intent-to-add | -N]
[--refresh] [--ignore-errors] [--ignore-missing] [--]
[<filepattern>...]
isolate TITLE
integrate
preview
theme update
theme install
theme create
watch

61
octopress/bin/octopress Executable file
View File

@ -0,0 +1,61 @@
#!/usr/bin/env ruby
$: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
require 'rubygems'
require 'gli'
require 'octopress_version'
include GLI
program_desc 'A blogging framework for hackers.'
version Octopress::VERSION
desc 'Describe some switch here'
switch [:s,:switch]
desc 'Describe some flag here'
default_value 'the default'
arg_name 'The name of the argument'
flag [:f,:flagname]
desc 'Describe create here'
arg_name 'Describe arguments to create here'
command :create do |c|
c.desc 'Describe a switch to create'
c.switch :s
c.desc 'Describe a flag to create'
c.default_value 'default'
c.flag :f
c.action do |global_options,options,args|
puts "Hello!"
# Your command logic here
# If you have any errors, just raise them
# raise "that command made no sense"
end
end
pre do |global,command,options,args|
# Pre logic here
# Return true to proceed; false to abourt and not call the
# chosen command
# Use skips_pre before a command to skip this block
# on that command only
true
end
post do |global,command,options,args|
# Post logic here
# Use skips_post before a command to skip this
# block on that command only
end
on_error do |exception|
# Error logic here
# return false to skip default error handling
true
end
exit GLI.run(ARGV)

View File

@ -0,0 +1,5 @@
Feature: Create a new Octopress Blog
Scenario: create with no flags, switches or arguments
When I successfully run `octopress create`
Then the stdout should contain "Hello!"

View File

@ -0,0 +1 @@
require 'aruba/cucumber'

View File

@ -0,0 +1,3 @@
module Octopress
VERSION = '0.0.1'
end

View File

@ -0,0 +1,24 @@
# Ensure we require the local version and not one we might have installed already
require File.join([File.dirname(__FILE__),'lib','octopress_version.rb'])
spec = Gem::Specification.new do |s|
s.name = 'octopress'
s.version = Octopress::VERSION
s.author = 'Brandon Mathis'
s.email = 'brandon@imathis.com'
s.homepage = 'http://octopress.org'
s.platform = Gem::Platform::RUBY
s.summary = 'Octopress is a framework designed for Jekyll, the blog aware static site generator powering Github Pages.'
s.files = %w(
bin/octopress
)
s.require_paths << 'lib'
s.has_rdoc = true
s.extra_rdoc_files = ['README.rdoc','octopress.rdoc']
s.rdoc_options << '--title' << 'octopress' << '--main' << 'README.rdoc' << '-ri'
s.bindir = 'bin'
s.executables << 'octopress'
s.add_dependency('gli', '~> 1.4.0')
s.add_development_dependency('rake')
s.add_development_dependency('rdoc')
s.add_development_dependency('aruba', '~> 0.4.9')
end

5
octopress/octopress.rdoc Normal file
View File

@ -0,0 +1,5 @@
= octopress
Generate this with
octopress rdoc
After you have described your command line interface