calamity 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/calamity +97 -0
- data/calamity.rdoc +5 -0
- metadata +117 -0
data/bin/calamity
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# 1.9 adds realpath to resolve symlinks; 1.8 doesn't
|
3
|
+
# have this method, so we add it so we get resolved symlinks
|
4
|
+
# and compatibility
|
5
|
+
unless File.respond_to? :realpath
|
6
|
+
class File #:nodoc:
|
7
|
+
def self.realpath path
|
8
|
+
return realpath(File.readlink(path)) if symlink?(path)
|
9
|
+
path
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
$: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
14
|
+
require 'rubygems'
|
15
|
+
require 'gli'
|
16
|
+
require 'calamity_version'
|
17
|
+
require 'calamity_task'
|
18
|
+
require 'calamity_data_access'
|
19
|
+
require 'sqlite3'
|
20
|
+
|
21
|
+
include GLI
|
22
|
+
|
23
|
+
program_desc 'Calamity is a GTD life hacking tool'
|
24
|
+
|
25
|
+
version Calamity::VERSION
|
26
|
+
|
27
|
+
#desc 'Describe some switch here'
|
28
|
+
#switch [:s,:switch]
|
29
|
+
|
30
|
+
desc 'The database file location'
|
31
|
+
default_value "#{ENV['HOME']}/.calamity/calamity.db"
|
32
|
+
arg_name '"database"'
|
33
|
+
flag [:database]
|
34
|
+
|
35
|
+
desc 'Save a task, either to create a new one or update an existing one'
|
36
|
+
arg_name '<task name>'
|
37
|
+
command :save do |c|
|
38
|
+
c.desc 'The context where the task will be accomplished'
|
39
|
+
c.default_value 'inbox'
|
40
|
+
c.arg_name '"context"'
|
41
|
+
c.flag [:c, :context]
|
42
|
+
c.desc 'The project the taske contributes to'
|
43
|
+
c.arg_name '"project"'
|
44
|
+
c.flag [:p, :project]
|
45
|
+
c.action do |global_options,options,args|
|
46
|
+
task = Calamity::Task.new
|
47
|
+
task.name = args[0]
|
48
|
+
task.context = options[:context]
|
49
|
+
task.project = options[:project]
|
50
|
+
db = Calamity::DataAccess.new global_options[:database]
|
51
|
+
db.add_task task
|
52
|
+
# Your command logic here
|
53
|
+
|
54
|
+
# If you have any errors, just raise them
|
55
|
+
# raise "that command made no sense"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
desc 'List unfinished tasks'
|
60
|
+
command :list do |c|
|
61
|
+
c.action do |global_options,options,args|
|
62
|
+
db = Calamity::DataAccess.new global_options[:database]
|
63
|
+
tasks = db.list_tasks
|
64
|
+
bold = `tput bold`
|
65
|
+
underline = `tput smul`
|
66
|
+
normal = `tput sgr0`
|
67
|
+
puts "#{bold}#{underline}#{'Task Name'.center(20)}#{'Context'.center(20)}#{'Project'.center(20)}#{normal}"
|
68
|
+
tasks.each do |t|
|
69
|
+
puts "#{t.name.center(20) if t.name}#{t.context.center(20) if t.context}#{t.project.center(20) if t.project}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
desc 'Mark a task or tasks finished'
|
75
|
+
arg_name 'The name of the task(s) to mark finished, separated by a space'
|
76
|
+
command :finish do |c|
|
77
|
+
c.action do |global_options,options,args|
|
78
|
+
db = Calamity::DataAccess.new global_options[:database]
|
79
|
+
args.each do |a|
|
80
|
+
db.mark_finished a
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
pre do |global,command,options,args|
|
86
|
+
Dir.mkdir("#{ENV['HOME']}/.calamity") if !Dir.entries("#{ENV['HOME']}").include?('.calamity');
|
87
|
+
true
|
88
|
+
end
|
89
|
+
|
90
|
+
post do |global,command,options,args|
|
91
|
+
end
|
92
|
+
|
93
|
+
on_error do |exception|
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
exit GLI.run(ARGV)
|
data/calamity.rdoc
ADDED
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: calamity
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kevin Beddingfield
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rdoc
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: gli
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: sqlite3
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description:
|
79
|
+
email: kevin.beddingfield@gmail.com
|
80
|
+
executables:
|
81
|
+
- calamity
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files:
|
84
|
+
- calamity.rdoc
|
85
|
+
files:
|
86
|
+
- bin/calamity
|
87
|
+
- calamity.rdoc
|
88
|
+
homepage: http://kevinbeddingfield.com
|
89
|
+
licenses: []
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options:
|
92
|
+
- --title
|
93
|
+
- calamity
|
94
|
+
- --main
|
95
|
+
- -ri
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 1.8.19
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: A life hacking tool
|
117
|
+
test_files: []
|