beeminder 0.1.5 → 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.
- data/TODO +1 -1
- data/bin/beemind +21 -10
- data/lib/beeminder/version.rb +1 -1
- metadata +3 -3
data/TODO
CHANGED
data/bin/beemind
CHANGED
@@ -20,31 +20,42 @@ usage = "usage: beemind goal value [comment]"
|
|
20
20
|
opts = Trollop::options do
|
21
21
|
banner usage
|
22
22
|
|
23
|
-
opt :config,
|
24
|
-
opt :list,
|
23
|
+
opt :config, "Path to config.", :type => :string, :default => "~/.beeminderrc"
|
24
|
+
opt :list, "List all available goals."
|
25
|
+
opt :user, "Beeminder account. (Optional. If not given, reads config or asks for it.)", :type => :string
|
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.)"
|
25
28
|
end
|
26
29
|
|
27
30
|
Trollop::die usage if not (2..3).include?(ARGV.size) and not opts[:list]
|
28
31
|
goal, value, comment = ARGV unless opts[:list]
|
29
32
|
|
30
33
|
opts[:config] = File.expand_path opts[:config]
|
34
|
+
opts[:no_config] = true if opts[:user] or opts[:token]
|
31
35
|
|
32
|
-
if
|
33
|
-
#
|
36
|
+
if File.exists? opts[:config]
|
37
|
+
# read config to fill in the gaps
|
38
|
+
auth = YAML.load File.open(opts[:config]) || {}
|
39
|
+
opts[:user] ||= auth["user"]
|
40
|
+
opts[:token] ||= auth["token"]
|
41
|
+
end
|
42
|
+
|
43
|
+
# ask for missing data
|
44
|
+
opts[:user] ||= ask("Beeminder account:")
|
45
|
+
opts[:token] ||= ask("Auth token:")
|
46
|
+
|
47
|
+
unless opts[:no_config]
|
34
48
|
auth = {
|
35
|
-
"
|
36
|
-
"token"
|
49
|
+
"user" => opts[:user],
|
50
|
+
"token" => opts[:token]
|
37
51
|
}
|
38
52
|
File.open(opts[:config], "w+") {|f| YAML.dump auth, f}
|
39
53
|
File.chmod 0600, opts[:config]
|
40
54
|
puts "Written config to '#{opts[:config]}.'"
|
41
55
|
end
|
42
56
|
|
43
|
-
# load config
|
44
|
-
auth = YAML.load File.open(opts[:config])
|
45
|
-
|
46
57
|
# login
|
47
|
-
bee = Beeminder::User.new
|
58
|
+
bee = Beeminder::User.new opts[:user], opts[:token]
|
48
59
|
|
49
60
|
if opts[:list]
|
50
61
|
# list all available goals
|
data/lib/beeminder/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
segments:
|
95
95
|
- 0
|
96
|
-
hash:
|
96
|
+
hash: -231839000410159505
|
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:
|
105
|
+
hash: -231839000410159505
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
108
|
rubygems_version: 1.8.23
|