sakai-info 0.4.0 → 0.4.1
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/CHANGELOG.md +8 -0
- data/README.md +7 -2
- data/ROADMAP.md +4 -4
- data/lib/sakai-info.rb +33 -1
- data/lib/sakai-info/group.rb +2 -10
- data/lib/sakai-info/page.rb +2 -10
- data/lib/sakai-info/site.rb +6 -11
- data/lib/sakai-info/tool.rb +2 -10
- data/lib/sakai-info/user.rb +2 -10
- data/lib/sakai-info/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# sakai-info Change History #
|
2
2
|
|
3
|
+
### 0.4.1 ###
|
4
|
+
|
5
|
+
*Released 2012-04-22*
|
6
|
+
|
7
|
+
* Improved MySQL support (from not working at all to mostly working)
|
8
|
+
* Removed properties performance hack which was inapplicable to MySQL
|
9
|
+
* Cleaned up site default serialization
|
10
|
+
|
3
11
|
### 0.4.0 ###
|
4
12
|
|
5
13
|
*Released 2012-04-21*
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# sakai-info #
|
2
2
|
|
3
|
-
last updated: 2012-04-
|
3
|
+
last updated: 2012-04-22
|
4
4
|
author: David Adams (daveadams@gmail.com)
|
5
5
|
github url: https://github.com/daveadams/sakai-info
|
6
6
|
|
@@ -24,7 +24,7 @@ Use `rake` to test and build the gem:
|
|
24
24
|
$ rake gem:build
|
25
25
|
|
26
26
|
The resulting gem will be saved to the working directory as
|
27
|
-
`sakai-info-0.4.
|
27
|
+
`sakai-info-0.4.1.gem`.
|
28
28
|
|
29
29
|
Cleanup built gems using:
|
30
30
|
|
@@ -48,6 +48,11 @@ gems must also be installed to support whatever database or databases you use.
|
|
48
48
|
Oracle support requires the `ruby-oci8` gem, and MySQL support requires the
|
49
49
|
`mysql` gem. Some unit tests make use of the `sqlite3` gem.
|
50
50
|
|
51
|
+
## MySQL Support ##
|
52
|
+
|
53
|
+
MySQL support is now working. Your MySQL server must have the setting
|
54
|
+
`lower_case_table_names=1` or be running on a case-insensitive filesystem.
|
55
|
+
|
51
56
|
## Configuration ##
|
52
57
|
|
53
58
|
To run, *sakai-info* needs to be able to connect to your Sakai database server.
|
data/ROADMAP.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# sakai-info Roadmap #
|
2
2
|
|
3
|
-
*Last updated 2012-04-
|
3
|
+
*Last updated 2012-04-22*
|
4
4
|
|
5
|
-
### 0.4.
|
5
|
+
### 0.4.2 ###
|
6
6
|
|
7
7
|
* CLI access to announcements
|
8
8
|
|
9
|
-
### 0.4.
|
9
|
+
### 0.4.3 ###
|
10
10
|
|
11
11
|
* CLI access to gradebook
|
12
12
|
|
13
|
-
### 0.4.
|
13
|
+
### 0.4.4 ###
|
14
14
|
|
15
15
|
* CLI access to authz (realms, roles, functions)
|
16
16
|
|
data/lib/sakai-info.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Base library file
|
3
3
|
#
|
4
4
|
# Created 2012-02-15 daveadams@gmail.com
|
5
|
-
# Last updated 2012-04-
|
5
|
+
# Last updated 2012-04-22 daveadams@gmail.com
|
6
6
|
#
|
7
7
|
# https://github.com/daveadams/sakai-info
|
8
8
|
#
|
@@ -71,6 +71,7 @@ module SakaiInfo
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
######################################################################
|
74
75
|
# extensions to other objects
|
75
76
|
class String
|
76
77
|
def is_uuid?
|
@@ -78,6 +79,37 @@ class String
|
|
78
79
|
end
|
79
80
|
end
|
80
81
|
|
82
|
+
# terrible hack to work around mysql case issues
|
83
|
+
# essentially, if the hash key asked for is a symbol and its value is
|
84
|
+
# nil, then try again with the uppercased version of the symbol
|
85
|
+
# this might cause problems in weird cases with other hashes, this is
|
86
|
+
# definitely not a sustainable fix.
|
87
|
+
# TODO: patch Sequel for case-insensitive/-fixed identifiers
|
88
|
+
class Hash
|
89
|
+
alias :original_brackets :[]
|
90
|
+
|
91
|
+
def [](key)
|
92
|
+
if not (value = original_brackets(key)).nil?
|
93
|
+
return value
|
94
|
+
else
|
95
|
+
if key.is_a? Symbol
|
96
|
+
return original_brackets(key.to_s.upcase.to_sym)
|
97
|
+
else
|
98
|
+
return nil
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# alias .to_s on Blob class to match OCI8 blob class's read method
|
105
|
+
module Sequel
|
106
|
+
module SQL
|
107
|
+
class Blob
|
108
|
+
alias :read :to_s
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
81
113
|
# baseline db connectivity
|
82
114
|
require 'sakai-info/database'
|
83
115
|
|
data/lib/sakai-info/group.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# SakaiInfo::Group library
|
3
3
|
#
|
4
4
|
# Created 2012-02-17 daveadams@gmail.com
|
5
|
-
# Last updated 2012-
|
5
|
+
# Last updated 2012-04-22 daveadams@gmail.com
|
6
6
|
#
|
7
7
|
# https://github.com/daveadams/sakai-info
|
8
8
|
#
|
@@ -120,17 +120,9 @@ module SakaiInfo
|
|
120
120
|
|
121
121
|
def self.find_by_group_id(group_id)
|
122
122
|
properties = {}
|
123
|
-
# HACK: reading blobs via OCI8 is really slow, make the db server do it!
|
124
|
-
# This is multiple orders of magnitude faster.
|
125
|
-
# But, this will break if the property value is > 4000chars and may not work
|
126
|
-
# on mysql, so here's the original version:
|
127
|
-
# DB.connect[:sakai_site_group_property].where(:group_id => group_id).all.each do |row|
|
128
|
-
# properties[row[:name]] = row[:value].read
|
129
|
-
# end
|
130
123
|
DB.connect[:sakai_site_group_property].
|
131
|
-
select(:name, :to_char.sql_function(:value).as(:value)).
|
132
124
|
where(:group_id => group_id).all.each do |row|
|
133
|
-
properties[row[:name]] = row[:value]
|
125
|
+
properties[row[:name]] = row[:value].read
|
134
126
|
end
|
135
127
|
return properties
|
136
128
|
end
|
data/lib/sakai-info/page.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# SakaiInfo::Page library
|
3
3
|
#
|
4
4
|
# Created 2012-03-08 daveadams@gmail.com
|
5
|
-
# Last updated 2012-
|
5
|
+
# Last updated 2012-04-22 daveadams@gmail.com
|
6
6
|
#
|
7
7
|
# https://github.com/daveadams/sakai-info
|
8
8
|
#
|
@@ -101,17 +101,9 @@ module SakaiInfo
|
|
101
101
|
|
102
102
|
def self.find_by_page_id(page_id)
|
103
103
|
properties = {}
|
104
|
-
# HACK: reading blobs via OCI8 is really slow, make the db server do it!
|
105
|
-
# This is multiple orders of magnitude faster.
|
106
|
-
# But, this will break if the property value is > 4000chars and may not work
|
107
|
-
# on mysql, so here's the original version:
|
108
|
-
# DB.connect[:sakai_site_page_property].where(:page_id => page_id).all.each do |row|
|
109
|
-
# properties[row[:name]] = row[:value].read
|
110
|
-
# end
|
111
104
|
DB.connect[:sakai_site_page_property].
|
112
|
-
select(:name, :to_char.sql_function(:value).as(:value)).
|
113
105
|
where(:page_id => page_id).all.each do |row|
|
114
|
-
properties[row[:name]] = row[:value]
|
106
|
+
properties[row[:name]] = row[:value].read
|
115
107
|
end
|
116
108
|
return properties
|
117
109
|
end
|
data/lib/sakai-info/site.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# SakaiInfo::Site library
|
3
3
|
#
|
4
4
|
# Created 2012-02-17 daveadams@gmail.com
|
5
|
-
# Last updated 2012-04-
|
5
|
+
# Last updated 2012-04-22 daveadams@gmail.com
|
6
6
|
#
|
7
7
|
# https://github.com/daveadams/sakai-info
|
8
8
|
#
|
@@ -255,12 +255,15 @@ module SakaiInfo
|
|
255
255
|
"gradebook_item_count" => (self.gradebook.nil? ? 0 : self.gradebook.item_count),
|
256
256
|
"forum_count" => self.forum_count
|
257
257
|
}
|
258
|
-
if result["providers"].nil? or result["providers"] == ""
|
258
|
+
if result["providers"].nil? or result["providers"] == "" or result["providers"] == []
|
259
259
|
result.delete("providers")
|
260
260
|
end
|
261
261
|
if result["is_joinable"] == false
|
262
262
|
result.delete("join_role")
|
263
263
|
end
|
264
|
+
if result["site_properties"] == {}
|
265
|
+
result.delete("site_properties")
|
266
|
+
end
|
264
267
|
if self.gradebook.nil?
|
265
268
|
result.delete("gradebook_item_count")
|
266
269
|
end
|
@@ -402,17 +405,9 @@ module SakaiInfo
|
|
402
405
|
|
403
406
|
def self.find_by_site_id(site_id)
|
404
407
|
properties = {}
|
405
|
-
# HACK: reading blobs via OCI8 is really slow, make the db server do it!
|
406
|
-
# This is multiple orders of magnitude faster.
|
407
|
-
# But, this will break if the property value is > 4000chars and may not work
|
408
|
-
# on mysql, so here's the original version:
|
409
|
-
# DB.connect[:sakai_site_property].where(:site_id => site_id).all.each do |row|
|
410
|
-
# properties[row[:name]] = row[:value].read
|
411
|
-
# end
|
412
408
|
DB.connect[:sakai_site_property].
|
413
|
-
select(:name, :to_char.sql_function(:value).as(:value)).
|
414
409
|
where(:site_id => site_id).all.each do |row|
|
415
|
-
properties[row[:name]] = row[:value]
|
410
|
+
properties[row[:name]] = row[:value].read
|
416
411
|
end
|
417
412
|
return properties
|
418
413
|
end
|
data/lib/sakai-info/tool.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# SakaiInfo::Tool library
|
3
3
|
#
|
4
4
|
# Created 2012-03-08 daveadams@gmail.com
|
5
|
-
# Last updated 2012-
|
5
|
+
# Last updated 2012-04-22 daveadams@gmail.com
|
6
6
|
#
|
7
7
|
# https://github.com/daveadams/sakai-info
|
8
8
|
#
|
@@ -106,17 +106,9 @@ module SakaiInfo
|
|
106
106
|
|
107
107
|
def self.find_by_tool_id(tool_id)
|
108
108
|
properties = {}
|
109
|
-
# HACK: reading blobs via OCI8 is really slow, make the db server do it!
|
110
|
-
# This is multiple orders of magnitude faster.
|
111
|
-
# But, this will break if the property value is > 4000chars and may not work
|
112
|
-
# on mysql, so here's the original version:
|
113
|
-
# DB.connect[:sakai_site_tool_property].where(:tool_id => tool_id).all.each do |row|
|
114
|
-
# properties[row[:name]] = row[:value].read
|
115
|
-
# end
|
116
109
|
DB.connect[:sakai_site_tool_property].
|
117
|
-
select(:name, :to_char.sql_function(:value).as(:value)).
|
118
110
|
where(:tool_id => tool_id).all.each do |row|
|
119
|
-
properties[row[:name]] = row[:value]
|
111
|
+
properties[row[:name]] = row[:value].read
|
120
112
|
end
|
121
113
|
return properties
|
122
114
|
end
|
data/lib/sakai-info/user.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# SakaiInfo::User library
|
3
3
|
#
|
4
4
|
# Created 2012-02-17 daveadams@gmail.com
|
5
|
-
# Last updated 2012-
|
5
|
+
# Last updated 2012-04-22 daveadams@gmail.com
|
6
6
|
#
|
7
7
|
# https://github.com/daveadams/sakai-info
|
8
8
|
#
|
@@ -218,17 +218,9 @@ module SakaiInfo
|
|
218
218
|
|
219
219
|
def self.find_by_user_id(user_id)
|
220
220
|
properties = {}
|
221
|
-
# HACK: reading blobs via OCI8 is really slow, make the db server do it!
|
222
|
-
# This is multiple orders of magnitude faster.
|
223
|
-
# But, this will break if the property value is > 4000chars and may not work
|
224
|
-
# on mysql, so here's the original version:
|
225
|
-
# DB.connect[:sakai_user_property].where(:user_id => user_id).all.each do |row|
|
226
|
-
# properties[row[:name]] = row[:value].read
|
227
|
-
# end
|
228
221
|
DB.connect[:sakai_user_property].
|
229
|
-
select(:name, :to_char.sql_function(:value).as(:value)).
|
230
222
|
where(:user_id => user_id).all.each do |row|
|
231
|
-
properties[row[:name]] = row[:value]
|
223
|
+
properties[row[:name]] = row[:value].read
|
232
224
|
end
|
233
225
|
return properties
|
234
226
|
end
|
data/lib/sakai-info/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sakai-info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Adams
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-22 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|