Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
initial setup
- Loading branch information
0 parents
commit 491a8ae
Showing
9 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.swp | ||
.git | ||
.rvmrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source :rubygems | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
= calamity | ||
|
||
A life hacking tool for the command line. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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 = 'Your application title' | ||
end | ||
|
||
spec = eval(File.read('calamity.gemspec')) | ||
|
||
Gem::PackageTask.new(spec) do |pkg| | ||
end | ||
|
||
require 'rake/testtask' | ||
Rake::TestTask.new do |t| | ||
t.libs << "test" | ||
t.test_files = FileList['test/tc_*.rb'] | ||
end | ||
|
||
task :default => :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env ruby | ||
# 1.9 adds realpath to resolve symlinks; 1.8 doesn't | ||
# have this method, so we add it so we get resolved symlinks | ||
# and compatibility | ||
unless File.respond_to? :realpath | ||
class File #:nodoc: | ||
def self.realpath path | ||
return realpath(File.readlink(path)) if symlink?(path) | ||
path | ||
end | ||
end | ||
end | ||
$: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib') | ||
require 'rubygems' | ||
require 'gli' | ||
require 'calamity_version' | ||
|
||
include GLI | ||
|
||
program_desc 'Calamity is a life hacking tool' | ||
|
||
version Calamity::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 'Add a task' | ||
arg_name 'Describe arguments to add here' | ||
command :add do |c| | ||
c.desc 'Describe a switch to add' | ||
c.switch :s | ||
|
||
c.desc 'Describe a flag to add' | ||
c.default_value 'default' | ||
c.flag :f | ||
c.action do |global_options,options,args| | ||
|
||
# Your command logic here | ||
|
||
# If you have any errors, just raise them | ||
# raise "that command made no sense" | ||
end | ||
end | ||
|
||
desc 'Describe list here' | ||
arg_name 'Describe arguments to list here' | ||
command :list do |c| | ||
c.action do |global_options,options,args| | ||
end | ||
end | ||
|
||
desc 'Describe done here' | ||
arg_name 'Describe arguments to done here' | ||
command :done do |c| | ||
c.action do |global_options,options,args| | ||
end | ||
end | ||
|
||
pre do |global,command,options,args| | ||
# Pre logic here | ||
# Return true to proceed; false to abort 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| | ||
puts exception | ||
# Error logic here | ||
# return false to skip default error handling | ||
true | ||
end | ||
|
||
exit GLI.run(ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Ensure we require the local version and not one we might have installed already | ||
require File.join([File.dirname(__FILE__),'lib','calamity_version.rb']) | ||
spec = Gem::Specification.new do |s| | ||
s.name = 'calamity' | ||
s.version = Calamity::VERSION | ||
s.author = 'Kevin Beddingfield' | ||
s.email = 'kevin.beddingfield@gmail.com' | ||
s.homepage = 'http://kevinbeddingfield.com' | ||
s.platform = Gem::Platform::RUBY | ||
s.summary = 'A life hacking tool' | ||
# Add your other files here if you make them | ||
s.files = %w( | ||
bin/calamity | ||
) | ||
s.require_paths << 'lib' | ||
s.has_rdoc = true | ||
s.extra_rdoc_files = ['README.rdoc','calamity.rdoc'] | ||
s.rdoc_options << '--title' << 'calamity' << '--main' << 'README.rdoc' << '-ri' | ||
s.bindir = 'bin' | ||
s.executables << 'calamity' | ||
s.add_development_dependency('rake') | ||
s.add_development_dependency('rdoc') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
= calamity | ||
|
||
Generate this with | ||
calamity rdoc | ||
After you have described your command line interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Calamity | ||
VERSION = '0.0.1' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'test/unit' | ||
require 'date' | ||
|
||
class TC_testCalamity < Test::Unit::TestCase | ||
|
||
def setup | ||
end | ||
|
||
def teardown | ||
end | ||
|
||
def test_add_default_date | ||
`./bin/calamity add -d foo` | ||
#assert `./bin/calamity list foo | grep 'foo' | awk '{print $2}'` == "#{Date.today}" | ||
end | ||
end |