modalsupport 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/modalsupport.rb +1 -0
- data/lib/modalsupport/pathname.rb +14 -0
- data/modalsupport.gemspec +12 -9
- data/test/test_pathname.rb +47 -0
- metadata +50 -37
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.2
|
data/lib/modalsupport.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
unless Pathname.instance_methods.any?{|m| m.to_s=='sub_ext'}
|
4
|
+
class Pathname
|
5
|
+
# This method is available in Ruby >= 1.9.1
|
6
|
+
def sub_ext(new_ext)
|
7
|
+
# this is how I would do it:
|
8
|
+
# new_ext = ".#{new_ext}" unless new_ext[0,1]=='.'
|
9
|
+
# Pathname.new to_s[/.*(?=\..+$)/]+new_ext
|
10
|
+
# but we'll try to be compatible with the standars library method
|
11
|
+
Pathname(self.to_s.chomp(extname) + new_ext)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/modalsupport.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.9.
|
7
|
+
s.name = %q{modalsupport}
|
8
|
+
s.version = "0.9.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Javier Goizueta"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = %q{2012-09-05}
|
13
|
+
s.description = %q{additional support extensions to ActiveSupport and HoboSupport}
|
14
|
+
s.email = %q{jgoizueta@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
17
|
"README.rdoc"
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/modalsupport/methodcall.rb",
|
33
33
|
"lib/modalsupport/mixins/bracket_constructor.rb",
|
34
34
|
"lib/modalsupport/mixins/state_equivalent.rb",
|
35
|
+
"lib/modalsupport/pathname.rb",
|
35
36
|
"lib/modalsupport/recursive_map.rb",
|
36
37
|
"lib/modalsupport/regexp.rb",
|
37
38
|
"lib/modalsupport/ruby_engine.rb",
|
@@ -52,6 +53,7 @@ Gem::Specification.new do |s|
|
|
52
53
|
"test/test_match.rb",
|
53
54
|
"test/test_methodcall.rb",
|
54
55
|
"test/test_paralell_each.rb",
|
56
|
+
"test/test_pathname.rb",
|
55
57
|
"test/test_product.rb",
|
56
58
|
"test/test_recursive_map.rb",
|
57
59
|
"test/test_relative_path.rb",
|
@@ -62,15 +64,16 @@ Gem::Specification.new do |s|
|
|
62
64
|
"test/test_unindent.rb",
|
63
65
|
"test/test_unwrap.rb"
|
64
66
|
]
|
65
|
-
s.homepage =
|
67
|
+
s.homepage = %q{http://github.com/jgoizueta/modalsupport}
|
66
68
|
s.require_paths = ["lib"]
|
67
|
-
s.rubygems_version =
|
68
|
-
s.summary =
|
69
|
+
s.rubygems_version = %q{1.3.6}
|
70
|
+
s.summary = %q{simple extensions to core classes}
|
69
71
|
|
70
72
|
if s.respond_to? :specification_version then
|
73
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
71
74
|
s.specification_version = 3
|
72
75
|
|
73
|
-
if Gem::Version.new(Gem::
|
76
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
74
77
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
75
78
|
else
|
76
79
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestPatname < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "Pathname#sub_ext should be available" do
|
6
|
+
|
7
|
+
should "substitute filename extensions" do
|
8
|
+
assert_equal "/dsfsdfs/aaa.bbb/ccc.doc", Pathname('/dsfsdfs/aaa.bbb/ccc.txt').sub_ext('.doc').to_s
|
9
|
+
assert_equal "/dsfsdfs/aaa.bbb/cccdoc", Pathname('/dsfsdfs/aaa.bbb/ccc.txt').sub_ext('doc').to_s
|
10
|
+
assert_equal "/dsfsdfs/aaa.bbb/zzz.ccc.doc", Pathname('/dsfsdfs/aaa.bbb/zzz.ccc.txt').sub_ext('.doc').to_s
|
11
|
+
assert_equal "zzz.ccc.doc", Pathname('zzz.ccc.txt').sub_ext('.doc').to_s
|
12
|
+
assert_equal "zzzccc.doc", Pathname('zzzccc.txt').sub_ext('.doc').to_s
|
13
|
+
assert_equal "/dsfsdfs/aaa.bbb/ccc.doc", Pathname('/dsfsdfs/aaa.bbb/ccc.txt').sub_ext('.doc').to_s
|
14
|
+
assert_equal "C:/dsfsdfs/aaa.bbb/ccc.doc", Pathname('C:/dsfsdfs/aaa.bbb/ccc.txt').sub_ext('.doc').to_s
|
15
|
+
end
|
16
|
+
|
17
|
+
should "append filename extensions" do
|
18
|
+
assert_equal "/dsfsdfs/aaa.bbb/ccc.doc", Pathname('/dsfsdfs/aaa.bbb/ccc').sub_ext('.doc').to_s
|
19
|
+
assert_equal "/dsfsdfs/aaa.bbb/cccdoc", Pathname('/dsfsdfs/aaa.bbb/ccc').sub_ext('doc').to_s
|
20
|
+
assert_equal "zzzccc.doc", Pathname('zzzccc').sub_ext('.doc').to_s
|
21
|
+
assert_equal "/dsfsdfs/aaa.bbb/ccc.doc", Pathname('/dsfsdfs/aaa.bbb/ccc').sub_ext('.doc').to_s
|
22
|
+
assert_equal "C:/dsfsdfs/aaa.bbb/ccc.doc", Pathname('C:/dsfsdfs/aaa.bbb/ccc').sub_ext('.doc').to_s
|
23
|
+
|
24
|
+
assert_equal "/dsfsdfs/aaa.bbb/ccc..doc", Pathname('/dsfsdfs/aaa.bbb/ccc.').sub_ext('.doc').to_s
|
25
|
+
|
26
|
+
assert_equal "/dsfsdfs/aaa/.doc", Pathname('/dsfsdfs/aaa/').sub_ext('.doc').to_s
|
27
|
+
assert_equal ".doc", Pathname('').sub_ext('.doc').to_s
|
28
|
+
|
29
|
+
# To be strict with Pathname we could require:
|
30
|
+
# assert_equal "/dsfsdfs/aaa.doc", Pathname('/dsfsdfs/aaa.bbb/').sub_ext('.doc').to_s
|
31
|
+
# But we won't; (current implementation returns '/dsfsdfs/aaa.bbb/.doc'
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
should "remove filename extensions" do
|
36
|
+
assert_equal "/dsfsdfs/aaa.bbb/ccc", Pathname('/dsfsdfs/aaa.bbb/ccc.txt').sub_ext('').to_s
|
37
|
+
assert_equal "/dsfsdfs/aaa.bbb/zzz.ccc", Pathname('/dsfsdfs/aaa.bbb/zzz.ccc.txt').sub_ext('').to_s
|
38
|
+
assert_equal "/dsfsdfs/aaa.bbb/ccc.", Pathname('/dsfsdfs/aaa.bbb/ccc.').sub_ext('').to_s
|
39
|
+
assert_equal "zzz.ccc", Pathname('zzz.ccc.txt').sub_ext('').to_s
|
40
|
+
assert_equal "zzzccc", Pathname('zzzccc.txt').sub_ext('').to_s
|
41
|
+
assert_equal "/dsfsdfs/aaa.bbb/ccc", Pathname('/dsfsdfs/aaa.bbb/ccc.txt').sub_ext('').to_s
|
42
|
+
assert_equal "C:/dsfsdfs/aaa.bbb/ccc", Pathname('C:/dsfsdfs/aaa.bbb/ccc.txt').sub_ext('').to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
metadata
CHANGED
@@ -1,40 +1,44 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: modalsupport
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 9
|
8
|
+
- 2
|
9
|
+
version: 0.9.2
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Javier Goizueta
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2012-09-05 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: shoulda
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :development
|
23
22
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
30
32
|
description: additional support extensions to ActiveSupport and HoboSupport
|
31
33
|
email: jgoizueta@gmail.com
|
32
34
|
executables: []
|
35
|
+
|
33
36
|
extensions: []
|
34
|
-
|
37
|
+
|
38
|
+
extra_rdoc_files:
|
35
39
|
- LICENSE
|
36
40
|
- README.rdoc
|
37
|
-
files:
|
41
|
+
files:
|
38
42
|
- .document
|
39
43
|
- LICENSE
|
40
44
|
- README.rdoc
|
@@ -50,6 +54,7 @@ files:
|
|
50
54
|
- lib/modalsupport/methodcall.rb
|
51
55
|
- lib/modalsupport/mixins/bracket_constructor.rb
|
52
56
|
- lib/modalsupport/mixins/state_equivalent.rb
|
57
|
+
- lib/modalsupport/pathname.rb
|
53
58
|
- lib/modalsupport/recursive_map.rb
|
54
59
|
- lib/modalsupport/regexp.rb
|
55
60
|
- lib/modalsupport/ruby_engine.rb
|
@@ -70,6 +75,7 @@ files:
|
|
70
75
|
- test/test_match.rb
|
71
76
|
- test/test_methodcall.rb
|
72
77
|
- test/test_paralell_each.rb
|
78
|
+
- test/test_pathname.rb
|
73
79
|
- test/test_product.rb
|
74
80
|
- test/test_recursive_map.rb
|
75
81
|
- test/test_relative_path.rb
|
@@ -79,28 +85,35 @@ files:
|
|
79
85
|
- test/test_state_equivalent.rb
|
80
86
|
- test/test_unindent.rb
|
81
87
|
- test/test_unwrap.rb
|
88
|
+
has_rdoc: true
|
82
89
|
homepage: http://github.com/jgoizueta/modalsupport
|
83
90
|
licenses: []
|
91
|
+
|
84
92
|
post_install_message:
|
85
93
|
rdoc_options: []
|
86
|
-
|
94
|
+
|
95
|
+
require_paths:
|
87
96
|
- lib
|
88
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
version: "0"
|
100
111
|
requirements: []
|
112
|
+
|
101
113
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.
|
114
|
+
rubygems_version: 1.3.6
|
103
115
|
signing_key:
|
104
116
|
specification_version: 3
|
105
117
|
summary: simple extensions to core classes
|
106
118
|
test_files: []
|
119
|
+
|