synrp 0.16.6 → 0.16.7

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/Gemfile.lock CHANGED
@@ -1,14 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synrp (0.16.4.1)
4
+ synrp (0.16.7)
5
5
  cri (~> 2.2)
6
+ highline
6
7
  json
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
10
11
  specs:
11
12
  cri (2.2.1)
13
+ highline (1.6.11)
12
14
  json (1.6.6)
13
15
 
14
16
  PLATFORMS
data/lib/synrp/cli.rb CHANGED
@@ -182,6 +182,39 @@ end
182
182
  end
183
183
  end
184
184
 
185
+ @cmd.define_command do
186
+ name 'assignments'
187
+ usage 'assignments [options]'
188
+ summary 'get all assignments of a given week'
189
+
190
+ required :k, :kw, 'yyyy-Wn (e. g. 2012-W6)'
191
+ required :x, :exclude_project, 'project name to be excluded'
192
+ flag :g, :group, 'sort and group by project'
193
+
194
+ run do |opts, args|
195
+
196
+ synRP.verify_opts_present(opts, [ :site, :username, :password, :kw ])
197
+
198
+ synRP.connect(opts[:site], opts[:username], opts[:password])
199
+
200
+ if opts[:group]
201
+
202
+ synRP.get_assignments_grouped(opts[:kw]).sort.each do |proj, persons|
203
+ puts "\033[1m#{proj}\033[0m: \t #{persons.join(', ')}" unless proj == opts[:exclude_project]
204
+ end
205
+
206
+ else
207
+
208
+ synRP.get_assignments(opts[:kw]).each do |as|
209
+ puts as.join("\t")
210
+ end
211
+
212
+ end
213
+
214
+ end
215
+
216
+ end
217
+
185
218
  def self.run(args)
186
219
  @cmd.run(ARGV)
187
220
  end
data/lib/synrp/synrp.rb CHANGED
@@ -27,6 +27,7 @@ class SynRP
27
27
  opts[r_opt] = config_opts[r_opt.to_s]
28
28
  elsif r_opt == :password
29
29
  opts[:password] = ask("Enter Password: ") {|q| q.echo = "*"}
30
+ puts
30
31
  else
31
32
  $stderr.puts "--#{r_opt} option is required"
32
33
  exit 1
@@ -105,6 +106,20 @@ class SynRP
105
106
  reqs.find_all { |req| req["person"]["id"].to_s == person_id.to_s }
106
107
  end
107
108
 
109
+ def get_assignments(yearWeek)
110
+ resp, data = $conn.get("/web/assignments.csv?yearWeek=#{yearWeek}", $headers)
111
+ as = data.split("\n")[1..-1].map { |as| as.split("|") }
112
+ end
113
+
114
+ def get_assignments_grouped(yearWeek)
115
+ grouped_as = Hash.new
116
+ get_assignments(yearWeek).map do |fname, lname, proj, days|
117
+ grouped_as[proj] = [] unless grouped_as[proj]
118
+ grouped_as[proj] << "#{fname} #{lname}"
119
+ end
120
+ grouped_as
121
+ end
122
+
108
123
  def calculate_remaining_availabilities(yearWeek)
109
124
  avails = get_availabilities(yearWeek)
110
125
  avails_minus_requests = avails.map do |person_id, minutes|
data/lib/synrp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Synrp
2
- VERSION = "0.16.6"
2
+ VERSION = "0.16.7"
3
3
  end
data/lib/synrp.rb CHANGED
@@ -13,7 +13,7 @@ require "synrp/synrp"
13
13
  module Synrp
14
14
 
15
15
  def self.version_information
16
- Nanoc::VERSION
16
+ Synrp::VERSION
17
17
  end
18
18
 
19
19
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synrp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 83
4
+ hash: 81
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 16
9
- - 6
10
- version: 0.16.6
9
+ - 7
10
+ version: 0.16.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Fabian Buch
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-12 00:00:00 Z
18
+ date: 2012-04-13 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: cri