clear 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.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +48 -0
- data/README.markdown +9 -0
- data/Rakefile +44 -0
- data/bin/clr +30 -0
- data/clear.gemspec +23 -0
- data/features/clr.feature +8 -0
- data/features/step_definitions/clear-rb_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/lib/clear.rb +67 -0
- data/lib/clear/database.rb +47 -0
- data/lib/clear/list.rb +7 -0
- data/lib/clear/task.rb +6 -0
- data/lib/clear/version.rb +3 -0
- data/test/default_test.rb +14 -0
- data/test/test_helper.rb +9 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e48900d980dc865537549103a368d4b503d902ca
|
4
|
+
data.tar.gz: 1a9538435ef219cb0996c3dee7d5f4f75614e9a0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: febb3a031ccac5cab6aeff7a5ab4098473779c6ed2c1435f1f1bc0deeaf14a340d62a21bc2f0cf04df0e0e3fc4015adc301fe81091ea7c5e2b0e29b184081a27
|
7
|
+
data.tar.gz: 10e632b216d936f0fb2ff4f42fb27f2ac8a4bd7098ae56ba95cb91bbea2374e633284dde782bb3c9923bcd5dc7330b93b4aa628a2aa42e122aa8b22dbf4b4dd0
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
clr (0.0.1)
|
5
|
+
gli (= 2.9.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
aruba (0.5.4)
|
11
|
+
childprocess (>= 0.3.6)
|
12
|
+
cucumber (>= 1.1.1)
|
13
|
+
rspec-expectations (>= 2.7.0)
|
14
|
+
builder (3.2.2)
|
15
|
+
childprocess (0.5.2)
|
16
|
+
ffi (~> 1.0, >= 1.0.11)
|
17
|
+
colored (1.2)
|
18
|
+
cucumber (1.3.14)
|
19
|
+
builder (>= 2.1.2)
|
20
|
+
diff-lcs (>= 1.1.3)
|
21
|
+
gherkin (~> 2.12)
|
22
|
+
multi_json (>= 1.7.5, < 2.0)
|
23
|
+
multi_test (>= 0.1.1)
|
24
|
+
diff-lcs (1.2.5)
|
25
|
+
ffi (1.9.3)
|
26
|
+
gherkin (2.12.2)
|
27
|
+
multi_json (~> 1.3)
|
28
|
+
gli (2.9.0)
|
29
|
+
json (1.8.1)
|
30
|
+
multi_json (1.9.2)
|
31
|
+
multi_test (0.1.1)
|
32
|
+
rake (10.2.2)
|
33
|
+
rdoc (4.1.1)
|
34
|
+
json (~> 1.4)
|
35
|
+
rspec-expectations (2.14.5)
|
36
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
37
|
+
sqlite3 (1.3.9)
|
38
|
+
|
39
|
+
PLATFORMS
|
40
|
+
ruby
|
41
|
+
|
42
|
+
DEPENDENCIES
|
43
|
+
aruba
|
44
|
+
clr!
|
45
|
+
colored
|
46
|
+
rake
|
47
|
+
rdoc
|
48
|
+
sqlite3
|
data/README.markdown
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.rdoc"
|
9
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
+
rd.title = 'Your application title'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('clear.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
CUKE_RESULTS = 'results.html'
|
18
|
+
CLEAN << CUKE_RESULTS
|
19
|
+
desc 'Run features'
|
20
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
+
t.cucumber_opts = opts
|
24
|
+
t.fork = false
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
+
tag_opts = ' --tags ~@pending'
|
30
|
+
tag_opts = ' --tags @wip'
|
31
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
+
t.fork = false
|
33
|
+
end
|
34
|
+
|
35
|
+
task :cucumber => :features
|
36
|
+
task 'cucumber:wip' => 'features:wip'
|
37
|
+
task :wip => 'features:wip'
|
38
|
+
require 'rake/testtask'
|
39
|
+
Rake::TestTask.new do |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.test_files = FileList['test/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:test,:features]
|
data/bin/clr
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'clear'
|
4
|
+
include GLI::App
|
5
|
+
|
6
|
+
program_desc 'Command line interface for Clear to do list by Brendan G. Lim'
|
7
|
+
|
8
|
+
version ClearMod::VERSION
|
9
|
+
|
10
|
+
desc 'List all tasks for each list. Will not show empty lists'
|
11
|
+
command :list, :ls do |c|
|
12
|
+
c.action do |global_options,options,args|
|
13
|
+
$clear.list_tasks
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
pre do |global,command,options,args|
|
18
|
+
$clear = Clear.new
|
19
|
+
true
|
20
|
+
end
|
21
|
+
|
22
|
+
post do |global,command,options,args|
|
23
|
+
$clear.db.connection.close unless $clear.db.connection.nil?
|
24
|
+
end
|
25
|
+
|
26
|
+
on_error do |exception|
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
exit run(ARGV)
|
data/clear.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.join([File.dirname(__FILE__),'lib','clear','version.rb'])
|
2
|
+
spec = Gem::Specification.new do |s|
|
3
|
+
s.name = 'clear'
|
4
|
+
s.version = ClearMod::VERSION
|
5
|
+
s.author = 'Brendan G. Lim'
|
6
|
+
s.email = 'brendangl@gmail.com'
|
7
|
+
s.homepage = 'http://brendanlim.com'
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.summary = 'Command line interface for the Clear to do list Mac application.'
|
10
|
+
s.files = `git ls-files`.split("
|
11
|
+
")
|
12
|
+
s.require_paths << 'lib'
|
13
|
+
s.has_rdoc = false
|
14
|
+
s.bindir = 'bin'
|
15
|
+
s.executables << 'clr'
|
16
|
+
s.license = 'MIT'
|
17
|
+
s.add_development_dependency('rake')
|
18
|
+
s.add_development_dependency('rdoc')
|
19
|
+
s.add_development_dependency('aruba')
|
20
|
+
s.add_runtime_dependency('gli','2.9.0')
|
21
|
+
|
22
|
+
s.post_install_message = "Type 'clr help' for usage information"
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
|
3
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
5
|
+
|
6
|
+
Before do
|
7
|
+
# Using "announce" causes massive warnings on 1.9.2
|
8
|
+
@puts = true
|
9
|
+
@original_rubylib = ENV['RUBYLIB']
|
10
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
After do
|
14
|
+
ENV['RUBYLIB'] = @original_rubylib
|
15
|
+
end
|
data/lib/clear.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'clear/version.rb'
|
2
|
+
require 'clear/database.rb'
|
3
|
+
require 'clear/task.rb'
|
4
|
+
require 'clear/list.rb'
|
5
|
+
require 'colored'
|
6
|
+
|
7
|
+
class Clear
|
8
|
+
def initialize
|
9
|
+
@@db = nil
|
10
|
+
@@lists = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def list_tasks
|
14
|
+
retrieve_lists
|
15
|
+
puts
|
16
|
+
|
17
|
+
@@lists.each do |list|
|
18
|
+
next if list.tasks.size == 0
|
19
|
+
|
20
|
+
puts " " + "#{list.title}".red.bold
|
21
|
+
list.tasks.each do |task|
|
22
|
+
puts " [#{task.id.to_s}] ".cyan + task.title
|
23
|
+
end
|
24
|
+
puts
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def retrieve_lists
|
29
|
+
@@lists = []
|
30
|
+
|
31
|
+
connection.lists do |row|
|
32
|
+
list = List.new
|
33
|
+
list.id = row["id"]
|
34
|
+
list.identifier = row["identifier"]
|
35
|
+
list.title = row["title"]
|
36
|
+
list.tasks = []
|
37
|
+
|
38
|
+
retrieve_tasks(list)
|
39
|
+
@@lists << list
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def retrieve_tasks(list)
|
44
|
+
connection.tasks(list) do |row|
|
45
|
+
task = Task.new
|
46
|
+
task.id = row["id"]
|
47
|
+
task.title = row["title"]
|
48
|
+
|
49
|
+
list.tasks << task
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def lists
|
54
|
+
@@lists || []
|
55
|
+
end
|
56
|
+
|
57
|
+
def db
|
58
|
+
@@db
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def connection
|
64
|
+
@@db = Database.new if @@db.nil?
|
65
|
+
@@db
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "sqlite3"
|
2
|
+
|
3
|
+
class Database
|
4
|
+
FILENAME = "LocalTasks.sqlite"
|
5
|
+
PACKAGE = "com.realmacsoftware.clear.mac"
|
6
|
+
PATH = "/Library/Containers/#{PACKAGE}/Data/Library/Application " +
|
7
|
+
"Support/#{PACKAGE}/#{FILENAME}"
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
connect
|
11
|
+
end
|
12
|
+
|
13
|
+
def connection
|
14
|
+
connect if @@connection.nil?
|
15
|
+
@@connection
|
16
|
+
end
|
17
|
+
|
18
|
+
def completed(&block)
|
19
|
+
connection.execute( "select * from completed_tasks" ) do |row|
|
20
|
+
block.call(row) unless block.nil?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def lists(&block)
|
25
|
+
connection.execute( "select * from lists" ) do |row|
|
26
|
+
block.call(row) unless block.nil?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def tasks(list, &block)
|
31
|
+
query = "select * from tasks"
|
32
|
+
unless list.nil?
|
33
|
+
query = "select * from tasks where list_identifier = \"#{list.identifier}\""
|
34
|
+
end
|
35
|
+
|
36
|
+
connection.execute(query) do |row|
|
37
|
+
block.call(row) unless block.nil?
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def connect
|
44
|
+
@@connection = SQLite3::Database.new(File.expand_path('~') + PATH,
|
45
|
+
:results_as_hash => true)
|
46
|
+
end
|
47
|
+
end
|
data/lib/clear/list.rb
ADDED
data/lib/clear/task.rb
ADDED
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: clear
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brendan G. Lim
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aruba
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: gli
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.9.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.9.0
|
69
|
+
description:
|
70
|
+
email: brendangl@gmail.com
|
71
|
+
executables:
|
72
|
+
- clr
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- Gemfile
|
77
|
+
- Gemfile.lock
|
78
|
+
- README.markdown
|
79
|
+
- Rakefile
|
80
|
+
- bin/clr
|
81
|
+
- clear.gemspec
|
82
|
+
- features/clr.feature
|
83
|
+
- features/step_definitions/clear-rb_steps.rb
|
84
|
+
- features/support/env.rb
|
85
|
+
- lib/clear.rb
|
86
|
+
- lib/clear/database.rb
|
87
|
+
- lib/clear/list.rb
|
88
|
+
- lib/clear/task.rb
|
89
|
+
- lib/clear/version.rb
|
90
|
+
- test/default_test.rb
|
91
|
+
- test/test_helper.rb
|
92
|
+
homepage: http://brendanlim.com
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata: {}
|
96
|
+
post_install_message: Type 'clr help' for usage information
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.2.2
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: Command line interface for the Clear to do list Mac application.
|
117
|
+
test_files: []
|