88miles 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/88miles.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "88miles"
8
- s.version = "1.0.5"
8
+ s.version = "1.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Myles Eftos"]
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.executables = ["88miles"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE.txt",
18
+ "README.dev",
18
19
  "README.md"
19
20
  ]
20
21
  s.files = [
data/README.dev ADDED
@@ -0,0 +1 @@
1
+ ENV=development bundle exec ruby -I"lib" bin/88miles -s ~/.88miles-dev start
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
@@ -19,6 +19,9 @@ module Gigawatt
19
19
  rescue OAuth2::Error => e
20
20
  say "Access to your 88 Miles may have been revoked. Please run <%= color('88miles setup', BOLD) %> again."
21
21
  return INVALID_OAUTH_TOKEN_EXIT_CODE
22
+ rescue Faraday::Error::ConnectionFailed => e
23
+ say "Couldn't connect to the 88 Miles server. Please try again later."
24
+ return CONNECTION_ERROR_EXIT_CODE
22
25
  end
23
26
 
24
27
  return OK_EXIT_CODE
@@ -25,6 +25,9 @@ options
25
25
  rescue OAuth2::Error => e
26
26
  say "Access to your 88 Miles may have been revoked. Please run <%= color('88miles setup', BOLD) %> again."
27
27
  return INVALID_OAUTH_TOKEN_EXIT_CODE
28
+ rescue Faraday::Error::ConnectionFailed => e
29
+ say "Couldn't connect to the 88 Miles server. Please try again later."
30
+ return CONNECTION_ERROR_EXIT_CODE
28
31
  end
29
32
  end
30
33
 
@@ -34,6 +34,9 @@ options:
34
34
  rescue OAuth2::Error => e
35
35
  puts "There was an issue authenticating your account. Please try again."
36
36
  return INVALID_OAUTH_TOKEN_EXIT_CODE
37
+ rescue Faraday::Error::ConnectionFailed => e
38
+ say "Couldn't connect to the 88 Miles server. Please try again later."
39
+ return CONNECTION_ERROR_EXIT_CODE
37
40
  end
38
41
  instance.postamble
39
42
 
@@ -26,6 +26,9 @@ options:
26
26
  rescue OAuth2::Error => e
27
27
  say "Access to your 88 Miles may have been revoked. Please run <%= color('88miles setup', BOLD) %> again."
28
28
  return INVALID_OAUTH_TOKEN_EXIT_CODE
29
+ rescue Faraday::Error::ConnectionFailed => e
30
+ say "Couldn't connect to the 88 Miles server. Please try again later."
31
+ return CONNECTION_ERROR_EXIT_CODE
29
32
  end
30
33
  end
31
34
 
@@ -25,6 +25,9 @@ options:
25
25
  rescue OAuth2::Error => e
26
26
  say "Access to your 88 Miles may have been revoked. Please run <%= color('88miles setup', BOLD) %> again."
27
27
  return INVALID_OAUTH_TOKEN_EXIT_CODE
28
+ rescue Faraday::Error::ConnectionFailed => e
29
+ say "Couldn't connect to the 88 Miles server. Please try again later."
30
+ return CONNECTION_ERROR_EXIT_CODE
28
31
  end
29
32
  end
30
33
 
@@ -40,18 +43,28 @@ options:
40
43
  project = Gigawatt::ProjectFile.new.project
41
44
 
42
45
  if project
46
+ running_total = (Time.now.to_i - project["started_at"])
43
47
  response = JSON.parse(@access_key.post("/api/1/projects/#{project["uuid"]}/punch_out.json", { :params => { :notes => options.notes.to_s } }).body)
44
48
  current = response["response"]
45
49
  ProjectFile.write(current)
46
50
 
47
51
  company = @cache.companies(true)[project["company_uuid"]]
48
- say("Punched out of #{company["name"]}: #{project["name"]}")
52
+ say("Punched out of #{company["name"]}: #{project["name"]}. Shift time: #{to_clock_s(running_total, true)}.")
49
53
  return OK_EXIT_CODE
50
54
  else
51
55
  say("No project found. Did you remember to run <%= color('88miles init [directory]', BOLD) %>?")
52
56
  return NO_PROJECT_EXIT_CODE
53
57
  end
54
58
  end
59
+
60
+ def to_clock_s(time, show_seconds = false)
61
+ hour = (time.abs / 3600).floor
62
+ minute = (time.abs / 60 % 60).floor
63
+ seconds = (time.abs % 60).floor if show_seconds
64
+
65
+ return (time != 0 && (time / time.abs) == -1 ? "-" : "") + hour.to_s.rjust(2, '0') + ":" + minute.to_s.rjust(2, '0') + (show_seconds ? ":" + seconds.to_s.rjust(2, '0') : '')
66
+ end
67
+
55
68
  end
56
69
  end
57
70
  end
@@ -25,6 +25,9 @@ Usage
25
25
  rescue OAuth2::Error => e
26
26
  say "Access to your 88 Miles may have been revoked. Please run <%= color('88miles setup', BOLD) %> again."
27
27
  return INVALID_OAUTH_TOKEN_EXIT_CODE
28
+ rescue Faraday::Error::ConnectionFailed => e
29
+ say "Couldn't connect to the 88 Miles server. Please try again later."
30
+ return CONNECTION_ERROR_EXIT_CODE
28
31
  end
29
32
 
30
33
  return 0
@@ -3,7 +3,7 @@ module Gigawatt
3
3
  attr_accessor :access_key, :projects, :companies, :staff
4
4
 
5
5
  def initialize(options = {})
6
- @options = Settings.defaults.merge(options)
6
+ @options = Settings.defaults.merge({ :path => options[:settings] })
7
7
  read if setup?
8
8
  end
9
9
 
data/lib/gigawatt.rb CHANGED
@@ -22,6 +22,7 @@ require File.join(File.dirname(__FILE__), 'gigawatt', 'commands', 'status')
22
22
  require File.join(File.dirname(__FILE__), 'gigawatt', 'commands', 'log')
23
23
 
24
24
  module Gigawatt
25
+ CONNECTION_ERROR_EXIT_CODE = 4
25
26
  NO_PROJECT_EXIT_CODE = 3
26
27
  SETTINGS_FILE_EXISTS = 2
27
28
  INVALID_OAUTH_TOKEN_EXIT_CODE = 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 88miles
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-10-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: trollop
16
- requirement: &70353334962340 !ruby/object:Gem::Requirement
16
+ requirement: &70269939633820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70353334962340
24
+ version_requirements: *70269939633820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline
27
- requirement: &70353334961300 !ruby/object:Gem::Requirement
27
+ requirement: &70269939632660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.19
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70353334961300
35
+ version_requirements: *70269939632660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: oauth2
38
- requirement: &70353334960220 !ruby/object:Gem::Requirement
38
+ requirement: &70269939631680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.9.2i
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70353334960220
46
+ version_requirements: *70269939631680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: launchy
49
- requirement: &70353334975200 !ruby/object:Gem::Requirement
49
+ requirement: &70269939630920 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.3.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70353334975200
57
+ version_requirements: *70269939630920
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: terminal-table
60
- requirement: &70353334973620 !ruby/object:Gem::Requirement
60
+ requirement: &70269939646400 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.4.5
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70353334973620
68
+ version_requirements: *70269939646400
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: shoulda
71
- requirement: &70353334971800 !ruby/object:Gem::Requirement
71
+ requirement: &70269939643680 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70353334971800
79
+ version_requirements: *70269939643680
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rdoc
82
- requirement: &70353334970920 !ruby/object:Gem::Requirement
82
+ requirement: &70269939652600 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '3.12'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70353334970920
90
+ version_requirements: *70269939652600
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: bundler
93
- requirement: &70353334969980 !ruby/object:Gem::Requirement
93
+ requirement: &70269939650880 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '1.0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70353334969980
101
+ version_requirements: *70269939650880
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: jeweler
104
- requirement: &70353334992600 !ruby/object:Gem::Requirement
104
+ requirement: &70269939648640 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: 1.8.7
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70353334992600
112
+ version_requirements: *70269939648640
113
113
  description: 88 Miles (http://88miles.net) is simple time tracking for freelance developers,
114
114
  designers and copywriters. This gem allows you to access your account from your
115
115
  command line.
@@ -119,6 +119,7 @@ executables:
119
119
  extensions: []
120
120
  extra_rdoc_files:
121
121
  - LICENSE.txt
122
+ - README.dev
122
123
  - README.md
123
124
  files:
124
125
  - .document
@@ -147,6 +148,7 @@ files:
147
148
  - lib/gigawatt/settings.rb
148
149
  - test/helper.rb
149
150
  - test/test_gigawatt.rb
151
+ - README.dev
150
152
  homepage: http://github.com/88miles/gigawatt
151
153
  licenses:
152
154
  - MIT
@@ -162,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
164
  version: '0'
163
165
  segments:
164
166
  - 0
165
- hash: 4216107371296387972
167
+ hash: 1777984718198463116
166
168
  required_rubygems_version: !ruby/object:Gem::Requirement
167
169
  none: false
168
170
  requirements: