axtro-roart 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/lib/roart.rb +1 -0
- data/lib/roart/core/hash.rb +0 -1
- data/lib/roart/ticket.rb +3 -3
- data/roart.gemspec +5 -17
- metadata +21 -10
- data/lib/roart/core/array.rb +0 -11
- data/lib/roart/core/hash/indifferent_access.rb +0 -135
- data/lib/roart/core/string.rb +0 -28
- data/spec/roart/core/array_spec.rb +0 -13
- data/spec/roart/core/string_spec.rb +0 -13
data/History.txt
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
==0.1.9 / 2010-05-23
|
2
|
+
Removed the String/Hash extensions copied from ActiveSupport and just added a dependency on ActiveSupport. Removed to_hash added to Array, as it conflicts with ActiveSupport's deep_merge.
|
3
|
+
|
1
4
|
==0.1.8 / 2010-03-16
|
2
5
|
Added validate presence of.
|
3
6
|
Updated specs to test validations.
|
data/lib/roart.rb
CHANGED
data/lib/roart/core/hash.rb
CHANGED
data/lib/roart/ticket.rb
CHANGED
@@ -2,7 +2,7 @@ module Roart
|
|
2
2
|
|
3
3
|
module Tickets
|
4
4
|
|
5
|
-
DefaultAttributes = %w(queue owner creator subject status priority initial_priority final_priority requestors cc admin_cc created starts started due resolved told last_updated time_estimated time_worked time_left text)
|
5
|
+
DefaultAttributes = %w(queue owner creator subject status priority initial_priority final_priority requestors cc admin_cc created starts started due resolved told last_updated time_estimated time_worked time_left text).inject({}){|memo, k| memo[k] = nil; memo}
|
6
6
|
RequiredAttributes = %w(queue subject)
|
7
7
|
|
8
8
|
end
|
@@ -23,9 +23,9 @@ module Roart
|
|
23
23
|
#
|
24
24
|
def initialize(attributes=nil)
|
25
25
|
if attributes
|
26
|
-
@attributes = Roart::Tickets::DefaultAttributes.
|
26
|
+
@attributes = Roart::Tickets::DefaultAttributes.merge(attributes)
|
27
27
|
else
|
28
|
-
@attributes = Roart::Tickets::DefaultAttributes
|
28
|
+
@attributes = Roart::Tickets::DefaultAttributes
|
29
29
|
end
|
30
30
|
@attributes.update(:id => 'ticket/new')
|
31
31
|
@saved = false
|
data/roart.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{axtro-roart}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.9"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["PJ Davis"]
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = %q{Interface for working with Request Tracker (RT) tickets inspired by ActiveRecord.}
|
11
11
|
s.email = %q{pj.davis@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["History.txt", "README.rdoc", "spec/test_data/full_history.txt", "spec/test_data/search_ticket.txt", "spec/test_data/single_history.txt", "spec/test_data/ticket.txt"]
|
13
|
-
s.files = ["History.txt", "README.rdoc", "Rakefile", "lib/roart.rb", "lib/roart/callbacks.rb", "lib/roart/connection.rb", "lib/roart/connection_adapter.rb", "lib/roart/connection_adapters/mechanize_adapter.rb", "lib/roart/core/
|
13
|
+
s.files = ["History.txt", "README.rdoc", "Rakefile", "lib/roart.rb", "lib/roart/callbacks.rb", "lib/roart/connection.rb", "lib/roart/connection_adapter.rb", "lib/roart/connection_adapters/mechanize_adapter.rb", "lib/roart/core/hash.rb", "lib/roart/errors.rb", "lib/roart/history.rb", "lib/roart/roart.rb", "lib/roart/ticket.rb", "lib/roart/ticket_page.rb", "lib/roart/validations.rb", "roart.gemspec", "spec/roart/callbacks_spec.rb", "spec/roart/connection_adapter_spec.rb", "spec/roart/connection_spec.rb", "spec/roart/core/hash_spec.rb", "spec/roart/history_spec.rb", "spec/roart/roart_spec.rb", "spec/roart/ticket_page_spec.rb", "spec/roart/ticket_spec.rb", "spec/roart/validation_spec.rb", "spec/roart_spec.rb", "spec/spec_helper.rb", "spec/test_data/full_history.txt", "spec/test_data/search_ticket.txt", "spec/test_data/single_history.txt", "spec/test_data/ticket.txt"]
|
14
14
|
s.homepage = %q{http://github.com/hennk/roart}
|
15
15
|
s.rdoc_options = ["--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
@@ -18,19 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.rubygems_version = %q{1.3.5}
|
19
19
|
s.summary = %q{Interface for working with Request Tracker (RT) tickets inspired by ActiveRecord}
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
26
|
-
s.add_runtime_dependency(%q<mechanize>, [">= 1.0.0"])
|
27
|
-
s.add_development_dependency(%q<bones>, [">= 2.5.1"])
|
28
|
-
else
|
29
|
-
s.add_dependency(%q<mechanize>, [">= 1.0.0"])
|
30
|
-
s.add_dependency(%q<bones>, [">= 2.5.1"])
|
31
|
-
end
|
32
|
-
else
|
33
|
-
s.add_dependency(%q<mechanize>, [">= 1.0.0"])
|
34
|
-
s.add_dependency(%q<bones>, [">= 2.5.1"])
|
35
|
-
end
|
21
|
+
s.add_runtime_dependency(%q<mechanize>, [">= 1.0.0"])
|
22
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.0.0"])
|
23
|
+
s.add_development_dependency(%q<bones>, [">= 2.5.1"])
|
36
24
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axtro-roart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 9
|
10
|
+
version: 0.1.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- PJ Davis
|
@@ -35,9 +35,25 @@ dependencies:
|
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
38
|
+
name: activesupport
|
39
39
|
prerelease: false
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 15
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 0
|
49
|
+
- 0
|
50
|
+
version: 2.0.0
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: bones
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
57
|
none: false
|
42
58
|
requirements:
|
43
59
|
- - ">="
|
@@ -49,7 +65,7 @@ dependencies:
|
|
49
65
|
- 1
|
50
66
|
version: 2.5.1
|
51
67
|
type: :development
|
52
|
-
version_requirements: *
|
68
|
+
version_requirements: *id003
|
53
69
|
description: Interface for working with Request Tracker (RT) tickets inspired by ActiveRecord.
|
54
70
|
email: pj.davis@gmail.com
|
55
71
|
executables: []
|
@@ -72,10 +88,7 @@ files:
|
|
72
88
|
- lib/roart/connection.rb
|
73
89
|
- lib/roart/connection_adapter.rb
|
74
90
|
- lib/roart/connection_adapters/mechanize_adapter.rb
|
75
|
-
- lib/roart/core/array.rb
|
76
91
|
- lib/roart/core/hash.rb
|
77
|
-
- lib/roart/core/hash/indifferent_access.rb
|
78
|
-
- lib/roart/core/string.rb
|
79
92
|
- lib/roart/errors.rb
|
80
93
|
- lib/roart/history.rb
|
81
94
|
- lib/roart/roart.rb
|
@@ -86,9 +99,7 @@ files:
|
|
86
99
|
- spec/roart/callbacks_spec.rb
|
87
100
|
- spec/roart/connection_adapter_spec.rb
|
88
101
|
- spec/roart/connection_spec.rb
|
89
|
-
- spec/roart/core/array_spec.rb
|
90
102
|
- spec/roart/core/hash_spec.rb
|
91
|
-
- spec/roart/core/string_spec.rb
|
92
103
|
- spec/roart/history_spec.rb
|
93
104
|
- spec/roart/roart_spec.rb
|
94
105
|
- spec/roart/ticket_page_spec.rb
|
data/lib/roart/core/array.rb
DELETED
@@ -1,135 +0,0 @@
|
|
1
|
-
unless defined?(HashWithIndifferentAccess)
|
2
|
-
# used from ActiveSupport
|
3
|
-
# Copyright (c) 2005-2009 David Heinemeier Hansson
|
4
|
-
|
5
|
-
# This class has dubious semantics and we only have it so that
|
6
|
-
# people can write params[:key] instead of params['key']
|
7
|
-
# and they get the same value for both keys.
|
8
|
-
|
9
|
-
class HashWithIndifferentAccess < Hash
|
10
|
-
def initialize(constructor = {})
|
11
|
-
if constructor.is_a?(Hash)
|
12
|
-
super()
|
13
|
-
update(constructor)
|
14
|
-
else
|
15
|
-
super(constructor)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def default(key = nil)
|
20
|
-
if key.is_a?(Symbol) && include?(key = key.to_s)
|
21
|
-
self[key]
|
22
|
-
else
|
23
|
-
super
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
alias_method :regular_writer, :[]= unless method_defined?(:regular_writer)
|
28
|
-
alias_method :regular_update, :update unless method_defined?(:regular_update)
|
29
|
-
|
30
|
-
# Assigns a new value to the hash:
|
31
|
-
#
|
32
|
-
# hash = HashWithIndifferentAccess.new
|
33
|
-
# hash[:key] = "value"
|
34
|
-
#
|
35
|
-
def []=(key, value)
|
36
|
-
regular_writer(convert_key(key), convert_value(value))
|
37
|
-
end
|
38
|
-
|
39
|
-
# Updates the instantized hash with values from the second:
|
40
|
-
#
|
41
|
-
# hash_1 = HashWithIndifferentAccess.new
|
42
|
-
# hash_1[:key] = "value"
|
43
|
-
#
|
44
|
-
# hash_2 = HashWithIndifferentAccess.new
|
45
|
-
# hash_2[:key] = "New Value!"
|
46
|
-
#
|
47
|
-
# hash_1.update(hash_2) # => {"key"=>"New Value!"}
|
48
|
-
#
|
49
|
-
def update(other_hash)
|
50
|
-
other_hash.each_pair { |key, value| regular_writer(convert_key(key), convert_value(value)) }
|
51
|
-
self
|
52
|
-
end
|
53
|
-
|
54
|
-
alias_method :merge!, :update
|
55
|
-
|
56
|
-
# Checks the hash for a key matching the argument passed in:
|
57
|
-
#
|
58
|
-
# hash = HashWithIndifferentAccess.new
|
59
|
-
# hash["key"] = "value"
|
60
|
-
# hash.key? :key # => true
|
61
|
-
# hash.key? "key" # => true
|
62
|
-
#
|
63
|
-
def key?(key)
|
64
|
-
super(convert_key(key))
|
65
|
-
end
|
66
|
-
|
67
|
-
alias_method :include?, :key?
|
68
|
-
alias_method :has_key?, :key?
|
69
|
-
alias_method :member?, :key?
|
70
|
-
|
71
|
-
# Fetches the value for the specified key, same as doing hash[key]
|
72
|
-
def fetch(key, *extras)
|
73
|
-
super(convert_key(key), *extras)
|
74
|
-
end
|
75
|
-
|
76
|
-
# Returns an array of the values at the specified indices:
|
77
|
-
#
|
78
|
-
# hash = HashWithIndifferentAccess.new
|
79
|
-
# hash[:a] = "x"
|
80
|
-
# hash[:b] = "y"
|
81
|
-
# hash.values_at("a", "b") # => ["x", "y"]
|
82
|
-
#
|
83
|
-
def values_at(*indices)
|
84
|
-
indices.collect {|key| self[convert_key(key)]}
|
85
|
-
end
|
86
|
-
|
87
|
-
# Returns an exact copy of the hash.
|
88
|
-
def dup
|
89
|
-
HashWithIndifferentAccess.new(self)
|
90
|
-
end
|
91
|
-
|
92
|
-
# Merges the instantized and the specified hashes together, giving precedence to the values from the second hash
|
93
|
-
# Does not overwrite the existing hash.
|
94
|
-
def merge(hash)
|
95
|
-
self.dup.update(hash)
|
96
|
-
end
|
97
|
-
|
98
|
-
# Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second.
|
99
|
-
# This overloaded definition prevents returning a regular hash, if reverse_merge is called on a HashWithDifferentAccess.
|
100
|
-
def reverse_merge(other_hash)
|
101
|
-
super other_hash.with_indifferent_access
|
102
|
-
end
|
103
|
-
|
104
|
-
# Removes a specified key from the hash.
|
105
|
-
def delete(key)
|
106
|
-
super(convert_key(key))
|
107
|
-
end
|
108
|
-
|
109
|
-
def stringify_keys!; self end
|
110
|
-
def symbolize_keys!; self end
|
111
|
-
def to_options!; self end
|
112
|
-
|
113
|
-
# Convert to a Hash with String keys.
|
114
|
-
def to_hash
|
115
|
-
Hash.new(default).merge(self)
|
116
|
-
end
|
117
|
-
|
118
|
-
protected
|
119
|
-
def convert_key(key)
|
120
|
-
key.kind_of?(Symbol) ? key.to_s : key
|
121
|
-
end
|
122
|
-
|
123
|
-
def convert_value(value)
|
124
|
-
case value
|
125
|
-
when Hash
|
126
|
-
value.with_indifferent_access
|
127
|
-
when Array
|
128
|
-
value.collect { |e| e.is_a?(Hash) ? e.with_indifferent_access : e }
|
129
|
-
else
|
130
|
-
value
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
end
|
data/lib/roart/core/string.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
unless defined?(ActiveSupport)
|
2
|
-
# used from ActiveSupport
|
3
|
-
# Copyright (c) 2005-2009 David Heinemeier Hansson
|
4
|
-
|
5
|
-
class String
|
6
|
-
|
7
|
-
def underscore
|
8
|
-
self.gsub(/::/, '/').
|
9
|
-
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
10
|
-
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
11
|
-
tr("-", "_").
|
12
|
-
downcase
|
13
|
-
end
|
14
|
-
|
15
|
-
def camelize
|
16
|
-
self.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
17
|
-
end
|
18
|
-
|
19
|
-
def humanize
|
20
|
-
self.gsub(/_id$/, "").gsub(/_/, " ").capitalize
|
21
|
-
end
|
22
|
-
|
23
|
-
def blank?
|
24
|
-
self == ""
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), %w[ .. .. spec_helper])
|
2
|
-
|
3
|
-
describe 'array extentions' do
|
4
|
-
|
5
|
-
it 'should turn an array to a nil valued hash' do
|
6
|
-
array = %w[key1 key2]
|
7
|
-
hash = array.to_hash
|
8
|
-
hash.has_key?(:key1).should be_true
|
9
|
-
hash.has_key?(:key2).should be_true
|
10
|
-
hash[:key1].should be_nil
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), %w[ .. .. spec_helper])
|
2
|
-
|
3
|
-
describe 'string extentions' do
|
4
|
-
|
5
|
-
it 'should underscore a word' do
|
6
|
-
'SomeGuy'.underscore.should == 'some_guy'
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should camelcase a word' do
|
10
|
-
'some_guy'.camelize.should == 'SomeGuy'
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|