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 +3 -1
- data/lib/synrp/cli.rb +33 -0
- data/lib/synrp/synrp.rb +15 -0
- data/lib/synrp/version.rb +1 -1
- data/lib/synrp.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
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
data/lib/synrp.rb
CHANGED
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:
|
4
|
+
hash: 81
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 16
|
9
|
-
-
|
10
|
-
version: 0.16.
|
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-
|
18
|
+
date: 2012-04-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: cri
|