jnewland-xttc 0.1.0
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/README +20 -0
- data/bin/xttc +5 -0
- data/lib/cli.rb +52 -0
- data/lib/xttc.rb +32 -0
- metadata +91 -0
data/README
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
NAME
|
2
|
+
xttc
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
xttc (projects|status) [options]+
|
6
|
+
|
7
|
+
DESCRIPTION
|
8
|
+
A command line bot for working with XTT, ENTP's rad time tracking bot
|
9
|
+
|
10
|
+
PARAMETERS
|
11
|
+
--help, -h
|
12
|
+
|
13
|
+
EXAMPLES
|
14
|
+
xttc status
|
15
|
+
xttc projects
|
16
|
+
xttc @projectcode staus
|
17
|
+
xttc out
|
18
|
+
|
19
|
+
LICENSE
|
20
|
+
WTFPL - http://sam.zoy.org/wtfpl/
|
data/bin/xttc
ADDED
data/lib/cli.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
gem 'main', '>= 2.8.2'
|
2
|
+
gem 'highline', '>= 1.4.0'
|
3
|
+
require 'main'
|
4
|
+
require 'highline/import'
|
5
|
+
|
6
|
+
HighLine.track_eof = false
|
7
|
+
|
8
|
+
def with_progress(message = nil, &work)
|
9
|
+
print "#{message}" if message
|
10
|
+
finished = false
|
11
|
+
progress_thread = Thread.new { until finished; print "."; $stdout.flush; sleep 0.5; end; }
|
12
|
+
work_thread = Thread.new(binding()) do |b|
|
13
|
+
work.call
|
14
|
+
finished = true
|
15
|
+
end
|
16
|
+
work_thread.join
|
17
|
+
progress_thread.join
|
18
|
+
say "\nDone!"
|
19
|
+
end
|
20
|
+
|
21
|
+
Main {
|
22
|
+
|
23
|
+
description "A command line bot for working with XTT, ENTP's rad time tracking bot"
|
24
|
+
|
25
|
+
examples 'xttc status', 'xttc projects', 'xttc @projectcode staus', 'xttc out'
|
26
|
+
|
27
|
+
def run
|
28
|
+
s = ARGV.size > 1 ? ARGV.join(" ") : ARGV.shift
|
29
|
+
help! if s.blank?
|
30
|
+
with_progress("Updating Status") do
|
31
|
+
status = Status.create(:code_and_message => s)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
mode 'projects' do
|
36
|
+
description 'List all projects available, and their short code.'
|
37
|
+
def run
|
38
|
+
Project.find(:all).each do |p|
|
39
|
+
say "#{p.name}: @#{p.project_code}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
mode 'status' do
|
45
|
+
description 'List your current status'
|
46
|
+
def run
|
47
|
+
status = Status.find(:first)
|
48
|
+
say status.message
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
}
|
data/lib/xttc.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'activesupport'
|
5
|
+
require 'activeresource'
|
6
|
+
|
7
|
+
begin
|
8
|
+
CONFIG = YAML.load(File.read(ENV['HOME'] + '/.xttc'))
|
9
|
+
rescue
|
10
|
+
puts """To use XTTC:\n
|
11
|
+
$ vi ~/.xttc
|
12
|
+
|
13
|
+
username: foo
|
14
|
+
password: sekret
|
15
|
+
|
16
|
+
# secure this file
|
17
|
+
$ chmod 700 ~/.xttc
|
18
|
+
"""
|
19
|
+
exit(1)
|
20
|
+
end
|
21
|
+
|
22
|
+
class Project < ActiveResource::Base
|
23
|
+
self.site = 'http://tt.entp.com/'
|
24
|
+
self.user = CONFIG["username"]
|
25
|
+
self.password = CONFIG["password"]
|
26
|
+
end
|
27
|
+
|
28
|
+
class Status < ActiveResource::Base
|
29
|
+
self.site = 'http://tt.entp.com/'
|
30
|
+
self.user = CONFIG["username"]
|
31
|
+
self.password = CONFIG["password"]
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jnewland-xttc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jesse Newland
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-07-28 00:00:00 -07:00
|
13
|
+
default_executable: xttc
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "2.1"
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: activeresource
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 2.1.0
|
32
|
+
version:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: main
|
35
|
+
version_requirement:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.8.2
|
41
|
+
version:
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: highline
|
44
|
+
version_requirement:
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.4.0
|
50
|
+
version:
|
51
|
+
description: A command line bot for working with XTT, ENTP's rad time tracking bot
|
52
|
+
email: jnewland@gmail.com
|
53
|
+
executables:
|
54
|
+
- xttc
|
55
|
+
extensions: []
|
56
|
+
|
57
|
+
extra_rdoc_files: []
|
58
|
+
|
59
|
+
files:
|
60
|
+
- README
|
61
|
+
- bin/xttc
|
62
|
+
- lib/xttc.rb
|
63
|
+
- lib/cli.rb
|
64
|
+
has_rdoc: false
|
65
|
+
homepage: http://github.com/jnewland
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
version:
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: "0"
|
82
|
+
version:
|
83
|
+
requirements: []
|
84
|
+
|
85
|
+
rubyforge_project: xttc
|
86
|
+
rubygems_version: 1.2.0
|
87
|
+
signing_key:
|
88
|
+
specification_version: 2
|
89
|
+
summary: A command line bot for working with XTT, ENTP's rad time tracking bot
|
90
|
+
test_files: []
|
91
|
+
|