active_cmis 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -1,8 +1,8 @@
1
1
  module ActiveCMIS
2
- # Default logger: Outputs to STDOUT and has level set to DEBUG
2
+ # Default logger: no output
3
3
  # @return [Logger]
4
4
  def self.default_logger
5
- @default_logger ||= Logger.new(STDOUT)
5
+ @default_logger ||= Logger.new(nil)
6
6
  end
7
7
 
8
8
  # Will search for a given configuration in a file, and return the equivalent Repository
@@ -41,7 +41,11 @@ module ActiveCMIS
41
41
  config = config[config_name]
42
42
  if config.is_a? Hash
43
43
  if config.has_key? "log_file"
44
- logger = Logger.new(config["trace_file"])
44
+ trace_file = config["trace_file"]
45
+ if trace_file == "-"
46
+ trace_file = STDOUT
47
+ end
48
+ logger = Logger.new(trace_file)
45
49
  else
46
50
  logger = default_logger
47
51
  end
@@ -38,7 +38,11 @@ module ActiveCMIS
38
38
 
39
39
  # Returns id if id is already an object, object_by_id if id is a string, nil otherwise
40
40
  # @private
41
- def self.string_or_id_to_object(id)
41
+ def self.string_or_id_to_object(repository, id)
42
+ # FIXME: only used in lib/activecmis/relationship.rb, the repository parameter
43
+ # would be unnecessary if included.
44
+ # Should this be a generic method, or should this be moved to the Relationship class?
45
+ # Or should I start including this module in every place that needs it?
42
46
  case id
43
47
  when String; repository.object_by_id(id)
44
48
  when ::ActiveCMIS::Object; id
@@ -53,7 +53,7 @@ module ActiveCMIS
53
53
 
54
54
  if required && updatability == "readonly"
55
55
  logger.warn "The server behaved strange: attribute #{self.inspect} required but readonly, will set required to false"
56
- required = false
56
+ @required = false
57
57
  end
58
58
 
59
59
  @property_type = case property_type.downcase
@@ -2,13 +2,13 @@ module ActiveCMIS
2
2
  class Relationship < ::ActiveCMIS::Object
3
3
  # @return [Object]
4
4
  def source
5
- Internal::Utils.string_or_id_to_object(attribute("cmis:sourceId"))
5
+ Internal::Utils.string_or_id_to_object(repository, attribute("cmis:sourceId"))
6
6
  end
7
7
  cache :source
8
8
 
9
9
  # @return [Object]
10
10
  def target
11
- Internal::Utils.string_or_id_to_object(attribute("cmis:targetId"))
11
+ Internal::Utils.string_or_id_to_object(repository, attribute("cmis:targetId"))
12
12
  end
13
13
  cache :target
14
14
 
@@ -25,10 +25,12 @@ module ActiveCMIS
25
25
  super
26
26
  # Potentially necessary if repositories support it
27
27
  # Probably not though
28
- if source = updates["cmis:sourceId"]
28
+
29
+ # Note: we use remove_instance_variable because of the way I implemented the caching
30
+ if updates["cmis:sourceId"] && instance_variable_defined?("@source")
29
31
  remove_instance_variable "@source"
30
32
  end
31
- if updates["cmis:targetId"]
33
+ if updates["cmis:targetId"] && instance_variable_defined?("@target")
32
34
  remove_instance_variable "@target"
33
35
  end
34
36
  end
@@ -46,12 +46,12 @@ module ActiveCMIS
46
46
  response = repository.conn.get_response(@url)
47
47
  status = response.code.to_i
48
48
  if 200 <= status && status < 300
49
- data = response.body
49
+ data = response.body
50
50
  else
51
51
  raise HTTPError.new("Problem downloading rendition: status: #{status}, message: #{response.body}")
52
52
  end
53
53
  content_type = response.content_type
54
- content_lenth = response.content_length || response.body.length # In case content encoding is chunked? ??
54
+ content_length = response.content_length || response.body.length # In case content encoding is chunked? ??
55
55
  else
56
56
  data = @data
57
57
  content_type = @format
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_cmis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 3
9
+ version: 0.1.3
5
10
  platform: ruby
6
11
  authors:
7
12
  - Joeri Samson
@@ -9,19 +14,23 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-04-12 00:00:00 +02:00
17
+ date: 2010-10-20 00:00:00 +02:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: nokogiri
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 4
30
+ - 1
23
31
  version: 1.4.1
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  description: A CMIS library implementing both reading and updating capabilities through the AtomPub/REST binding to CMIS.
26
35
  email: joeri@xaop.com
27
36
  executables: []
@@ -75,18 +84,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
84
  requirements:
76
85
  - - ">="
77
86
  - !ruby/object:Gem::Version
87
+ segments:
88
+ - 1
89
+ - 8
90
+ - 6
78
91
  version: 1.8.6
79
- version:
80
92
  required_rubygems_version: !ruby/object:Gem::Requirement
81
93
  requirements:
82
94
  - - ">="
83
95
  - !ruby/object:Gem::Version
96
+ segments:
97
+ - 0
84
98
  version: "0"
85
- version:
86
99
  requirements: []
87
100
 
88
101
  rubyforge_project:
89
- rubygems_version: 1.3.5
102
+ rubygems_version: 1.3.6
90
103
  signing_key:
91
104
  specification_version: 3
92
105
  summary: A library to interact with CMIS repositories through the AtomPub/REST binding