beeminder 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/TODO CHANGED
@@ -4,3 +4,4 @@
4
4
  - [X] beemind binary
5
5
  - [X] implement actual API calls
6
6
  - [ ] add a few more sanity checks
7
+ - [ ] don't load goal info twice (wtf was I thinking?)
data/bin/beemind CHANGED
@@ -24,7 +24,6 @@ opts = Trollop::options do
24
24
  opt :list, "List all available goals."
25
25
  opt :user, "Beeminder account. (Optional. If not given, reads config or asks for it.)", :type => :string
26
26
  opt :token, "Auth token. (Optional. If not given, reads config or asks for it.)", :type => :string
27
- opt :no_config, "Don't write name / token to config file. (Implied with --user or --token.)"
28
27
  end
29
28
 
30
29
  Trollop::die usage if not (2..3).include?(ARGV.size) and not opts[:list]
@@ -41,10 +40,10 @@ if File.exists? opts[:config]
41
40
  end
42
41
 
43
42
  # ask for missing data
44
- opts[:user] ||= ask("Beeminder account:")
45
- opts[:token] ||= ask("Auth token:")
43
+ if opts[:user].nil? or opts[:token].nil?
44
+ opts[:user] ||= ask("Beeminder account:")
45
+ opts[:token] ||= ask("Auth token:")
46
46
 
47
- unless opts[:no_config]
48
47
  auth = {
49
48
  "user" => opts[:user],
50
49
  "token" => opts[:token]
@@ -170,18 +170,17 @@ module Beeminder
170
170
  attr_reader :updated_at
171
171
 
172
172
  def initialize info={}
173
- default = {
174
- "timestamp" => DateTime.now.strftime('%s')
175
- }
176
- info = default.merge(info)
177
-
178
173
  # set variables
179
174
  info.each do |k,v|
180
175
  instance_variable_set "@#{k}", v
181
176
  end
182
177
 
178
+ # defaults
179
+ @timestamp ||= DateTime.now
180
+ @comment ||= ""
181
+
183
182
  # some conversions
184
- @timestamp = DateTime.strptime(@timestamp.to_s, '%s')
183
+ @timestamp = DateTime.strptime(@timestamp.to_s, '%s') unless @timestamp.is_a? Date
185
184
  @updated_at = DateTime.strptime(@updated_at.to_s, '%s') unless @updated_at.nil?
186
185
  end
187
186
 
@@ -1,3 +1,3 @@
1
1
  module Beeminder
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beeminder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-08 00:00:00.000000000 Z
12
+ date: 2012-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  segments:
95
95
  - 0
96
- hash: -231839000410159505
96
+ hash: -4489216334068157009
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  none: false
99
99
  requirements:
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  segments:
104
104
  - 0
105
- hash: -231839000410159505
105
+ hash: -4489216334068157009
106
106
  requirements: []
107
107
  rubyforge_project:
108
108
  rubygems_version: 1.8.23