xttc 0.1.6

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.
Files changed (5) hide show
  1. data/README +20 -0
  2. data/bin/xttc +5 -0
  3. data/lib/cli.rb +52 -0
  4. data/lib/xttc.rb +33 -0
  5. metadata +96 -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 app
9
+
10
+ PARAMETERS
11
+ --help, -h
12
+
13
+ EXAMPLES
14
+ xttc status
15
+ xttc projects
16
+ xttc @projectcode status
17
+ xttc out
18
+
19
+ LICENSE
20
+ WTFPL - http://sam.zoy.org/wtfpl/
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+ require 'xttc'
5
+ require 'cli'
@@ -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 app"
24
+
25
+ examples 'xttc status', 'xttc projects', 'xttc @projectcode status', '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(:one, :from => :last)
48
+ say status.message
49
+ end
50
+ end
51
+
52
+ }
@@ -0,0 +1,33 @@
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
+ site: http://tt.example.com/
14
+ username: foo
15
+ password: sekret
16
+
17
+ # secure this file
18
+ $ chmod 700 ~/.xttc
19
+ """
20
+ exit(1)
21
+ end
22
+
23
+ class Project < ActiveResource::Base
24
+ self.site = CONFIG["site"] || 'http://tt.entp.com/'
25
+ self.user = CONFIG["username"]
26
+ self.password = CONFIG["password"]
27
+ end
28
+
29
+ class Status < ActiveResource::Base
30
+ self.site = CONFIG["site"] || 'http://tt.entp.com/'
31
+ self.user = CONFIG["username"]
32
+ self.password = CONFIG["password"]
33
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xttc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.6
5
+ platform: ruby
6
+ authors:
7
+ - Jesse Newland
8
+ - Andy Henson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2008-02-15 00:00:00 -05:00
14
+ default_executable: xttc
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: activesupport
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 2.2.2
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: activeresource
28
+ type: :runtime
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 2.2.2
35
+ version:
36
+ - !ruby/object:Gem::Dependency
37
+ name: main
38
+ type: :runtime
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 2.8.2
45
+ version:
46
+ - !ruby/object:Gem::Dependency
47
+ name: highline
48
+ type: :runtime
49
+ version_requirement:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.5.0
55
+ version:
56
+ description: A command line bot for working with XTT, ENTP's rad time tracking app
57
+ email: jnewland@gmail.com
58
+ executables:
59
+ - xttc
60
+ extensions: []
61
+
62
+ extra_rdoc_files: []
63
+
64
+ files:
65
+ - README
66
+ - bin/xttc
67
+ - lib/xttc.rb
68
+ - lib/cli.rb
69
+ has_rdoc: false
70
+ homepage: http://github.com/jnewland
71
+ post_install_message:
72
+ rdoc_options: []
73
+
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ version:
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
87
+ version:
88
+ requirements: []
89
+
90
+ rubyforge_project: xttc
91
+ rubygems_version: 1.3.1
92
+ signing_key:
93
+ specification_version: 2
94
+ summary: A command line bot for working with XTT, ENTP's rad time tracking app
95
+ test_files: []
96
+