sdl-ng 0.0.6 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d1ec08b2a5a2c3e43249e9b10d3de36c4c3a98b
4
- data.tar.gz: 1c0a4526564013c5a575a0067d0928222398d466
3
+ metadata.gz: 447f6a7793ea9f99d160325a4a71ee54ff54d878
4
+ data.tar.gz: a1482bec25b04b717351878c63898db60f1efafb
5
5
  SHA512:
6
- metadata.gz: 4a7d602e5a4aea0d43a67ea9ccf6af365d71f81e18b89425787be450bbc84b0260e708f375c2c0443d537b2403fe068dc8e4aedcc2f0df2e9248dc3883eda962
7
- data.tar.gz: 43a04fd9d23ddd0e0a8ef6bb9de7091f5d681cfef670bec02ea802512863706ffff9ffae953f2048a215cc8def1652e787ddc64df7b19bfc27ad98cee66539a6
6
+ metadata.gz: e4b903194f29bccd32b6c9dd32f44ae663d2c47c8f98793f284bfe609e3cdf3fb5366df412e20039509a1cb709b8c1d2924d39fc4e35c33ac7d0ca9c2cc90e70
7
+ data.tar.gz: 9b95ecff93b9ce9829fdd6d9b57bb13d23e9dba3d0d0ae994c91f1fa9426264c923bc0365bb50b9ae78fdc6f59f73ec4317a9a966a26e91a7a1350f340b1d4d5
@@ -40,11 +40,14 @@ end
40
40
  "For drawings" => [:png, :jpeg, :svg, :pdf]
41
41
  }.each do |annotation, formats_list|
42
42
  formats_list.each do |f|
43
- has_data_capability export, f, annotation: annotation
43
+ has_export_capability f, annotation: annotation
44
44
  end
45
45
  end
46
46
 
47
- headers = fetch_from_url 'http://www.google.com/enterprise/apps/business/products.html', 'div.apps-content-set:nth-child(3) div.maia-col-4 h3'
48
- headers.each do |header|
47
+ # Fetch a list of features from the Google Apps page
48
+ fetch_from_url('http://www.google.com/enterprise/apps/business/products.html', 'div.apps-content-set:nth-child(3) div.product-section-features h3').each do |header|
49
+ # Skip empty features (e.g. "more information...")
50
+ next if header.search('~p')[0].blank?
51
+
49
52
  has_feature header.content.strip, header.search('~p')[0]
50
53
  end
@@ -1,14 +1,14 @@
1
1
  name "Salesforce Sales Cloud"
2
2
 
3
- has_documentation url: 'http://www.salesforce.com/sales-cloud/overview/'
3
+ has_documentation url: 'http://www.salesforce.com/sales-cloud/overview'
4
4
 
5
- has_add_on_repository 'https://appexchange.salesforce.com/' do
5
+ has_add_on_repository 'https://appexchange.salesforce.com' do
6
6
  number_of_add_ons 2000
7
7
  end
8
8
 
9
9
  has_communication_protection https
10
10
 
11
- has_status_page 'http://trust.salesforce.com/trust/status/'
11
+ has_status_page 'http://trust.salesforce.com/trust/status'
12
12
 
13
13
  has_public_service_level_agreement 'http://www.salesforce.com/assets/pdf/misc/salesforce_MSA.pdf'
14
14
 
@@ -19,7 +19,7 @@ has_offline_capability annotation: 'http://help.salesforce.com/apex/HTViewHelpDo
19
19
  maintenance_free
20
20
 
21
21
  has_future_roadmap 'http://www.sfdcstatic.com/assets/pdf/misc/summer13_ReleasePreview.pdf'
22
- has_past_release_notes 'http://www.salesforce.com/newfeatures/'
22
+ has_past_release_notes 'http://www.salesforce.com/newfeatures'
23
23
 
24
24
  has_cloud_service_model saas
25
25
 
@@ -34,7 +34,7 @@ has_browser_interface do
34
34
  compatible_browser safari, '5', annotation: 'on Mac'
35
35
  end
36
36
 
37
- has_data_capability export, csv
37
+ has_export_capability csv
38
38
 
39
39
  is_billed annually, in_advance
40
40
 
@@ -42,7 +42,7 @@ has_payment_option credit_card
42
42
  has_payment_option cheque
43
43
  has_payment_option invoice
44
44
 
45
- features = fetch_from_url 'http://www.salesforce.com/sales-cloud/overview/', '.slide h3 + *'
45
+ features = fetch_from_url 'http://www.salesforce.com/sales-cloud/overview', '.slide h3 + *'
46
46
 
47
47
  has_feature 'Mobile', features[0]
48
48
  has_feature 'Contact Management', features[1]
@@ -4,13 +4,13 @@ en:
4
4
  fact:
5
5
  add_on_repository: Service add-on repo
6
6
  audit_option: Audit option
7
- bill: Billing terms
7
+ bill: Billing & Payment
8
8
  charge_unit: Charge unit
9
9
  cloud_service_model: Cloud service model
10
10
  communication_protection: The communication with the service is protected
11
11
  continuous_service_improvement: The service has continuous service improvement
12
12
  means
13
- data_capability: The service can carry out operations on a specific data format
13
+ data_capability: Supports operation
14
14
  data_deletion_policy: The service allows for complete deletion of user data
15
15
  after termination of contract
16
16
  data_encryption: The service applies encrpytion on user data
@@ -24,7 +24,7 @@ en:
24
24
  establishing_year: The establishing year of the service is known
25
25
  feature: A service feature
26
26
  interface: An interface to service functionality
27
- interface_browser_interface: A regular browser-based interface
27
+ interface_browser_interface: Browser interface
28
28
  interface_rest_interface: The service has a RESTful interface
29
29
  interface_soap_interface: The service has a SOAP interface
30
30
  interface_xmlrpc_interface: The service has an XMLRPC interface
@@ -102,14 +102,14 @@ en:
102
102
  audit_option:
103
103
  audit_option: Audit option
104
104
  bill:
105
- billing_term: Billing terms
106
- payment_term: Payment terms
105
+ billing_term: Billing
106
+ payment_term: Payment
107
107
  charge_unit:
108
108
  charge_unit: Charge unit
109
109
  cloud_service_model:
110
110
  cloud_service_model: Cloud service model
111
111
  communication_protection:
112
- communication_protection: Protection means
112
+ communication_protection: Protected by
113
113
  continuous_service_improvement:
114
114
  url: Link
115
115
  continuous_service_improvement_feedback_page:
@@ -118,9 +118,10 @@ en:
118
118
  url: Future roadmap
119
119
  continuous_service_improvement_past_release_notes:
120
120
  url: Past release notes
121
- data_capability:
122
- format: Format
123
- operation: Operation
121
+ data_capability_export_capability:
122
+ format: Can export
123
+ data_capability_export_capability:
124
+ format: Can import
124
125
  data_encryption:
125
126
  key_control: Controlling party
126
127
  data_location:
@@ -154,13 +155,13 @@ en:
154
155
  type:
155
156
  browser:
156
157
  browser_name: The name of the browser
157
- url: The browser homepage URL
158
+ url: Homepage
158
159
  browser_plugin:
159
160
  plugin_name: The name of the browser plugin
160
161
  url: The browser plugin URL
161
162
  compatible_browser:
162
- compatible_browser: The compatible browser
163
- min_version: The minimum version of the browser
163
+ compatible_browser: Browser
164
+ min_version: Min version
164
165
  data_format:
165
166
  mime_type: The mime type of the data format
166
167
  required_plugin:
@@ -177,7 +178,6 @@ en:
177
178
  charge_unit: The charge unit
178
179
  cloud_service_model: A cloud service model
179
180
  communication_protection: A communication protection means
180
- compatible_browser: A compatible browser
181
181
  data_capability_operation: The data capability operation
182
182
  data_format: The data format
183
183
  key_control: One possibility of key control
@@ -3,8 +3,10 @@ type :data_capability_operation
3
3
  type :data_format
4
4
 
5
5
  fact :data_capability do
6
- data_capability_operation :operation
7
6
  data_format :format
7
+
8
+ subfact :export_capability
9
+ subfact :import_capability
8
10
  end
9
11
 
10
12
  data_format :csv
@@ -19,7 +21,4 @@ data_format :odf
19
21
  data_format :pptx
20
22
  data_format :png
21
23
  data_format :jpeg
22
- data_format :svg
23
-
24
- data_capability_operation :export
25
- data_capability_operation :import
24
+ data_format :svg
data/lib/sdl.rb CHANGED
@@ -18,7 +18,7 @@ module SDL
18
18
  autoload :Exporters
19
19
  autoload :Receivers
20
20
  autoload :Types
21
+ autoload :NG, File.join(__dir__, 'sdl', 'ng', 'version.rb')
21
22
 
22
23
  ActiveSupport::Dependencies::Loadable.require_dependency File.join(__dir__, 'sdl', 'util.rb')
23
- ActiveSupport::Dependencies::Loadable.require_dependency File.join(__dir__, 'sdl', 'ng', 'version.rb')
24
24
  end
@@ -1,5 +1,5 @@
1
1
  class SDL::Base::Service
2
- attr_accessor :facts, :symbolic_name
2
+ attr_accessor :facts, :symbolic_name, :compendium
3
3
 
4
4
  def initialize(symbolic_name)
5
5
  @symbolic_name = symbolic_name
@@ -65,6 +65,7 @@ class SDL::Base::ServiceCompendium
65
65
  receiver.instance_eval &service_definition if block_given?
66
66
  @services[sym] = receiver.service
67
67
  receiver.service.symbolic_name = sym.to_s
68
+ receiver.service.compendium = self
68
69
  receiver.service.extend ServiceMethods
69
70
  receiver.service
70
71
  end
data/lib/sdl/base/type.rb CHANGED
@@ -1,8 +1,11 @@
1
1
  class SDL::Base::Type
2
2
  class << self
3
- ## The namespace URL of this Fact class
3
+ # The namespace URL of this Type class
4
4
  attr_accessor :namespace
5
5
 
6
+ # If the Type is a list item type
7
+ attr_accessor :list_item
8
+
6
9
  ##
7
10
  # The local name of the type, e.g. "Name" or "ServiceInterface". Defaults to the name of the class.
8
11
  #
@@ -33,18 +36,26 @@ class SDL::Base::Type
33
36
  end
34
37
  end
35
38
 
36
- def propertyless?(including_super = false)
39
+ def propertyless?(including_super = true)
37
40
  properties(including_super).count == 0
38
41
  end
39
42
 
40
- def single_property?(including_super = false)
43
+ def single_property?(including_super = true)
41
44
  properties(including_super).count == 1
42
45
  end
43
46
 
47
+ def single_property(including_super = true)
48
+ properties(including_super).first
49
+ end
50
+
44
51
  def multi_property?(including_super = true)
45
52
  properties(including_super).count > 1
46
53
  end
47
54
 
55
+ def list_item?
56
+ @list_item == true
57
+ end
58
+
48
59
  def is_sub?
49
60
  not [SDL::Base::Type, SDL::Base::Fact].include? superclass
50
61
  end
@@ -52,8 +63,14 @@ class SDL::Base::Type
52
63
 
53
64
  ##
54
65
  # Gets the values of all properties
55
- def property_values
56
- Hash[self.class.properties(true).map{|p| [p, send(p.name)]}]
66
+ def property_values(include_empty = true)
67
+ pv = Hash[self.class.properties(true).map{|p| [p, send(p.name)]}]
68
+
69
+ unless include_empty
70
+ pv.reject! {|p, v| v.blank? }
71
+ end
72
+
73
+ pv
57
74
  end
58
75
 
59
76
  def to_s
data/lib/sdl/exporters.rb CHANGED
@@ -5,9 +5,10 @@ module SDL::Exporters
5
5
  autoload :SchemaExporter
6
6
  autoload :ServiceExporter
7
7
  autoload :RDFExporter
8
- autoload :RDFMapping
9
8
  autoload :MarkdownServiceExporter
10
- autoload :XMLMapping
11
9
  autoload :XMLServiceExporter
12
10
  autoload :XSDSchemaExporter
11
+
12
+ ActiveSupport::Dependencies::Loadable.require_dependency File.join(__dir__, 'exporters', 'xml_mapping.rb')
13
+ ActiveSupport::Dependencies::Loadable.require_dependency File.join(__dir__, 'exporters', 'rdf_mapping.rb')
13
14
  end
@@ -1,7 +1,7 @@
1
1
  require 'rdf'
2
2
  require 'rdf/rdfxml'
3
3
 
4
- class SDL::Exporters::RDFExporter < ServiceExporter
4
+ class SDL::Exporters::RDFExporter < SDL::Exporters::ServiceExporter
5
5
  @@s = RDF::Vocabulary.new('http://www.open-service-compendium.org/')
6
6
 
7
7
  def export_service(service)
@@ -27,4 +27,10 @@ class SDL::Exporters::RDFExporter < ServiceExporter
27
27
  end
28
28
  end
29
29
  end
30
+ end
31
+
32
+ class SDL::Base::Service
33
+ def to_rdf
34
+ SDL::Exporters::RDFExporter.new(@compendium).export_service(self)
35
+ end
30
36
  end
@@ -1,10 +1,8 @@
1
1
  require 'rdf'
2
2
 
3
- [String, Fixnum, Nokogiri::XML::Element].each do |klass|
4
- klass.class_eval do
5
- def rdf_object
6
- RDF::Literal.new(self)
7
- end
3
+ SDL::Types::SDLSimpleType.class_eval do
4
+ def rdf_object
5
+ RDF::Literal.new(self)
8
6
  end
9
7
  end
10
8
 
@@ -1,4 +1,4 @@
1
- class SDL::Exporters::SchemaExporter < Exporter
1
+ class SDL::Exporters::SchemaExporter < SDL::Exporters::Exporter
2
2
  def export_schema_to_file(path)
3
3
  export_to_file path, export_schema
4
4
  end
@@ -1,4 +1,4 @@
1
- class SDL::Exporters::ServiceExporter < Exporter
1
+ class SDL::Exporters::ServiceExporter < SDL::Exporters::Exporter
2
2
  def export_service_to_file(service, path)
3
3
  export_to_file path, export_service(service)
4
4
  end
@@ -1,18 +1,22 @@
1
- class SDL::Exporters::XMLServiceExporter < ServiceExporter
1
+ class SDL::Exporters::XMLServiceExporter < SDL::Exporters::ServiceExporter
2
2
  def export_service(service)
3
3
  builder = Nokogiri::XML::Builder.new do |xml|
4
- xml.service('xmlns' => 'http://www.open-service-compendium.org') do
5
- service.facts.each do |fact|
6
- xml.send(fact.class.xsd_element_name + '_') do
7
- serialize_type_instance fact, xml
8
- end
9
- end
10
- end
4
+ build_service(service, xml)
11
5
  end
12
6
 
13
7
  builder.to_xml
14
8
  end
15
9
 
10
+ def build_service(service, xml)
11
+ xml.service('xmlns' => 'http://www.open-service-compendium.org') do
12
+ service.facts.each do |fact|
13
+ xml.send(fact.class.xsd_element_name + '_') do
14
+ serialize_type_instance fact, xml
15
+ end
16
+ end
17
+ end
18
+ end
19
+
16
20
  def serialize_type_instance(type_instance, xml)
17
21
  type_instance.property_values.each do |property, value|
18
22
  [value].flatten.each do |v|
@@ -30,4 +34,10 @@ class SDL::Exporters::XMLServiceExporter < ServiceExporter
30
34
  end
31
35
  end
32
36
  end
37
+ end
38
+
39
+ class SDL::Base::Service
40
+ def to_xml
41
+ SDL::Exporters::XMLServiceExporter.new(@compendium).export_service(self)
42
+ end
33
43
  end
@@ -9,7 +9,7 @@ require 'nokogiri'
9
9
  # service fact types.
10
10
  # - The definition of service fact classes and SDL types
11
11
  # - The definition of a type base, containing annotations and documentation
12
- class SDL::Exporters::XSDSchemaExporter < SchemaExporter
12
+ class SDL::Exporters::XSDSchemaExporter < SDL::Exporters::SchemaExporter
13
13
  def export_schema
14
14
  export_schema_xml.to_xml
15
15
  end
@@ -1,5 +1,5 @@
1
1
  module SDL
2
2
  module NG
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -0,0 +1,21 @@
1
+ module SDL::Receivers
2
+ class Receiver
3
+ attr :compendium
4
+
5
+ def initialize(compendium)
6
+ @compendium = compendium
7
+ end
8
+
9
+ def set_value(type_class, type_instance, *property_values)
10
+ property_values.zip(type_class.properties(true)).each do |value, property|
11
+ if(value.is_a?(Hash))
12
+ TypeInstanceReceiver.new(type_instance, @compendium).send(value.keys.first.to_s, value.values.first)
13
+ else
14
+ raise "Specified value '#{value}' for non-existing property." unless property
15
+
16
+ TypeInstanceReceiver.new(type_instance, @compendium).send(property.name, value)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -40,6 +40,9 @@ class SDL::Receivers::TypeReceiver < SDL::Receivers::Receiver
40
40
  def list(name, &block)
41
41
  list_type = @compendium.type name.to_s.singularize.to_sym, &block
42
42
 
43
+ # Designate as list type
44
+ list_type.list_item = true
45
+
43
46
  add_property name.to_sym, list_type, true
44
47
  end
45
48
 
@@ -7,7 +7,7 @@ class SDL::Types::SDLDescription < SDL::Types::SDLSimpleType
7
7
  codes :description
8
8
 
9
9
  def from_nil_class(nilvalue)
10
- @value = ""
10
+ @value = ''
11
11
  end
12
12
 
13
13
  def from_nokogiri_xml_element(element)
@@ -15,9 +15,13 @@ class SDL::Types::SDLDescription < SDL::Types::SDLSimpleType
15
15
  end
16
16
 
17
17
  def to_html
18
- case @raw_value.class
18
+ case @raw_value
19
19
  when Nokogiri::XML::Element
20
20
  @raw_value.to_s
21
+ when NilClass
22
+ ''
23
+ else
24
+ "Cannot convert #{@raw_value.class} to HTML. Please extend SDLDescription#to_html"
21
25
  end
22
26
  end
23
27
  end
@@ -4,11 +4,30 @@ require 'open-uri'
4
4
  module SDL
5
5
  module Util
6
6
  module NokogiriUtils
7
+ ##
8
+ # Fetches an Nokogiri::XML::NodeSet from the webpage at url by performing *search
9
+ #
10
+ # Additionally it converts all relative href URLs to absolute URLs and adds a 'target' attribute to all
11
+ # links, so that they open in a new browser window and not the current broker.
7
12
  def fetch_from_url(url, *search)
8
13
  begin
9
14
  doc = Nokogiri::HTML(open(url))
10
15
 
11
- doc.search(*search)
16
+ result = doc.search(*search)
17
+
18
+ result.search('//body//@href').each do |attribute|
19
+ begin
20
+ attribute.content = URI.join(url, attribute.value.gsub(/\s/, '')).to_s
21
+ rescue URI::InvalidURIError
22
+ next
23
+ end
24
+
25
+ if attribute.parent.name.eql? 'a'
26
+ attribute.parent['target'] = '_new'
27
+ end
28
+ end
29
+
30
+ result
12
31
  rescue SocketError => e
13
32
  []
14
33
  end
data/sdl-ng.gemspec CHANGED
@@ -1,13 +1,14 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('lib', __dir__)
3
3
  $:.unshift(lib) unless $:.include?(lib)
4
- require 'sdl/ng/version'
4
+
5
+ require 'sdl'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "sdl-ng"
8
+ spec.name = 'sdl-ng'
8
9
  spec.version = SDL::NG::VERSION
9
- spec.authors = ["Mathias Slawik"]
10
- spec.email = ["mathias.slawik@tu-berlin.de"]
10
+ spec.authors = ['Mathias Slawik']
11
+ spec.email = ['mathias.slawik@tu-berlin.de']
11
12
  spec.description = %q{Next Generation Service Description Language}
12
13
  spec.summary = %q{Framework for building descriptions of business services.}
13
14
  spec.homepage = 'https://github.com/TU-Berlin-SNET/sdl-ng'
@@ -16,7 +17,7 @@ Gem::Specification.new do |spec|
16
17
  spec.files = `git ls-files`.split($/)
17
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
+ spec.require_paths = ['lib']
20
21
 
21
22
  spec.add_runtime_dependency 'activesupport', '>=4.0.0'
22
23
  spec.add_runtime_dependency 'nokogiri', '1.6.0'
data/spec/bin_spec.rb ADDED
@@ -0,0 +1,14 @@
1
+ require_relative '../lib/sdl'
2
+ require_relative 'spec_helper'
3
+
4
+ require 'rspec'
5
+
6
+ describe 'The process_service_descriptions binary script' do
7
+ it 'can be executed' do
8
+ Dir.chdir(File.join(__dir__, '..', 'examples')) do
9
+ `ruby #{File.join(__dir__, '..', 'bin', 'process_service_descriptions')}`
10
+
11
+ expect($?.exitstatus).to eq(0)
12
+ end
13
+ end
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdl-ng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Slawik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-08 00:00:00.000000000 Z
11
+ date: 2014-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -231,6 +231,7 @@ files:
231
231
  - lib/sdl/ng/version.rb
232
232
  - lib/sdl/receivers.rb
233
233
  - lib/sdl/receivers/fact_receiver.rb
234
+ - lib/sdl/receivers/receiver.rb
234
235
  - lib/sdl/receivers/service_receiver.rb
235
236
  - lib/sdl/receivers/type_instance_receiver.rb
236
237
  - lib/sdl/receivers/type_receiver.rb
@@ -249,6 +250,7 @@ files:
249
250
  - lib/sdl/util/nokogiri.rb
250
251
  - lib/sdl/util/verbs.rb
251
252
  - sdl-ng.gemspec
253
+ - spec/bin_spec.rb
252
254
  - spec/documentation_spec.rb
253
255
  - spec/fact_type_instance_definition_spec.rb
254
256
  - spec/property_definitions_spec.rb
@@ -281,6 +283,7 @@ signing_key:
281
283
  specification_version: 4
282
284
  summary: Framework for building descriptions of business services.
283
285
  test_files:
286
+ - spec/bin_spec.rb
284
287
  - spec/documentation_spec.rb
285
288
  - spec/fact_type_instance_definition_spec.rb
286
289
  - spec/property_definitions_spec.rb