ropenlayer 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,99 +1,114 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ropenlayer (0.3.1)
5
- json_pure (~> 1.2.3)
4
+ ropenlayer (0.3.3)
5
+ activerecord (~> 3.0.3)
6
+ json_pure (~> 1.5.1)
6
7
  rails (~> 3.0.3)
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
10
11
  specs:
11
12
  abstract (1.0.0)
12
- actionmailer (3.0.3)
13
- actionpack (= 3.0.3)
14
- mail (~> 2.2.9)
15
- actionpack (3.0.3)
16
- activemodel (= 3.0.3)
17
- activesupport (= 3.0.3)
13
+ actionmailer (3.0.7)
14
+ actionpack (= 3.0.7)
15
+ mail (~> 2.2.15)
16
+ actionpack (3.0.7)
17
+ activemodel (= 3.0.7)
18
+ activesupport (= 3.0.7)
18
19
  builder (~> 2.1.2)
19
20
  erubis (~> 2.6.6)
20
- i18n (~> 0.4)
21
+ i18n (~> 0.5.0)
21
22
  rack (~> 1.2.1)
22
- rack-mount (~> 0.6.13)
23
- rack-test (~> 0.5.6)
23
+ rack-mount (~> 0.6.14)
24
+ rack-test (~> 0.5.7)
24
25
  tzinfo (~> 0.3.23)
25
- activemodel (3.0.3)
26
- activesupport (= 3.0.3)
26
+ activemodel (3.0.7)
27
+ activesupport (= 3.0.7)
27
28
  builder (~> 2.1.2)
28
- i18n (~> 0.4)
29
- activerecord (3.0.3)
30
- activemodel (= 3.0.3)
31
- activesupport (= 3.0.3)
29
+ i18n (~> 0.5.0)
30
+ activerecord (3.0.7)
31
+ activemodel (= 3.0.7)
32
+ activesupport (= 3.0.7)
32
33
  arel (~> 2.0.2)
33
34
  tzinfo (~> 0.3.23)
34
- activeresource (3.0.3)
35
- activemodel (= 3.0.3)
36
- activesupport (= 3.0.3)
37
- activesupport (3.0.3)
38
- arel (2.0.6)
35
+ activeresource (3.0.7)
36
+ activemodel (= 3.0.7)
37
+ activesupport (= 3.0.7)
38
+ activesupport (3.0.7)
39
+ arel (2.0.9)
39
40
  builder (2.1.2)
40
- columnize (0.3.1)
41
+ childprocess (0.1.8)
42
+ ffi (~> 1.0.6)
43
+ columnize (0.3.2)
41
44
  diff-lcs (1.1.2)
42
45
  erubis (2.6.6)
43
46
  abstract (>= 1.0.0)
47
+ ffi (1.0.7)
48
+ rake (>= 0.8.7)
44
49
  i18n (0.5.0)
45
- json_pure (1.2.3)
50
+ jasmine (1.0.2.0)
51
+ json_pure (>= 1.4.3)
52
+ rack (>= 1.1)
53
+ rspec (>= 1.3.1)
54
+ selenium-webdriver (>= 0.1.3)
55
+ json_pure (1.5.1)
46
56
  linecache (0.43)
47
- mail (2.2.15)
57
+ mail (2.2.19)
48
58
  activesupport (>= 2.3.6)
49
59
  i18n (>= 0.4.0)
50
60
  mime-types (~> 1.16)
51
61
  treetop (~> 1.4.8)
52
62
  mime-types (1.16)
53
63
  polyglot (0.3.1)
54
- rack (1.2.1)
55
- rack-mount (0.6.13)
64
+ rack (1.2.2)
65
+ rack-mount (0.6.14)
56
66
  rack (>= 1.0.0)
57
67
  rack-test (0.5.7)
58
68
  rack (>= 1.0)
59
- rails (3.0.3)
60
- actionmailer (= 3.0.3)
61
- actionpack (= 3.0.3)
62
- activerecord (= 3.0.3)
63
- activeresource (= 3.0.3)
64
- activesupport (= 3.0.3)
69
+ rails (3.0.7)
70
+ actionmailer (= 3.0.7)
71
+ actionpack (= 3.0.7)
72
+ activerecord (= 3.0.7)
73
+ activeresource (= 3.0.7)
74
+ activesupport (= 3.0.7)
65
75
  bundler (~> 1.0)
66
- railties (= 3.0.3)
67
- railties (3.0.3)
68
- actionpack (= 3.0.3)
69
- activesupport (= 3.0.3)
76
+ railties (= 3.0.7)
77
+ railties (3.0.7)
78
+ actionpack (= 3.0.7)
79
+ activesupport (= 3.0.7)
70
80
  rake (>= 0.8.7)
71
81
  thor (~> 0.14.4)
72
82
  rake (0.8.7)
73
- rspec (2.3.0)
74
- rspec-core (~> 2.3.0)
75
- rspec-expectations (~> 2.3.0)
76
- rspec-mocks (~> 2.3.0)
77
- rspec-core (2.3.1)
78
- rspec-expectations (2.3.0)
83
+ rspec (2.5.0)
84
+ rspec-core (~> 2.5.0)
85
+ rspec-expectations (~> 2.5.0)
86
+ rspec-mocks (~> 2.5.0)
87
+ rspec-core (2.5.2)
88
+ rspec-expectations (2.5.0)
79
89
  diff-lcs (~> 1.1.2)
80
- rspec-mocks (2.3.0)
81
- ruby-debug (0.10.3)
90
+ rspec-mocks (2.5.0)
91
+ ruby-debug (0.10.4)
82
92
  columnize (>= 0.1)
83
- ruby-debug-base (~> 0.10.3.0)
84
- ruby-debug-base (0.10.3)
93
+ ruby-debug-base (~> 0.10.4.0)
94
+ ruby-debug-base (0.10.4)
85
95
  linecache (>= 0.3)
96
+ rubyzip (0.9.4)
97
+ selenium-webdriver (0.2.0)
98
+ childprocess (>= 0.1.7)
99
+ ffi (>= 1.0.7)
100
+ json_pure
101
+ rubyzip
86
102
  thor (0.14.6)
87
103
  treetop (1.4.9)
88
104
  polyglot (>= 0.3.1)
89
- tzinfo (0.3.23)
105
+ tzinfo (0.3.27)
90
106
 
91
107
  PLATFORMS
92
108
  ruby
93
109
 
94
110
  DEPENDENCIES
95
- json_pure (~> 1.2.3)
96
- rails (~> 3.0.3)
111
+ jasmine (~> 1.0.2.0)
97
112
  ropenlayer!
98
- rspec (~> 2.3.0)
113
+ rspec (~> 2.5.0)
99
114
  ruby-debug (~> 0.10.3)
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ === 0.3.3
2
+ * Malformed previous release
3
+
4
+ === 0.3.2
5
+ * Bug fixes
6
+ * FormBuilder map_node_editor wasnt merging options
7
+ * Rename build_map method to build_ropenlayer_map. It can cause conflict when :mapper is an instance of Map class (rails provides then build_map method to contruct belongs_to object)
8
+ * Added option for popup_size
9
+
1
10
  === 0.3.1
2
11
  * Bug fixes
3
12
  * Ropenlayer::JsHelper::Prototype doesnt escape onclick propierties propierly :)
data/Rakefile CHANGED
@@ -23,3 +23,6 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
23
23
  end
24
24
 
25
25
  Bundler::GemHelper.install_tasks
26
+
27
+ require 'jasmine'
28
+ load 'jasmine/tasks/jasmine.rake'
@@ -84,11 +84,11 @@ module Ropenlayer
84
84
  def ropenlayer_map(options = {})
85
85
  container_id = options.delete(:container_id) || "#{ self.class.name.underscore }_ropenlayer_map"
86
86
 
87
- @ropenlayer_map.nil? ? build_map(container_id, options) : @ropenlayer_map
87
+ @ropenlayer_map.nil? ? build_ropenlayer_map(container_id, options) : @ropenlayer_map
88
88
  end
89
89
 
90
90
 
91
- def build_map(container_id, map_config = {})
91
+ def build_ropenlayer_map(container_id, map_config = {})
92
92
  config = self.class.ropenlayer_mapper_config.merge(map_config)
93
93
  config = set_map_localization(config)
94
94
  config = parse_nodes(config)
@@ -8,7 +8,7 @@ module Ropenlayer
8
8
  klass_config = self.object.class.ropenlayer_mapper_config
9
9
  dom_id_map = "ropenlayer_#{ @template.params[:action] }_#{ @template.params[:controller] }"
10
10
 
11
- map = self.object.build_map(dom_id_map, klass_config)
11
+ map = self.object.build_ropenlayer_map(dom_id_map, klass_config)
12
12
 
13
13
  map_div_options.merge!(:id => dom_id_map)
14
14
 
@@ -35,10 +35,11 @@ module Ropenlayer
35
35
  mapper_config = mapper.class.ropenlayer_mapper_config
36
36
  nodeable_config = self.object.class.ropenlayer_node_config
37
37
 
38
+ mapper_config.merge!(options)
38
39
  mapper_config.merge!(:edit_map => true)
39
40
 
40
41
  dom_id_map = "ropenlayer_#{ mapper.class }_#{ @template.params[:action] }_#{ @template.params[:controller] }"
41
- map = mapper.build_map(dom_id_map, mapper_config)
42
+ map = mapper.build_ropenlayer_map(dom_id_map, mapper_config)
42
43
 
43
44
  map_div_options.merge!(:id => dom_id_map)
44
45
 
@@ -2,8 +2,9 @@ module Ropenlayer
2
2
  module Openlayer
3
3
  class Feature
4
4
 
5
- DEFAULT_ICON_SIZE = [ 40, 34 ]
6
- DEFAULT_ICON_URL = "/images/ropenlayer/default_marker.png"
5
+ DEFAULT_ICON_SIZE = [ 40, 34 ]
6
+ DEFAULT_ICON_URL = "/images/ropenlayer/default_marker.png"
7
+ DEFAULT_POPUP_SIZE = [ 600, 400 ]
7
8
 
8
9
  attr_reader :map
9
10
 
@@ -28,6 +29,7 @@ module Ropenlayer
28
29
  @latitude = attributes[:latitude] || raise("No defined latitude for feature #{ attributes.inspect }")
29
30
  @icon_url = attributes[:icon_url]
30
31
  @icon_size = attributes[:icon_size]
32
+ @popup_size = attributes[:popup_size]
31
33
  @color = attributes[:color]
32
34
  @localizations = attributes[:localizations]
33
35
  end
@@ -84,7 +86,7 @@ module Ropenlayer
84
86
  icon_url = (@icon_url and @icon_url.is_a?(String)) ? @icon_url : DEFAULT_ICON_URL
85
87
 
86
88
  size_method = Ropenlayer::Openlayer::Js.new_method("OpenLayers.Size", :args => icon_size).to_s
87
- offset_method = Ropenlayer::Openlayer::Js.new("function(size){ return new OpenLayers.Pixel(-(size.w/2), -(size.h/2)) }").to_s
89
+ offset_method = Ropenlayer::Openlayer::Js.new("function(size){ return new OpenLayers.Pixel(-(size.w/2), -(size.h*2)) }").to_s
88
90
 
89
91
  icon_method = Ropenlayer::Openlayer::Js.new_method("OpenLayers.Icon", :args => [ "'#{ icon_url }'", size_method, 'null', offset_method ]).to_s
90
92
  %( #{ Ropenlayer::Openlayer::Js.new_var("#{ @js_id }Icon", icon_method).to_js } )
@@ -99,11 +101,13 @@ module Ropenlayer
99
101
  end
100
102
 
101
103
  def build_marker_click_function
104
+ popup_size = (@popup_size and @popup_size.is_a?(Array)) ? @popup_size : DEFAULT_POPUP_SIZE
102
105
  function_content = %(
103
106
  if (this.popup == null) {
104
107
  this.popup = this.createPopup(true);
108
+ this.popup.setSize = function(size) { return new OpenLayers.Size(#{ popup_size.join)(',') }); };
105
109
  this.popup.setBackgroundColor('#16b87d');
106
- this.popup.setContentHTML('#{ @popup_content }');
110
+ this.popup.setContentHTML('#{ @popup_content.gsub("'","") }');
107
111
  #{ @map.js_id }.addPopup(this.popup);
108
112
  this.popup.show();
109
113
  } else {
@@ -0,0 +1,3 @@
1
+ module Ropenlayer
2
+ VERSION = "0.3.3" unless defined? Ropenlayer::VERSION
3
+ end
data/lib/ropenlayer.rb CHANGED
@@ -1,17 +1,18 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
2
+ ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
2
3
 
3
- # Rubygems and Rails Stuff
4
+ # Rubygems and so with bundler
4
5
  require 'rubygems'
6
+ require 'bundler'
7
+ Bundler.setup
5
8
 
6
- # Require them
7
9
  require 'rails'
8
10
  require 'active_record'
9
-
11
+ require 'json'
12
+ require 'ropenlayer/version'
10
13
 
11
14
  module Ropenlayer
12
-
13
- VERSION = '0.3.1'
14
-
15
+
15
16
  autoload :Node, 'ropenlayer/node'
16
17
  autoload :Localization, 'ropenlayer/localization'
17
18
  autoload :ActsAs, 'ropenlayer/acts_as'
@@ -56,6 +57,7 @@ module Ropenlayer
56
57
  yield self
57
58
  end
58
59
 
60
+
59
61
  # Extend ActiveRecord with ActsAs behavior.
60
62
  # Extend also FormBuilder
61
63
  # FIXME support Formstatic
data/ropenlayer.gemspec CHANGED
@@ -1,10 +1,11 @@
1
- require File.join(File.dirname(__FILE__), 'lib', 'ropenlayer')
1
+ $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
2
+ require 'ropenlayer/version'
2
3
 
3
4
  Gem::Specification.new do |s|
4
5
 
5
6
  # define gem
6
7
  s.name = "ropenlayer"
7
- s.version = '0.3.1'
8
+ s.version = Ropenlayer::VERSION
8
9
  s.summary = "Ropenlayer is a wrapper constructor for openlayer javascript library written in ruby. It aims to provide an easy way to build maps and display it on webs."
9
10
  s.description = "Ropenlayer is a wrapper constructor for openlayer javascript library written in ruby. It aims to provide an easy way to build maps and display it on webs."
10
11
  s.authors = ['Gnoxys' ]
@@ -13,10 +14,12 @@ Gem::Specification.new do |s|
13
14
  s.files = `git ls-files`.split("\n")
14
15
 
15
16
  # dependencies
16
- s.add_runtime_dependency('json_pure', '~> 1.2.3')
17
- s.add_runtime_dependency('rails', '~> 3.0.3')
18
- s.add_runtime_dependency('activerecord', '~> 3.0.3')
19
- s.add_development_dependency('rspec', '~> 2.3.0')
17
+ s.add_dependency('json_pure', '~> 1.5.1')
18
+ s.add_dependency('rails', '~> 3.0.3')
19
+ s.add_dependency('activerecord', '~> 3.0.3')
20
+ s.add_development_dependency('rspec', '~> 2.5.0')
21
+ s.add_development_dependency('jasmine', '~> 1.0.2.0')
22
+
20
23
  if RUBY_VERSION < '1.9'
21
24
  s.add_development_dependency('ruby-debug', '~> 0.10.3')
22
25
  end
@@ -0,0 +1,58 @@
1
+ // describe("Player", function() {
2
+ // var player;
3
+ // var song;
4
+ //
5
+ // beforeEach(function() {
6
+ // player = new Player();
7
+ // song = new Song();
8
+ // });
9
+ //
10
+ // it("should be able to play a Song", function() {
11
+ // player.play(song);
12
+ // expect(player.currentlyPlayingSong).toEqual(song);
13
+ //
14
+ // //demonstrates use of custom matcher
15
+ // expect(player).toBePlaying(song);
16
+ // });
17
+ //
18
+ // describe("when song has been paused", function() {
19
+ // beforeEach(function() {
20
+ // player.play(song);
21
+ // player.pause();
22
+ // });
23
+ //
24
+ // it("should indicate that the song is currently paused", function() {
25
+ // expect(player.isPlaying).toBeFalsy();
26
+ //
27
+ // // demonstrates use of 'not' with a custom matcher
28
+ // expect(player).not.toBePlaying(song);
29
+ // });
30
+ //
31
+ // it("should be possible to resume", function() {
32
+ // player.resume();
33
+ // expect(player.isPlaying).toBeTruthy();
34
+ // expect(player.currentlyPlayingSong).toEqual(song);
35
+ // });
36
+ // });
37
+ //
38
+ // // demonstrates use of spies to intercept and test method calls
39
+ // it("tells the current song if the user has made it a favorite", function() {
40
+ // spyOn(song, 'persistFavoriteStatus');
41
+ //
42
+ // player.play(song);
43
+ // player.makeFavorite();
44
+ //
45
+ // expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true);
46
+ // });
47
+ //
48
+ // //demonstrates use of expected exceptions
49
+ // describe("#resume", function() {
50
+ // it("should throw an exception if song is already playing", function() {
51
+ // player.play(song);
52
+ //
53
+ // expect(function() {
54
+ // player.resume();
55
+ // }).toThrow("song is already playing");
56
+ // });
57
+ // });
58
+ // });
@@ -0,0 +1,29 @@
1
+ describe("Ropenlayer", function() {
2
+
3
+ //var testMap;
4
+
5
+ /*
6
+ beforeEach(function() {
7
+ player = new Player();
8
+ song = new Song();
9
+ });*/
10
+
11
+ it("should be able to crete map continer", function() {
12
+ // create a new element
13
+ var testRopenlayerContainer = document.createElement('div');
14
+ testRopenlayerContainer.setAttribute('id', 'ropenlayer_test_map');
15
+ testRopenlayerContainer.setAttribute('style', 'background-color: red; widht: 800px; height: 400px;');
16
+ x = document.body.appendChild(testRopenlayerContainer);
17
+ //reget it
18
+ y = document.getElementById('ropenlayer_test_map');
19
+ expect(y.id).toEqual('ropenlayer_test_map');
20
+ });
21
+
22
+
23
+ it("should create a new map container", function () {
24
+ // add first OpenLayers Lib
25
+ var testRopenlayerContainer = document.createElement('div');
26
+ // testMap = setTestMap();
27
+ });
28
+
29
+ });
@@ -0,0 +1,69 @@
1
+ // create a new element
2
+ function setTestMap() {
3
+ // Ropenlayer::Openlayer::Map.to_s OpenLayers Cartographic JS project licensed under BSD~style license. More information can be found at http://openlayers.org/
4
+ var olObject_ropenlayer_test_map = new OpenLayers.Map({'units': 'm', 'maxResolution': 156543.0339, 'div': 'ropenlayer_test_map', 'maxExtent': new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34), 'projection': new OpenLayers.Projection('EPSG:900913'), 'theme': '/stylesheets/ropenlayer.css', 'controls': []});
5
+
6
+ // Notification area
7
+ var olObject_ropenlayer_test_map_notification_area = $('<div style="display: none;" class="olMapNotificationArea" id="olObject_ropenlayer_test_map_notification_area" ></div>');
8
+
9
+
10
+ // Adding google_hybrid layer
11
+ var olObject_ropenlayer_test_map_google_hybrid = new OpenLayers.Layer.Google('Google Hybrid', {'type': google.maps.MapTypeId.HYBRID, 'numZoomLevels': 22});
12
+ olObject_ropenlayer_test_map.addLayer(olObject_ropenlayer_test_map_google_hybrid); // Adding google_streets layer
13
+ var olObject_ropenlayer_test_map_google_streets = new OpenLayers.Layer.Google('Google Streets', {'numZoomLevels': 20});
14
+ olObject_ropenlayer_test_map.addLayer(olObject_ropenlayer_test_map_google_streets); // Adding wms layer
15
+ var olObject_ropenlayer_test_map_wms = new OpenLayers.Layer.WMS('OpenLayers WMS', 'http://vmap0.tiles.osgeo.org/wms/vmap0', {'layers': 'basic'});
16
+ olObject_ropenlayer_test_map.addLayer(olObject_ropenlayer_test_map_wms); // Adding google_satellite layer
17
+ var olObject_ropenlayer_test_map_google_satellite = new OpenLayers.Layer.Google('Google Satellite', {'type': google.maps.MapTypeId.SATELLITE, 'numZoomLevels': 22});
18
+ olObject_ropenlayer_test_map.addLayer(olObject_ropenlayer_test_map_google_satellite); // Adding google_physical layer
19
+ var olObject_ropenlayer_test_map_google_physical = new OpenLayers.Layer.Google('Google Physical', {'type': google.maps.MapTypeId.TERRAIN});
20
+ olObject_ropenlayer_test_map.addLayer(olObject_ropenlayer_test_map_google_physical); // Adding osm layer
21
+ var olObject_ropenlayer_test_map_osm = new OpenLayers.Layer.OSM('Usar Mapa OSM');
22
+ olObject_ropenlayer_test_map.addLayer(olObject_ropenlayer_test_map_osm);
23
+ // Adding scale_line control
24
+ var olObject_ropenlayer_test_map_scale_line = new OpenLayers.Control.ScaleLine();
25
+ olObject_ropenlayer_test_map.addControl(olObject_ropenlayer_test_map_scale_line);
26
+ // Adding mouse_position control
27
+ var olObject_ropenlayer_test_map_mouse_position = new OpenLayers.Control.MousePosition();
28
+ olObject_ropenlayer_test_map.addControl(olObject_ropenlayer_test_map_mouse_position);
29
+ // Adding pan_panel control
30
+ var olObject_ropenlayer_test_map_pan_panel = new OpenLayers.Control.PanPanel();
31
+ olObject_ropenlayer_test_map.addControl(olObject_ropenlayer_test_map_pan_panel);
32
+ // Adding navigation control
33
+ var olObject_ropenlayer_test_map_navigation = new OpenLayers.Control.Navigation();
34
+ olObject_ropenlayer_test_map.addControl(olObject_ropenlayer_test_map_navigation);
35
+ // Adding zoom_panel control
36
+ var olObject_ropenlayer_test_map_zoom_panel = new OpenLayers.Control.ZoomPanel();
37
+ olObject_ropenlayer_test_map.addControl(olObject_ropenlayer_test_map_zoom_panel);
38
+
39
+
40
+ // Setting center
41
+ olObject_ropenlayer_test_map.setCenter(new OpenLayers.LonLat(263274.20626803, 4580313.35287), 4);
42
+
43
+ // Adding layers_select box control
44
+
45
+ var olObject_ropenlayer_test_map_layers_select_control = new OpenLayers.Control.Button({'displayClass': 'olControlLayersBoxControl', 'trigger': function() { $(olObject_ropenlayer_test_map_layers_select_links).toggle() }});
46
+ var olObject_ropenlayer_test_map_layers_select_links = $('<div style="display: none;" class="olControlLayersBoxControlLinks" id="olObject_ropenlayer_test_map_layers_select_links" ></div>');
47
+ var olObject_ropenlayer_test_map_layers_select_panel = new OpenLayers.Control.Panel({'defaultControl': olObject_ropenlayer_test_map_layers_select_control, 'displayClass': 'olControlLayersBoxControlPanel'});
48
+
49
+ olObject_ropenlayer_test_map_layers_select_panel.addControls([olObject_ropenlayer_test_map_layers_select_control]);
50
+ olObject_ropenlayer_test_map.addControls([olObject_ropenlayer_test_map_layers_select_panel]);
51
+
52
+ $(olObject_ropenlayer_test_map_layers_select_control.div).append(olObject_ropenlayer_test_map_layers_select_links);
53
+
54
+ $(olObject_ropenlayer_test_map_layers_select_links).append($('<a onclick="olObject_ropenlayer_test_map.setBaseLayer(olObject_ropenlayer_test_map_google_hybrid); $(olObject_ropenlayer_test_map_layers_select_links).hide(); return false;" class="olControlLayersBoxControl" id="link_to_base_layer_google_hybrid" > » Usar Mapa Mapa Híbrido de Google</a>'));$(olObject_ropenlayer_test_map_layers_select_links).append($('<a onclick="olObject_ropenlayer_test_map.setBaseLayer(olObject_ropenlayer_test_map_google_streets); $(olObject_ropenlayer_test_map_layers_select_links).hide(); return false;" class="olControlLayersBoxControl" id="link_to_base_layer_google_streets" > » Usar Mapa Mapa StreetsGoogle</a>'));$(olObject_ropenlayer_test_map_layers_select_links).append($('<a onclick="olObject_ropenlayer_test_map.setBaseLayer(olObject_ropenlayer_test_map_wms); $(olObject_ropenlayer_test_map_layers_select_links).hide(); return false;" class="olControlLayersBoxControl" id="link_to_base_layer_wms" > » Usar Mapa Mapa Libre WMS</a>'));$(olObject_ropenlayer_test_map_layers_select_links).append($('<a onclick="olObject_ropenlayer_test_map.setBaseLayer(olObject_ropenlayer_test_map_google_satellite); $(olObject_ropenlayer_test_map_layers_select_links).hide(); return false;" class="olControlLayersBoxControl" id="link_to_base_layer_google_satellite" > » Usar Mapa Mapa Satélite de Google</a>'));$(olObject_ropenlayer_test_map_layers_select_links).append($('<a onclick="olObject_ropenlayer_test_map.setBaseLayer(olObject_ropenlayer_test_map_google_physical); $(olObject_ropenlayer_test_map_layers_select_links).hide(); return false;" class="olControlLayersBoxControl" id="link_to_base_layer_google_physical" > » Usar Mapa Mapa Físico de Google</a>'));$(olObject_ropenlayer_test_map_layers_select_links).append($('<a onclick="olObject_ropenlayer_test_map.setBaseLayer(olObject_ropenlayer_test_map_osm); $(olObject_ropenlayer_test_map_layers_select_links).hide(); return false;" class="olControlLayersBoxControl" id="link_to_base_layer_osm" > » Usar Mapa Mapa Libre OSM</a>'));
55
+
56
+
57
+
58
+
59
+ // Adding vector_elements layer
60
+ var olObject_ropenlayer_test_map_vector_elements = new OpenLayers.Layer.Vector('Capa de Elementos', {'styleMap': new OpenLayers.StyleMap({'default': {"pointerEvents":"visiblePainted","strokeOpacity":0.8,"fontSize":"12px","strokeWidth":5,"fontWeight":"bold","cursor":"normal","fillColor":"${fillColor}","graphicWidth":48,"fillOpacity":0.8,"graphicHeight":48,"pointRadius":30,"strokeColor":"${fillColor}"}})});
61
+ olObject_ropenlayer_test_map.addLayer(olObject_ropenlayer_test_map_vector_elements);
62
+ // Adding marker_elements layer
63
+ var olObject_ropenlayer_test_map_marker_elements = new OpenLayers.Layer.Markers('Capa de Marcadores');
64
+ olObject_ropenlayer_test_map.addLayer(olObject_ropenlayer_test_map_marker_elements);
65
+
66
+
67
+
68
+ return olObject_ropenlayer_test_map;
69
+ }
@@ -0,0 +1,9 @@
1
+ beforeEach(function() {
2
+ this.addMatchers({
3
+ toBePlaying: function(expectedSong) {
4
+ var player = this.actual;
5
+ return player.currentlyPlayingSong === expectedSong
6
+ && player.isPlaying;
7
+ }
8
+ })
9
+ });
@@ -0,0 +1,74 @@
1
+ # src_files
2
+ #
3
+ # Return an array of filepaths relative to src_dir to include before jasmine specs.
4
+ # Default: []
5
+ #
6
+ # EXAMPLE:
7
+ #
8
+ # src_files:
9
+ # - lib/source1.js
10
+ # - lib/source2.js
11
+ # - dist/**/*.js
12
+ #
13
+ src_files:
14
+ - public/javascripts/**/*.js
15
+
16
+
17
+ # stylesheets
18
+ #
19
+ # Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
20
+ # Default: []
21
+ #
22
+ # EXAMPLE:
23
+ #
24
+ # stylesheets:
25
+ # - css/style.css
26
+ # - stylesheets/*.css
27
+ #
28
+ stylesheets:
29
+
30
+ # helpers
31
+ #
32
+ # Return an array of filepaths relative to spec_dir to include before jasmine specs.
33
+ # Default: ["helpers/**/*.js"]
34
+ #
35
+ # EXAMPLE:
36
+ #
37
+ # helpers:
38
+ # - helpers/**/*.js
39
+ #
40
+ helpers:
41
+
42
+ # spec_files
43
+ #
44
+ # Return an array of filepaths relative to spec_dir to include.
45
+ # Default: ["**/*[sS]pec.js"]
46
+ #
47
+ # EXAMPLE:
48
+ #
49
+ # spec_files:
50
+ # - **/*[sS]pec.js
51
+ #
52
+ spec_files:
53
+
54
+ # src_dir
55
+ #
56
+ # Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
57
+ # Default: project root
58
+ #
59
+ # EXAMPLE:
60
+ #
61
+ # src_dir: public
62
+ #
63
+ src_dir:
64
+
65
+ # spec_dir
66
+ #
67
+ # Spec directory path. Your spec_files must be returned relative to this path.
68
+ # Default: spec/javascripts
69
+ #
70
+ # EXAMPLE:
71
+ #
72
+ # spec_dir: spec/javascripts
73
+ #
74
+ spec_dir:
@@ -0,0 +1,56 @@
1
+ module Jasmine
2
+ class Config
3
+
4
+ # Add your overrides or custom config code here
5
+ # Generation JS container Ropenlayer Map
6
+ @@dynamic_ropenlayer_helper = File.expand_path(File.join(File.dirname(__FILE__), '../helpers', 'RopenlayerHelper.js'))
7
+
8
+ File.open(@@dynamic_ropenlayer_helper, 'w') do |f|
9
+ f.write("// create a new element
10
+ function setTestMap() {
11
+ #{ Ropenlayer::Openlayer::Map.new('ropenlayer_test_map').to_js }
12
+ return olObject_ropenlayer_test_map;
13
+ }
14
+ ")
15
+
16
+
17
+ end
18
+
19
+ puts @@dynamic_ropenlayer_helper
20
+
21
+ end
22
+ end
23
+
24
+
25
+ module Jasmine
26
+ class RunAdapter
27
+
28
+ def run(focused_suite = nil)
29
+ jasmine_files = @jasmine_files
30
+ css_files = @jasmine_stylesheets + (@config.css_files || [])
31
+ js_files = @config.js_files(focused_suite)
32
+ body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html.erb"))).result(binding)
33
+ [
34
+ 200,
35
+ { 'Content-Type' => 'text/html' },
36
+ [body]
37
+ ]
38
+ end
39
+ end
40
+ end
41
+
42
+
43
+ # Note - this is necessary for rspec2, which has removed the backtrace
44
+ module Jasmine
45
+ class SpecBuilder
46
+ def declare_spec(parent, spec)
47
+ me = self
48
+ example_name = spec["name"]
49
+ @spec_ids << spec["id"]
50
+ backtrace = @example_locations[parent.description + " " + example_name]
51
+ parent.it example_name, {} do
52
+ me.report_spec(spec["id"])
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,35 @@
1
+ $:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
2
+
3
+ require 'rubygems'
4
+ require 'jasmine'
5
+ jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
6
+ require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
7
+ if Jasmine::rspec2?
8
+ require 'rspec'
9
+ else
10
+ require 'spec'
11
+ end
12
+
13
+
14
+
15
+
16
+ jasmine_config = Jasmine::Config.new
17
+ spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
18
+
19
+ should_stop = false
20
+
21
+ if Jasmine::rspec2?
22
+ RSpec.configuration.after(:suite) do
23
+ spec_builder.stop if should_stop
24
+ end
25
+ else
26
+ Spec::Runner.configure do |config|
27
+ config.after(:suite) do
28
+ spec_builder.stop if should_stop
29
+ end
30
+ end
31
+ end
32
+
33
+ spec_builder.start
34
+ should_stop = true
35
+ spec_builder.declare_suites
@@ -0,0 +1,49 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
+ <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
5
+ <title>Jasmine suite</title>
6
+ <% css_files.each do |css_file| %>
7
+ <link rel="stylesheet" href="<%= css_file %>" type="text/css" media="screen"/>
8
+ <% end %>
9
+
10
+ <script src="http://maps.google.com/maps/api/js?v=3.2.4&sensor=true"></script>
11
+ <script src="http://openlayers.org/api/OpenLayers.js"></script>
12
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
13
+
14
+
15
+ <% jasmine_files.each do |jasmine_file| %>
16
+ <script src="<%= jasmine_file %>" type="text/javascript"></script>
17
+ <% end %>
18
+
19
+ <script type="text/javascript">
20
+ var jsApiReporter;
21
+ (function() {
22
+ var jasmineEnv = jasmine.getEnv();
23
+
24
+ jsApiReporter = new jasmine.JsApiReporter();
25
+ var trivialReporter = new jasmine.TrivialReporter();
26
+
27
+ jasmineEnv.addReporter(jsApiReporter);
28
+ jasmineEnv.addReporter(trivialReporter);
29
+
30
+ jasmineEnv.specFilter = function(spec) {
31
+ return trivialReporter.specFilter(spec);
32
+ };
33
+
34
+ window.onload = function() {
35
+ jasmineEnv.execute();
36
+ };
37
+ })();
38
+ </script>
39
+
40
+ <% js_files.each do |js_file| %>
41
+ <script src="<%= js_file %>" type="text/javascript"></script>
42
+ <% end %>
43
+
44
+ </head>
45
+ <body>
46
+ <div id="jasmine_content"></div>
47
+ </body>
48
+ </html>
49
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ropenlayer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gnoxys
@@ -15,29 +15,27 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-08 00:00:00 +01:00
18
+ date: 2011-05-08 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: json_pure
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
23
  none: false
26
24
  requirements:
27
25
  - - ~>
28
26
  - !ruby/object:Gem::Version
29
- hash: 25
27
+ hash: 1
30
28
  segments:
31
29
  - 1
32
- - 2
33
- - 3
34
- version: 1.2.3
30
+ - 5
31
+ - 1
32
+ version: 1.5.1
33
+ requirement: *id001
35
34
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: rails
35
+ name: json_pure
39
36
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
37
+ - !ruby/object:Gem::Dependency
38
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
39
  none: false
42
40
  requirements:
43
41
  - - ~>
@@ -48,12 +46,12 @@ dependencies:
48
46
  - 0
49
47
  - 3
50
48
  version: 3.0.3
49
+ requirement: *id002
51
50
  type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: activerecord
51
+ name: rails
55
52
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
53
+ - !ruby/object:Gem::Dependency
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
57
55
  none: false
58
56
  requirements:
59
57
  - - ~>
@@ -64,28 +62,45 @@ dependencies:
64
62
  - 0
65
63
  - 3
66
64
  version: 3.0.3
65
+ requirement: *id003
67
66
  type: :runtime
68
- version_requirements: *id003
67
+ name: activerecord
68
+ prerelease: false
69
69
  - !ruby/object:Gem::Dependency
70
+ version_requirements: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ hash: 27
76
+ segments:
77
+ - 2
78
+ - 5
79
+ - 0
80
+ version: 2.5.0
81
+ requirement: *id004
82
+ type: :development
70
83
  name: rspec
71
84
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
85
+ - !ruby/object:Gem::Dependency
86
+ version_requirements: &id005 !ruby/object:Gem::Requirement
73
87
  none: false
74
88
  requirements:
75
89
  - - ~>
76
90
  - !ruby/object:Gem::Version
77
- hash: 3
91
+ hash: 87
78
92
  segments:
93
+ - 1
94
+ - 0
79
95
  - 2
80
- - 3
81
96
  - 0
82
- version: 2.3.0
97
+ version: 1.0.2.0
98
+ requirement: *id005
83
99
  type: :development
84
- version_requirements: *id004
85
- - !ruby/object:Gem::Dependency
86
- name: ruby-debug
100
+ name: jasmine
87
101
  prerelease: false
88
- requirement: &id005 !ruby/object:Gem::Requirement
102
+ - !ruby/object:Gem::Dependency
103
+ version_requirements: &id006 !ruby/object:Gem::Requirement
89
104
  none: false
90
105
  requirements:
91
106
  - - ~>
@@ -96,8 +111,10 @@ dependencies:
96
111
  - 10
97
112
  - 3
98
113
  version: 0.10.3
114
+ requirement: *id006
99
115
  type: :development
100
- version_requirements: *id005
116
+ name: ruby-debug
117
+ prerelease: false
101
118
  description: Ropenlayer is a wrapper constructor for openlayer javascript library written in ruby. It aims to provide an easy way to build maps and display it on webs.
102
119
  email:
103
120
  - development@gnoxys.net
@@ -185,10 +202,19 @@ files:
185
202
  - lib/ropenlayer/openlayer/layer/elements_marker.rb
186
203
  - lib/ropenlayer/openlayer/layer/elements_vector.rb
187
204
  - lib/ropenlayer/openlayer/map.rb
205
+ - lib/ropenlayer/version.rb
188
206
  - ropenlayer.gemspec
189
207
  - script/console
190
208
  - script/destroy
191
209
  - script/generate
210
+ - spec/javascripts/PlayerSpec.js
211
+ - spec/javascripts/RopenlayerSpec.js
212
+ - spec/javascripts/helpers/RopenlayerHelper.js
213
+ - spec/javascripts/helpers/SpecHelper.js
214
+ - spec/javascripts/support/jasmine.yml
215
+ - spec/javascripts/support/jasmine_config.rb
216
+ - spec/javascripts/support/jasmine_runner.rb
217
+ - spec/javascripts/support/run.html.erb
192
218
  has_rdoc: true
193
219
  homepage: http://gitorious.org/gnoxys/ropenlayer
194
220
  licenses: []