elektronaut-vector2d 0.5.1 → 0.5.2
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/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +28 -0
- data/Rakefile +83 -0
- data/VERSION +1 -0
- data/lib/vector2d.rb +0 -4
- data/test/test_helper.rb +10 -0
- data/test/vector2d_test.rb +7 -0
- data/vector2d.gemspec +48 -0
- metadata +19 -12
- data/History.txt +0 -14
- data/MIT-LICENSE.txt +0 -22
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Inge Jørgensen
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -4,6 +4,34 @@ Vector2d allows for easy handling of two-dimensionals coordinates and vectors.
|
|
4
4
|
It's very flexible, most methods accepts arguments as strings, arrays, hashes
|
5
5
|
or Vector2d objects.
|
6
6
|
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
Install from RubyForge:
|
10
|
+
|
11
|
+
sudo gem install vector2d
|
12
|
+
|
13
|
+
Install from GitHub:
|
14
|
+
|
15
|
+
gem sources -a http://gems.github.com
|
16
|
+
sudo gem install elektronaut-vector2d
|
17
|
+
|
18
|
+
== Usage examples
|
19
|
+
|
20
|
+
require 'vector2d'
|
21
|
+
|
22
|
+
# These are equal
|
23
|
+
v = Vector2d.new(50, 70)
|
24
|
+
v = Vector2d.new('50x70') # These are equal
|
25
|
+
|
26
|
+
v.aspect_ratio # => 0.714285714285714
|
27
|
+
v.length # => 86.0232526704263
|
28
|
+
|
29
|
+
# Calculations work as expected
|
30
|
+
v * 2 # => #<Vector2d:0x5d994 @y=140.0, @x=100.0>
|
31
|
+
v + Vector2d.new(20,30) # => #<Vector2d:0x59c54 @y=100.0, @x=70.0>
|
32
|
+
|
33
|
+
v.constrain_both(64, 64) # => #<Vector2d:0x47e28 @y=64.0, @x=45.7142857142857>
|
34
|
+
|
7
35
|
== Licence
|
8
36
|
|
9
37
|
(The MIT License)
|
data/Rakefile
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "vector2d"
|
8
|
+
gem.summary = %Q{Vector2d allows for easy handling of two-dimensionals coordinates and vectors}
|
9
|
+
gem.email = "inge@elektronaut.no"
|
10
|
+
gem.homepage = "http://github.com/elektronaut/vector2d"
|
11
|
+
gem.authors = ["Inge Jørgensen"]
|
12
|
+
gem.rubyforge_project = 'vector2d'
|
13
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
+
end
|
15
|
+
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'rake/testtask'
|
21
|
+
Rake::TestTask.new(:test) do |test|
|
22
|
+
test.libs << 'lib' << 'test'
|
23
|
+
test.pattern = 'test/**/*_test.rb'
|
24
|
+
test.verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
begin
|
28
|
+
require 'rcov/rcovtask'
|
29
|
+
Rcov::RcovTask.new do |test|
|
30
|
+
test.libs << 'test'
|
31
|
+
test.pattern = 'test/**/*_test.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
rescue LoadError
|
35
|
+
task :rcov do
|
36
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
require 'rake/contrib/sshpublisher'
|
42
|
+
namespace :rubyforge do
|
43
|
+
|
44
|
+
desc "Release gem and RDoc documentation to RubyForge"
|
45
|
+
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
46
|
+
|
47
|
+
namespace :release do
|
48
|
+
desc "Publish RDoc to RubyForge."
|
49
|
+
task :docs => [:rdoc] do
|
50
|
+
config = YAML.load(
|
51
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
52
|
+
)
|
53
|
+
|
54
|
+
host = "#{config['username']}@rubyforge.org"
|
55
|
+
remote_dir = "/var/www/gforge-projects/vector2d/"
|
56
|
+
local_dir = 'rdoc'
|
57
|
+
|
58
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
rescue LoadError
|
63
|
+
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
64
|
+
end
|
65
|
+
|
66
|
+
task :default => :test
|
67
|
+
|
68
|
+
require 'rake/rdoctask'
|
69
|
+
Rake::RDocTask.new do |rdoc|
|
70
|
+
if File.exist?('VERSION.yml')
|
71
|
+
config = YAML.load(File.read('VERSION.yml'))
|
72
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
73
|
+
else
|
74
|
+
version = ""
|
75
|
+
end
|
76
|
+
|
77
|
+
rdoc.rdoc_dir = 'rdoc'
|
78
|
+
rdoc.title = "vector2d #{version}"
|
79
|
+
rdoc.rdoc_files.include('README*')
|
80
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
81
|
+
end
|
82
|
+
|
83
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.5.2
|
data/lib/vector2d.rb
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
$:.unshift File.dirname(__FILE__)
|
2
|
-
|
3
1
|
# Vector2d allows for easy handling of two-dimensionals coordinates and vectors.
|
4
2
|
# It's very flexible, most methods accepts arguments as strings, arrays, hashes
|
5
3
|
# or Vector2d objects.
|
6
4
|
class Vector2d
|
7
5
|
|
8
|
-
VERSION_STRING = [0, 5, 1].join('.') #:nodoc:
|
9
|
-
|
10
6
|
# X axis
|
11
7
|
attr_accessor :x
|
12
8
|
# Y axis
|
data/test/test_helper.rb
ADDED
data/vector2d.gemspec
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{vector2d}
|
5
|
+
s.version = "0.5.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Inge J\303\270rgensen"]
|
9
|
+
s.date = %q{2009-05-20}
|
10
|
+
s.email = %q{inge@elektronaut.no}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"LICENSE",
|
13
|
+
"README.rdoc"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
".document",
|
17
|
+
".gitignore",
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"lib/vector2d.rb",
|
23
|
+
"test/test_helper.rb",
|
24
|
+
"test/vector2d_test.rb",
|
25
|
+
"vector2d.gemspec"
|
26
|
+
]
|
27
|
+
s.has_rdoc = true
|
28
|
+
s.homepage = %q{http://github.com/elektronaut/vector2d}
|
29
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.rubyforge_project = %q{vector2d}
|
32
|
+
s.rubygems_version = %q{1.3.1}
|
33
|
+
s.summary = %q{Vector2d allows for easy handling of two-dimensionals coordinates and vectors}
|
34
|
+
s.test_files = [
|
35
|
+
"test/test_helper.rb",
|
36
|
+
"test/vector2d_test.rb"
|
37
|
+
]
|
38
|
+
|
39
|
+
if s.respond_to? :specification_version then
|
40
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
41
|
+
s.specification_version = 2
|
42
|
+
|
43
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
44
|
+
else
|
45
|
+
end
|
46
|
+
else
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elektronaut-vector2d
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Inge J\xC3\xB8rgensen"
|
@@ -13,24 +13,30 @@ date: 2009-05-20 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
17
|
-
email: inge@
|
16
|
+
description:
|
17
|
+
email: inge@elektronaut.no
|
18
18
|
executables: []
|
19
19
|
|
20
20
|
extensions: []
|
21
21
|
|
22
|
-
extra_rdoc_files:
|
23
|
-
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
24
25
|
files:
|
25
|
-
-
|
26
|
+
- .document
|
27
|
+
- .gitignore
|
28
|
+
- LICENSE
|
26
29
|
- README.rdoc
|
27
|
-
-
|
30
|
+
- Rakefile
|
31
|
+
- VERSION
|
28
32
|
- lib/vector2d.rb
|
33
|
+
- test/test_helper.rb
|
34
|
+
- test/vector2d_test.rb
|
35
|
+
- vector2d.gemspec
|
29
36
|
has_rdoc: true
|
30
|
-
homepage: http://github.com/elektronaut/
|
37
|
+
homepage: http://github.com/elektronaut/vector2d
|
31
38
|
post_install_message:
|
32
39
|
rdoc_options:
|
33
|
-
- --inline-source
|
34
40
|
- --charset=UTF-8
|
35
41
|
require_paths:
|
36
42
|
- lib
|
@@ -52,6 +58,7 @@ rubyforge_project: vector2d
|
|
52
58
|
rubygems_version: 1.2.0
|
53
59
|
signing_key:
|
54
60
|
specification_version: 2
|
55
|
-
summary: Vector2d allows for easy handling of two-dimensionals coordinates and vectors
|
56
|
-
test_files:
|
57
|
-
|
61
|
+
summary: Vector2d allows for easy handling of two-dimensionals coordinates and vectors
|
62
|
+
test_files:
|
63
|
+
- test/test_helper.rb
|
64
|
+
- test/vector2d_test.rb
|
data/History.txt
DELETED
data/MIT-LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2006-2009 Inge Jørgensen
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person
|
4
|
-
obtaining a copy of this software and associated documentation
|
5
|
-
files (the "Software"), to deal in the Software without
|
6
|
-
restriction, including without limitation the rights to use,
|
7
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
copies of the Software, and to permit persons to whom the
|
9
|
-
Software is furnished to do so, subject to the following
|
10
|
-
conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be
|
13
|
-
included in all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
OTHER DEALINGS IN THE SOFTWARE.
|