done 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/Gemfile +3 -0
- data/Gemfile.lock +41 -0
- data/Guardfile +10 -0
- data/README.md +16 -0
- data/Rakefile +8 -0
- data/bin/done +12 -0
- data/done.gemspec +27 -0
- data/lib/done.rb +22 -0
- data/lib/done/cli.rb +18 -0
- data/lib/done/config.rb +54 -0
- data/lib/done/version.rb +3 -0
- data/spec/lib/done_spec.rb +7 -0
- data/spec/spec_helper.rb +6 -0
- metadata +127 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
done (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.0.6)
|
10
|
+
diff-lcs (1.1.3)
|
11
|
+
ffi (1.0.11)
|
12
|
+
guard (1.0.1)
|
13
|
+
ffi (>= 0.5.0)
|
14
|
+
thor (~> 0.14.6)
|
15
|
+
guard-rspec (0.7.0)
|
16
|
+
guard (>= 0.10.0)
|
17
|
+
method_source (0.7.1)
|
18
|
+
pry (0.9.9.3)
|
19
|
+
coderay (~> 1.0.5)
|
20
|
+
method_source (~> 0.7.1)
|
21
|
+
slop (>= 2.4.4, < 3)
|
22
|
+
rspec (2.9.0)
|
23
|
+
rspec-core (~> 2.9.0)
|
24
|
+
rspec-expectations (~> 2.9.0)
|
25
|
+
rspec-mocks (~> 2.9.0)
|
26
|
+
rspec-core (2.9.0)
|
27
|
+
rspec-expectations (2.9.1)
|
28
|
+
diff-lcs (~> 1.1.3)
|
29
|
+
rspec-mocks (2.9.0)
|
30
|
+
slop (2.4.4)
|
31
|
+
thor (0.14.6)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
guard
|
38
|
+
guard-rspec
|
39
|
+
done!
|
40
|
+
pry
|
41
|
+
rspec
|
data/Guardfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
data/bin/done
ADDED
data/done.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "done/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "done"
|
7
|
+
s.version = Done::VERSION
|
8
|
+
s.authors = ["Tyson Tate"]
|
9
|
+
s.email = ["tyson@tysontate.com"]
|
10
|
+
s.homepage = "http://github.com/tysontate/done"
|
11
|
+
s.summary = "Simple log file tool."
|
12
|
+
s.description = "Done is a simple command-line tool for quickly logging what you did today."
|
13
|
+
|
14
|
+
s.rubyforge_project = "done"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_development_dependency "rspec"
|
22
|
+
s.add_development_dependency "guard"
|
23
|
+
s.add_development_dependency "guard-rspec"
|
24
|
+
s.add_development_dependency "pry"
|
25
|
+
s.add_runtime_dependency "thor"
|
26
|
+
s.add_runtime_dependency "activesupport"
|
27
|
+
end
|
data/lib/done.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'done/version'
|
2
|
+
require 'done/config'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module Done
|
6
|
+
include Config
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def get_or_create_file( time )
|
10
|
+
subpath = time.strftime( Done.config.path_format )
|
11
|
+
full_path = File.expand_path( File.join( Done.config.root, subpath ) )
|
12
|
+
path, _ = File.split( full_path )
|
13
|
+
FileUtils.mkdir_p( path )
|
14
|
+
FileUtils.touch( full_path ) unless File.exists?( full_path )
|
15
|
+
full_path
|
16
|
+
end
|
17
|
+
|
18
|
+
def edit( path )
|
19
|
+
system "#{Done.config.editor} #{path}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/done/cli.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Done
|
4
|
+
class CLI < Thor
|
5
|
+
desc "today", "Edit the log entry for today"
|
6
|
+
def today
|
7
|
+
Done.edit( Done.get_or_create_file( Time.now ) )
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "config", "Print out the loaded configuration"
|
11
|
+
long_desc <<-TXT
|
12
|
+
TODO
|
13
|
+
TXT
|
14
|
+
def config
|
15
|
+
p Done.config
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/done/config.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
module Done
|
5
|
+
module Config
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
class InvalidConfig < StandardError; end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
CONFIG_NAME = ".donerc"
|
11
|
+
CONFIG_VARS = %w{path}
|
12
|
+
|
13
|
+
def config
|
14
|
+
@config ||= OpenStruct.new(load_config)
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def load_config
|
20
|
+
config = {
|
21
|
+
'root' => '~/done',
|
22
|
+
'editor' => 'vim -f',
|
23
|
+
'path_format' => '%Y/%B/%d.txt'
|
24
|
+
}
|
25
|
+
config_paths.each do |path|
|
26
|
+
next unless File.exists?(path)
|
27
|
+
File.readlines(path).each do |line|
|
28
|
+
match = /([a-z_]+): (.+)/.match(line)
|
29
|
+
next unless match
|
30
|
+
unless CONFIG_VARS.include?(match[1])
|
31
|
+
raise InvalidConfig.new("\"#{match[1]}\" is not a valid configuration variable (from #{path})")
|
32
|
+
end
|
33
|
+
config[match[1]] = match[2]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
config['root'] = File.expand_path(config['root'])
|
37
|
+
config
|
38
|
+
end
|
39
|
+
|
40
|
+
def config_paths
|
41
|
+
dir = Dir.pwd
|
42
|
+
paths = []
|
43
|
+
while dir != File::SEPARATOR do
|
44
|
+
paths << File.join(dir, CONFIG_NAME)
|
45
|
+
dir = File.split(dir).first
|
46
|
+
end
|
47
|
+
["/", "~/"].each do |root|
|
48
|
+
paths << File.expand_path("#{root}#{CONFIG_NAME}")
|
49
|
+
end
|
50
|
+
paths
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/done/version.rb
ADDED
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: done
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tyson Tate
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &70173535258800 !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: *70173535258800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: guard
|
27
|
+
requirement: &70173535258380 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70173535258380
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: guard-rspec
|
38
|
+
requirement: &70173535257940 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70173535257940
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: pry
|
49
|
+
requirement: &70173535257480 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70173535257480
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: thor
|
60
|
+
requirement: &70173535257040 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70173535257040
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activesupport
|
71
|
+
requirement: &70173535256580 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70173535256580
|
80
|
+
description: Done is a simple command-line tool for quickly logging what you did today.
|
81
|
+
email:
|
82
|
+
- tyson@tysontate.com
|
83
|
+
executables:
|
84
|
+
- done
|
85
|
+
extensions: []
|
86
|
+
extra_rdoc_files: []
|
87
|
+
files:
|
88
|
+
- Gemfile
|
89
|
+
- Gemfile.lock
|
90
|
+
- Guardfile
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- bin/done
|
94
|
+
- done.gemspec
|
95
|
+
- lib/done.rb
|
96
|
+
- lib/done/cli.rb
|
97
|
+
- lib/done/config.rb
|
98
|
+
- lib/done/version.rb
|
99
|
+
- spec/lib/done_spec.rb
|
100
|
+
- spec/spec_helper.rb
|
101
|
+
homepage: http://github.com/tysontate/done
|
102
|
+
licenses: []
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project: done
|
121
|
+
rubygems_version: 1.8.11
|
122
|
+
signing_key:
|
123
|
+
specification_version: 3
|
124
|
+
summary: Simple log file tool.
|
125
|
+
test_files:
|
126
|
+
- spec/lib/done_spec.rb
|
127
|
+
- spec/spec_helper.rb
|