kamel 0.1.2 → 0.2.0

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/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -1,11 +1,11 @@
1
1
  h1. Kamel
2
2
 
3
- <pre><code>gem install schleyfox-ruby_kml --source http://gems.github.com
4
- gem install kamel --source http://gemcutter.org/</code></pre>
3
+ <pre><code>gem install kamel</code></pre>
5
4
 
6
- Create KML files for tasty overlays on google earth and google maps. Provides a cleaner interface than ruby_kml (which it uses internally).
5
+ Create KML files for tasty overlays on google earth and google maps. Provides a
6
+ cleaner interface than ruby_kml (which it uses internally).
7
7
 
8
- Tested on ruby 1.8.6-339, 1.8.7-160 and 1.9.1-rc2
8
+ Tested on ruby 1.8.7 and 1.9.3.
9
9
 
10
10
  h2. Usage
11
11
 
@@ -26,7 +26,3 @@ overlay.name = 'Melbourne Train Stations'
26
26
  )
27
27
  end
28
28
  puts overlay.to_kml</code></pre>
29
-
30
- h2. Maturity
31
-
32
- As far as I know this code is not being used in production, certainly not by me. It depends on a fork of kmlr which is no longer maintained and is not even published to rubygems. So, use at your own risk.
data/Rakefile CHANGED
@@ -1,27 +1,6 @@
1
- begin
2
- require 'jeweler'
3
- Jeweler::Tasks.new do |gemspec|
4
- gemspec.name = "kamel"
5
- gemspec.summary = "Create KML files for tasty overlays on google earth and google maps"
6
- gemspec.description = "Create KML files for tasty overlays on google earth and google maps"
7
- gemspec.email = "contact@rhnh.net"
8
- gemspec.homepage = "http://github.com/xaviershay/kamel"
9
- gemspec.authors = ["Xavier Shay"]
10
- gemspec.test_files = Dir["spec/**/*_spec.rb"]
11
- gemspec.add_dependency("schleyfox-ruby_kml", [">= 0.1.4"])
12
- gemspec.add_development_dependency("rspec", ["~> 1.3.0"])
13
- end
14
- rescue LoadError
15
- puts "Jeweler not available. Install it with: sudo gem install jeweler"
16
- end
1
+ #!/usr/bin/env rake
2
+ require 'rspec/core/rake_task'
17
3
 
18
- require 'spec/rake/spectask'
4
+ RSpec::Core::RakeTask.new(:spec)
19
5
 
20
- Spec::Rake::SpecTask.new do |t|
21
- t.warning = false
22
- t.rcov = false
23
- t.spec_files = FileList['spec/**/*_spec.rb']
24
- end
25
-
26
- task :test => :spec
27
6
  task :default => :spec
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/kamel/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Xavier Shay"]
6
+ gem.email = ["contact@rhnh.net"]
7
+ gem.description = %q{Create KML files for tasty overlays on google earth and google maps}
8
+ gem.summary = %q{Create KML files for tasty overlays on google earth and google maps}
9
+ gem.homepage = "https://github.com/xaviershay/kamel"
10
+
11
+ gem.required_ruby_version = ">= 1.8.7"
12
+ gem.rubyforge_project = "kamel"
13
+
14
+ gem.add_development_dependency "rspec", "~> 2.9"
15
+ gem.add_development_dependency 'rake', '~> 0.9'
16
+
17
+ gem.add_runtime_dependency 'ruby_kml', '~> 0.1.4'
18
+ gem.add_runtime_dependency 'builder', '~> 3.0.0' #ruby_kml depends on builder but does not declare it's dependencies correctly
19
+
20
+ gem.files = Dir.glob("{spec,lib}/**/*.rb") + %w(
21
+ Gemfile
22
+ README.textile
23
+ LICENSE
24
+ Rakefile
25
+ kamel.gemspec
26
+ )
27
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
28
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
29
+ gem.name = "kamel"
30
+ gem.require_paths = ["lib"]
31
+ gem.version = Kamel::VERSION
32
+ end
@@ -1,12 +1,6 @@
1
- begin
2
- require 'kml'
3
- rescue LoadError
4
- puts "You must have ruby_kml either installed to use Kamel - either as a gem or available in your path"
5
- puts "gem install schleyfox-ruby_kml --source http://gems.github.com"
6
- exit
7
- end
1
+ require 'kml'
8
2
 
9
- module Kamel
3
+ module Kamel
10
4
  class Overlay
11
5
  attr_accessor :prefix
12
6
  attr_accessor :name
@@ -30,7 +24,7 @@ module Kamel
30
24
  :icon_style => KML::IconStyle.new(
31
25
  :icon => KML::Icon.new(:href => icon)
32
26
  )
33
- )
27
+ )
34
28
  }
35
29
  self.placemarks.each do |placemark|
36
30
  attrs = {}
@@ -40,7 +34,7 @@ module Kamel
40
34
  attrs[:style_url] = '#' + [prefix, 'style', self.icons.index(placemark[:icon])].join('-') unless placemark[:icon].nil?
41
35
  doc.features << KML::Placemark.new(attrs)
42
36
  end
43
-
37
+
44
38
  kml = KMLFile.new
45
39
  kml.objects << doc
46
40
  kml.render
@@ -49,7 +43,7 @@ module Kamel
49
43
  protected
50
44
 
51
45
  def icons
52
- self.placemarks.collect {|x| x[:icon]}.compact.uniq.sort
46
+ self.placemarks.collect {|x| x[:icon]}.compact.uniq.sort
53
47
  end
54
48
  end
55
49
  end
@@ -0,0 +1,3 @@
1
+ module Kamel
2
+ VERSION = "0.2.0"
3
+ end
@@ -1,12 +1,5 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
- require 'rubygems'
3
- require 'spec'
4
- require 'kamel'
5
- require File.expand_path(File.dirname(__FILE__) + '/../xpath_matchers')
6
-
7
-
8
- require 'rexml/document'
9
- require 'rexml/element'
1
+ # encoding: utf-8
2
+ require 'spec_helper'
10
3
 
11
4
  describe Kamel::Overlay, '#to_kml' do
12
5
  before(:each) do
@@ -30,7 +23,7 @@ describe Kamel::Overlay, '#to_kml' do
30
23
  @doc.should match_xpath("/kml/Document/Placemark[2]/name", "placemark-2")
31
24
  @doc.should match_xpath("/kml/Document/Placemark[3]/name", "placemark-3")
32
25
  end
33
-
26
+
34
27
  it 'records the description of each placemark if it is provided' do
35
28
  #TODO Figure out how to check for CDATA
36
29
  @doc.should have_xpath("/kml/Document/Placemark[1]/description")
@@ -0,0 +1,8 @@
1
+ require 'kamel'
2
+ require 'xpath_matchers'
3
+ require 'rexml/document'
4
+ require 'rexml/element'
5
+
6
+ RSpec.configure do |config|
7
+ config.include(XpathMatchers)
8
+ end
@@ -1,105 +1,101 @@
1
1
  # http://blog.wolfman.com/articles/2008/01/02/xpath-matchers-for-rspec
2
2
 
3
- module Spec
4
- module Matchers
5
-
6
- # check if the xpath exists one or more times
7
- class HaveXpath
8
- def initialize(xpath)
9
- @xpath = xpath
10
- end
11
-
12
- def matches?(response)
13
- @response = response
14
- doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
15
- match = REXML::XPath.match(doc, @xpath)
16
- not match.empty?
17
- end
3
+ module XpathMatchers
4
+ # check if the xpath exists one or more times
5
+ class HaveXpath
6
+ def initialize(xpath)
7
+ @xpath = xpath
8
+ end
18
9
 
19
- def failure_message
20
- "Did not find expected xpath #{@xpath}"
21
- end
10
+ def matches?(response)
11
+ @response = response
12
+ doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
13
+ match = REXML::XPath.match(doc, @xpath)
14
+ not match.empty?
15
+ end
22
16
 
23
- def negative_failure_message
24
- "Did find unexpected xpath #{@xpath}"
25
- end
17
+ def failure_message
18
+ "Did not find expected xpath #{@xpath}"
19
+ end
26
20
 
27
- def description
28
- "match the xpath expression #{@xpath}"
29
- end
21
+ def negative_failure_message
22
+ "Did find unexpected xpath #{@xpath}"
30
23
  end
31
24
 
32
- def have_xpath(xpath)
33
- HaveXpath.new(xpath)
25
+ def description
26
+ "match the xpath expression #{@xpath}"
34
27
  end
28
+ end
35
29
 
36
- # check if the xpath has the specified value
37
- # value is a string and there must be a single result to match its
38
- # equality against
39
- class MatchXpath
40
- def initialize(xpath, val)
41
- @xpath = xpath
42
- @val= val
43
- end
30
+ def have_xpath(xpath)
31
+ HaveXpath.new(xpath)
32
+ end
44
33
 
45
- def matches?(response)
46
- @response = response
47
- doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
48
- ok= true
49
- REXML::XPath.each(doc, @xpath) do |e|
50
- @actual_val= case e
51
- when REXML::Attribute
52
- e.to_s
53
- when REXML::Element
54
- e.text
55
- else
56
- e.to_s
57
- end
58
- return false unless @val == @actual_val
59
- end
60
- return ok
61
- end
34
+ # check if the xpath has the specified value
35
+ # value is a string and there must be a single result to match its
36
+ # equality against
37
+ class MatchXpath
38
+ def initialize(xpath, val)
39
+ @xpath = xpath
40
+ @val= val
41
+ end
62
42
 
63
- def failure_message
64
- "The xpath #{@xpath} did not have the value '#{@val}'\nIt was '#{@actual_val}'"
43
+ def matches?(response)
44
+ @response = response
45
+ doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
46
+ ok= true
47
+ REXML::XPath.each(doc, @xpath) do |e|
48
+ @actual_val= case e
49
+ when REXML::Attribute
50
+ e.to_s
51
+ when REXML::Element
52
+ e.text
53
+ else
54
+ e.to_s
55
+ end
56
+ return false unless @val == @actual_val
65
57
  end
58
+ return ok
59
+ end
66
60
 
67
- def description
68
- "match the xpath expression #{@xpath} with #{@val}"
69
- end
61
+ def failure_message
62
+ "The xpath #{@xpath} did not have the value '#{@val}'\nIt was '#{@actual_val}'"
70
63
  end
71
64
 
72
- def match_xpath(xpath, val)
73
- MatchXpath.new(xpath, val)
65
+ def description
66
+ "match the xpath expression #{@xpath} with #{@val}"
74
67
  end
68
+ end
75
69
 
76
- # checks if the given xpath occurs num times
77
- class HaveNodes #:nodoc:
78
- def initialize(xpath, num)
79
- @xpath= xpath
80
- @num = num
81
- end
70
+ def match_xpath(xpath, val)
71
+ MatchXpath.new(xpath, val)
72
+ end
82
73
 
83
- def matches?(response)
84
- @response = response
85
- doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
86
- match = REXML::XPath.match(doc, @xpath)
87
- @num_found= match.size
88
- @num_found == @num
89
- end
74
+ # checks if the given xpath occurs num times
75
+ class HaveNodes #:nodoc:
76
+ def initialize(xpath, num)
77
+ @xpath= xpath
78
+ @num = num
79
+ end
90
80
 
91
- def failure_message
92
- "Did not find expected number of nodes #{@num} in xpath #{@xpath}\nFound #{@num_found}"
93
- end
81
+ def matches?(response)
82
+ @response = response
83
+ doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
84
+ match = REXML::XPath.match(doc, @xpath)
85
+ @num_found= match.size
86
+ @num_found == @num
87
+ end
94
88
 
95
- def description
96
- "match the number of nodes #{@num}"
97
- end
89
+ def failure_message
90
+ "Did not find expected number of nodes #{@num} in xpath #{@xpath}\nFound #{@num_found}"
98
91
  end
99
92
 
100
- def have_nodes(xpath, num)
101
- HaveNodes.new(xpath, num)
93
+ def description
94
+ "match the number of nodes #{@num}"
102
95
  end
96
+ end
103
97
 
98
+ def have_nodes(xpath, num)
99
+ HaveNodes.new(xpath, num)
104
100
  end
105
101
  end
metadata CHANGED
@@ -1,107 +1,123 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: kamel
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Xavier Shay
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-05-01 00:00:00 +10:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: schleyfox-ruby_kml
12
+ date: 2012-06-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.9'
22
+ type: :development
23
23
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 19
30
- segments:
31
- - 0
32
- - 1
33
- - 4
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.9'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '0.9'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '0.9'
46
+ - !ruby/object:Gem::Dependency
47
+ name: ruby_kml
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
34
53
  version: 0.1.4
35
54
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: rspec
39
55
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
41
57
  none: false
42
- requirements:
58
+ requirements:
43
59
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 27
46
- segments:
47
- - 1
48
- - 3
49
- - 0
50
- version: 1.3.0
51
- type: :development
52
- version_requirements: *id002
60
+ - !ruby/object:Gem::Version
61
+ version: 0.1.4
62
+ - !ruby/object:Gem::Dependency
63
+ name: builder
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 3.0.0
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 3.0.0
53
78
  description: Create KML files for tasty overlays on google earth and google maps
54
- email: contact@rhnh.net
79
+ email:
80
+ - contact@rhnh.net
55
81
  executables: []
56
-
57
82
  extensions: []
58
-
59
- extra_rdoc_files:
60
- - LICENSE
83
+ extra_rdoc_files: []
84
+ files:
85
+ - spec/kamel/overlay_spec.rb
86
+ - spec/xpath_matchers.rb
87
+ - spec/spec_helper.rb
88
+ - lib/kamel/version.rb
89
+ - lib/kamel/overlay.rb
90
+ - lib/kamel.rb
91
+ - Gemfile
61
92
  - README.textile
62
- files:
63
- - HISTORY
64
93
  - LICENSE
65
- - README.textile
66
94
  - Rakefile
67
- - VERSION
68
- - lib/kamel.rb
69
- - lib/kamel/overlay.rb
70
- - spec/kamel/overlay_spec.rb
71
- - spec/xpath_matchers.rb
72
- has_rdoc: true
73
- homepage: http://github.com/xaviershay/kamel
95
+ - kamel.gemspec
96
+ homepage: https://github.com/xaviershay/kamel
74
97
  licenses: []
75
-
76
98
  post_install_message:
77
99
  rdoc_options: []
78
-
79
- require_paths:
100
+ require_paths:
80
101
  - lib
81
- required_ruby_version: !ruby/object:Gem::Requirement
102
+ required_ruby_version: !ruby/object:Gem::Requirement
82
103
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
- version: "0"
90
- required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: 1.8.7
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
109
  none: false
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 3
96
- segments:
97
- - 0
98
- version: "0"
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
99
114
  requirements: []
100
-
101
- rubyforge_project:
102
- rubygems_version: 1.3.7
115
+ rubyforge_project: kamel
116
+ rubygems_version: 1.8.23
103
117
  signing_key:
104
118
  specification_version: 3
105
119
  summary: Create KML files for tasty overlays on google earth and google maps
106
- test_files:
120
+ test_files:
107
121
  - spec/kamel/overlay_spec.rb
122
+ - spec/xpath_matchers.rb
123
+ - spec/spec_helper.rb
data/HISTORY DELETED
@@ -1,2 +0,0 @@
1
- 0.1.2 - 1 May 2011
2
- * Fix homepage link
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.2