wsdsl 0.0.2 → 0.0.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/lib/inflection.rb CHANGED
@@ -21,8 +21,15 @@
21
21
 
22
22
  #---
23
23
 
24
+ # Modified for the need of this software package
24
25
 
25
- module Extlib
26
+ module ExtlibCopy
27
+
28
+ # Same as Inflection.classify but without the singularization
29
+ def self.classify(name)
30
+ words = name.to_s.sub(/.*\./, '').split('_')
31
+ words.collect { |word| word.capitalize }.join
32
+ end
26
33
 
27
34
  # = English Nouns Number Inflection.
28
35
  #
@@ -451,29 +458,3 @@ module Extlib
451
458
 
452
459
  end
453
460
  end
454
-
455
- unless "".respond_to?(:singular)
456
- class String
457
- def singular
458
- Extlib::Inflection.singular(self)
459
- end
460
- alias_method(:singularize, :singular)
461
- end
462
- end
463
-
464
- unless "".respond_to?(:plural)
465
- class String
466
- def plural
467
- Extlib::Inflection.plural(self)
468
- end
469
- alias_method(:pluralize, :plural)
470
- end
471
- end
472
-
473
- unless "".respond_to?(:classify)
474
- class String
475
- def classify
476
- Extlib::Inflection.classify(self)
477
- end
478
- end
479
- end
data/lib/wsdsl.rb CHANGED
@@ -1,6 +1,4 @@
1
- unless Object.const_defined?(:Extlib)
2
- require File.expand_path('inflection', File.dirname(__FILE__))
3
- end
1
+ require File.expand_path('inflection', File.dirname(__FILE__))
4
2
  require File.expand_path('params', File.dirname(__FILE__))
5
3
  require File.expand_path('response', File.dirname(__FILE__))
6
4
  require File.expand_path('documentation', File.dirname(__FILE__))
@@ -123,7 +121,7 @@ class WSDSL
123
121
  @doc = WSDSL::Documentation.new
124
122
  @response = WSDSL::Response.new
125
123
  @name = extract_service_root_name(url)
126
- @controller_name = "#{name.classify}Controller"
124
+ @controller_name = "#{ExtlibCopy.classify(name)}Controller"
127
125
  @action = extract_service_action(url)
128
126
  @verb = :get
129
127
  @formats = []
data/spec/wsdsl_spec.rb CHANGED
@@ -38,7 +38,11 @@ describe WSDSL do
38
38
 
39
39
  it "should set the controller accordingly" do
40
40
  @service.controller_name.should_not be_nil
41
- @service.controller_name.should == 'ServiceController'
41
+ @service.controller_name.should == 'ServicesController'
42
+ service = WSDSL.new("preferences.xml")
43
+ service.name.should == 'preferences'
44
+ ExtlibCopy.classify('preferences').should == 'Preferences'
45
+ service.controller_name.should == 'PreferencesController'
42
46
  end
43
47
 
44
48
  it "should set the action accordingly" do
@@ -51,7 +55,7 @@ describe WSDSL do
51
55
  service.should_not be_nil
52
56
  service.http_verb.should == :put
53
57
  service.action.should_not be_nil
54
- service.controller_name.should == 'ServiceController'
58
+ service.controller_name.should == 'ServicesController'
55
59
  service.action.should == 'update'
56
60
  end
57
61
 
data/wsdsl.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wsdsl}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Aimonetti"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt Aimonetti