dotplan 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.0.6
2
+
3
+ * added dotplan log command
4
+
1
5
  ### 0.0.5
2
6
 
3
7
  * removed debug statements
data/bin/dotplan CHANGED
@@ -8,6 +8,7 @@ commands = {
8
8
  'auth' => proc { DotPlan::Command::Auth.run },
9
9
  'register' => proc { DotPlan::Command::Register.run },
10
10
  'help' => proc { DotPlan::Command::Help.run },
11
+ 'log' => proc { DotPlan::Command::Log.run },
11
12
  }
12
13
 
13
14
  if ARGV.first && commands.keys.include?(ARGV.first.downcase)
@@ -0,0 +1,29 @@
1
+ module DotPlan
2
+ module Command
3
+ class Log
4
+ def self.run(*args)
5
+ begin
6
+ credentials = JSON.parse(File.read(DotPlan::CREDENTIALS_PATH))
7
+ rescue => e
8
+ raise "There was a problem reading your credentials. Run dotplan auth first.".red
9
+ end
10
+
11
+ username = credentials["username"]
12
+ password = credentials["password"]
13
+ url = "#{DotPlan::DOTPLAN_URL}/user/#{username}/plans"
14
+ resource = RestClient::Resource.new(url)
15
+ begin
16
+ response = resource.get
17
+ rescue => e
18
+ response = JSON.parse(e.response)
19
+ raise response["error"].red
20
+ end
21
+ plans = JSON.parse(response)
22
+ plans.each do |plan|
23
+ puts plan["date"].red
24
+ puts plan["text"].green
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -2,6 +2,7 @@ require "dotplan/command/auth.rb"
2
2
  require "dotplan/command/register.rb"
3
3
  require "dotplan/command/default.rb"
4
4
  require "dotplan/command/help.rb"
5
+ require "dotplan/command/log.rb"
5
6
 
6
7
  module DotPlan
7
8
  module Command
@@ -1,3 +1,3 @@
1
1
  module DotPlan
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotplan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-12 00:00:00.000000000Z
12
+ date: 2012-03-13 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70244903396360 !ruby/object:Gem::Requirement
16
+ requirement: &70114751297680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70244903396360
24
+ version_requirements: *70114751297680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: colorize
27
- requirement: &70244903395940 !ruby/object:Gem::Requirement
27
+ requirement: &70114751297260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70244903395940
35
+ version_requirements: *70114751297260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rest-client
38
- requirement: &70244903395520 !ruby/object:Gem::Requirement
38
+ requirement: &70114751296840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70244903395520
46
+ version_requirements: *70114751296840
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hashie
49
- requirement: &70244903395100 !ruby/object:Gem::Requirement
49
+ requirement: &70114751296420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70244903395100
57
+ version_requirements: *70114751296420
58
58
  description: The simplest way to manage your .plans
59
59
  email:
60
60
  - dpaola2@gmail.com
@@ -75,6 +75,7 @@ files:
75
75
  - lib/dotplan/command/auth.rb
76
76
  - lib/dotplan/command/default.rb
77
77
  - lib/dotplan/command/help.rb
78
+ - lib/dotplan/command/log.rb
78
79
  - lib/dotplan/command/register.rb
79
80
  - lib/dotplan/constants.rb
80
81
  - lib/dotplan/version.rb