idonethis-cli 0.14.2 → 0.15.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cece8c6a4d992d1e201f44784aab1969577784d4
4
- data.tar.gz: d73e1a6707ad9f22e0aa4e5047437e436dd487a9
3
+ metadata.gz: 4182a64e9826e779a203b440d80d91188790b8b6
4
+ data.tar.gz: 58c4a1a481ab51baf479e9033b2f907b5b60e079
5
5
  SHA512:
6
- metadata.gz: 4dee44830a78434373a2cbaa0f20c7f30fc744826d15732129530817a5c99192da8c9111c12cf0d2c24e30dbc6eaf4ebac4d0c801c0da6e1f1d976c0352f37ca
7
- data.tar.gz: 32acdaa1d43f63635fa51b87215a36331af6d228ca2ba7123eefcdcaeb104c9386bf52c07f27206267a9fa58c28138e1c0313dfccef17401b74ae7fd37b2d42d
6
+ metadata.gz: 0f7e9fadd484284850ce58f3c7e78e2f94a6f4a5ba3bca2a05dba74b7c14409bebf47bbf3ec3228b7497f0435722b719b7acdacc42d6f88aecb2241c1dcaadff
7
+ data.tar.gz: 81db5e4f8f974311baa133f9affa5dbae2051b983fcaecefe2fb95d09ef245286477ae33d31365227431bc342151319931d2eaa5992513e61b3d9054bc3649d5
data/lib/adapters/cli.rb CHANGED
@@ -1,7 +1,4 @@
1
1
  require 'internet'
2
- require 'views/cli'
3
- require 'use_cases/new'
4
- require 'use_cases/list'
5
2
  require 'settings_file'
6
3
  require 'io/directory_info'
7
4
 
@@ -10,12 +7,12 @@ module Idonethis::Adapters
10
7
  class << self
11
8
  def run(argv={})
12
9
  adapters = {
13
- internet: Idonethis::Adapters::Internet,
14
- git: Idonethis::Adapters::Git,
15
- fs: Idonethis::Adapters::IO::DirectoryInfo,
10
+ internet: Internet,
11
+ git: Git,
12
+ fs: IO::DirectoryInfo,
16
13
  views: {
17
- list: Idonethis::Adapters::Views::Cli::List.method(:apply),
18
- teams: Idonethis::Adapters::Views::Cli::Teams.method(:apply) },
14
+ list: Views::Cli::List.method(:apply),
15
+ teams: Views::Cli::Teams.method(:apply) },
19
16
  settings: Settings,
20
17
  log: ->(msg){puts "[LOG] #{msg}"}}
21
18
 
@@ -10,7 +10,7 @@ module Idonethis::Adapters
10
10
  # "team_short_name"=>"benbiddington-personal", "tags"=>[], "likes"=>[], "comments"=>[], "meta_data"=>{}, "is_goal"=>true, "goal_completed"=>false,
11
11
  # "url"=>"https://idonethis.com/api/v0.1/dones/22609300/", "team"=>"https://idonethis.com/api/v0.1/teams/benbiddington-personal/", "raw_text"=>"[ ] fix api smoke", "permalink"=>"https://idonethis.com/done/22609300/"}
12
12
  # puts d.inspect
13
- printf("%-5s", i+1); print(%Q{#{d["created"]} #{d["team_short_name"]} }); printf("%-20s", d["owner"]); print(%Q{ -- #{d["raw_text"].slice(0,150)}}); print("\n")
13
+ printf("%-5s", i+1); print(%Q{#{d["done_date"]} #{d["team_short_name"]} }); printf("%-20s", d["owner"]); print(%Q{ -- #{d["raw_text"].slice(0,150)}}); print("\n")
14
14
  end
15
15
  end
16
16
  end
@@ -1,5 +1,5 @@
1
1
  module Idonethis
2
2
  module Cli
3
- VERSION = "0.14.2"
3
+ VERSION = "0.15.0"
4
4
  end
5
5
  end
@@ -33,16 +33,16 @@ module Idonethis::UseCases
33
33
 
34
34
  def choose(command, adapters, views, opts)
35
35
  use_cases = {
36
- list: Idonethis::UseCases::List.method(:apply),
37
- new: Idonethis::UseCases::New.method(:apply),
38
- config: Idonethis::UseCases::Config.method(:apply),
39
- git: ->(_, args) { Idonethis::UseCases::Git.apply(_, args.merge(git: adapters[:git], view: ->(msg) { puts msg }, fs: adapters[:fs]))},
36
+ list: List.method(:apply),
37
+ new: New.method(:apply),
38
+ config: Config.method(:apply),
39
+ git: ->(_, args) { Git.apply(_, args.merge(git: adapters[:git], view: ->(msg) { puts msg }, fs: adapters[:fs]))},
40
40
  help: ->(credential, args) { puts "TODO: implement help" }
41
41
  }
42
42
 
43
43
  if command == :list && opts.include?("teams")
44
44
  return ->(credential, args) {
45
- Idonethis::UseCases::Teams.apply(credential, args.merge(view: views[:teams]))
45
+ Teams.apply(credential, args.merge(view: views[:teams]))
46
46
  }
47
47
  end
48
48
 
@@ -50,7 +50,7 @@ module Idonethis::UseCases
50
50
  end
51
51
 
52
52
  def choose_log(args={})
53
- args[:verbose] == true ? ->(msg){puts "[LOG] #{msg}"} : ->(_){}
53
+ args[:verbose].true? ? ->(msg){puts "[LOG] #{msg}"} : ->(_){}
54
54
  end
55
55
  end
56
56
  end
@@ -21,7 +21,7 @@ module Idonethis::UseCases
21
21
  else
22
22
  dirs = fs.modified_today?(dir).select{|dir| git.repo?(dir) }
23
23
 
24
- view.call "Scanning dir <#{dir}>, which has <#{dirs.size}> repositories that have changed today\n\n"
24
+ view.call "Scanning dir <#{dir}>, which has <#{dirs.size}> repositories that have changed\n\n"
25
25
  end
26
26
 
27
27
  view.call summarise(git, view, since, *dirs)
@@ -30,7 +30,7 @@ module Idonethis::UseCases
30
30
  end
31
31
 
32
32
  def get_page(page, credential, log, args) # https://idonethis.com/api/v0.1/dones/
33
- params = {"order_by" => "-created", "page_size" => 100, "page" => page}.
33
+ params = {"order_by" => "-done_date", "page_size" => 100, "page" => page}.
34
34
  merge(done_date_from(args)).
35
35
  merge({team: (args[:team] || credential[:team])})
36
36
 
@@ -5,16 +5,25 @@ module Idonethis::UseCases
5
5
  log = args[:log] || fail("You need to supply :internet adapter")
6
6
  internet = args[:internet] || fail("You need to supply :internet adapter")
7
7
  team = args[:team]
8
+ date = args[:date]
8
9
 
9
10
  log.call "args: #{args}"
10
11
  log.call "overriding team <#{credential[:team]}> with <#{team}>"
12
+
13
+ body = {
14
+ "raw_text" => args[:message],
15
+ "team" => (team || credential[:team])
16
+ }
17
+
18
+ body = body.merge({"done_date" => Time.parse(date).strftime("%F")}) if date
19
+
20
+ log.call body
11
21
 
12
22
  parse internet.post(
13
23
  Idonethis::Index.dones,
14
24
  { "Authorization" => "Token #{credential[:token]}", accept: "application/json"},
15
- {
16
- "raw_text" => args[:message],
17
- "team" => (team || credential[:team])})
25
+ body
26
+ )
18
27
  end
19
28
 
20
29
  private
@@ -26,4 +35,4 @@ module Idonethis::UseCases
26
35
  end
27
36
  end
28
37
  end
29
- end
38
+ end
@@ -28,7 +28,11 @@ module Idonethis::UseCases
28
28
  opts.on("-s WHEN", "--since WHEN" "Show git commits since when") do |value|
29
29
  args[:since] = value
30
30
  end
31
- end.parse!
31
+
32
+ opts.on("-d DATE", "--date DATE" "Set done date, defaults to now") do |value|
33
+ args[:date] = value
34
+ end
35
+ end.parse!(argv)
32
36
 
33
37
  args
34
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idonethis-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Biddington
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-25 00:00:00.000000000 Z
11
+ date: 2015-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler