play_solder 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -1
- data/VERSION +1 -1
- data/lib/play_solder.rb +1 -0
- data/lib/play_solder/fake.rb +6 -0
- data/lib/play_solder/image.rb +1 -1
- data/lib/play_solder/swf.rb +16 -0
- data/placeholder.swf +0 -0
- data/play_solder.gemspec +4 -2
- data/spec/play_solder_spec.rb +18 -0
- metadata +6 -4
data/README.md
CHANGED
@@ -24,6 +24,13 @@ If you're using [Homebrew](http://github.com/mxcl/homebrew) (and if you're not,
|
|
24
24
|
> PlaySolder::Image.auto_resize(/thumbnail/ => "100x75")
|
25
25
|
> path_to_created_file = PlaySolder::Fake.for_path("thumbnail_1.png").generate
|
26
26
|
|
27
|
+
|
28
|
+
## Authors
|
29
|
+
|
30
|
+
Brad Wilson - http://github.com/bradx3
|
31
|
+
Keith Pitty - http://github.com/keithpitty
|
32
|
+
Rob Chisolm - rawb at iinet.com.au
|
33
|
+
|
27
34
|
## Note on Patches/Pull Requests
|
28
35
|
|
29
36
|
* Fork the project.
|
@@ -39,4 +46,3 @@ If you're using [Homebrew](http://github.com/mxcl/homebrew) (and if you're not,
|
|
39
46
|
Copyright (c) 2010 Brad Wilson. See LICENSE for details.
|
40
47
|
|
41
48
|
|
42
|
-
[1]: http://github.com/mxcl/homebrew "Homebrew"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/play_solder.rb
CHANGED
data/lib/play_solder/fake.rb
CHANGED
@@ -12,6 +12,8 @@ module PlaySolder
|
|
12
12
|
Image.new(path)
|
13
13
|
elsif MP3::EXTENSIONS.include?(ext)
|
14
14
|
MP3.new(path)
|
15
|
+
elsif Swf::EXTENSIONS.include?(ext)
|
16
|
+
Swf.new(path)
|
15
17
|
else
|
16
18
|
raise UnfakeablePathException.new("Can't fake #{ path }")
|
17
19
|
end
|
@@ -31,6 +33,10 @@ module PlaySolder
|
|
31
33
|
@text ||= File.basename(path).gsub(extension, "")
|
32
34
|
end
|
33
35
|
|
36
|
+
def escaped_faked_file
|
37
|
+
@escaped_faked_file ||= faked_file.gsub("\"", "\\\"")
|
38
|
+
end
|
39
|
+
|
34
40
|
def faked_file
|
35
41
|
if @faked_file.nil?
|
36
42
|
@faked_file = "/tmp/play_solder/#{ path }"
|
data/lib/play_solder/image.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
module PlaySolder
|
2
|
+
class Swf < Fake
|
3
|
+
EXTENSIONS = [ ".swf" ]
|
4
|
+
|
5
|
+
def generate
|
6
|
+
return faked_file if File.exist?(faked_file)
|
7
|
+
swf = File.join(File.dirname(__FILE__), "..", "..", "placeholder.swf")
|
8
|
+
FileUtils.copy(swf, faked_file)
|
9
|
+
faked_file
|
10
|
+
end
|
11
|
+
|
12
|
+
def mime_type
|
13
|
+
"application/x-shockwave-flash"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/placeholder.swf
ADDED
Binary file
|
data/play_solder.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{play_solder}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brad Wilson"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-08}
|
13
13
|
s.description = %q{Create mock image and mp3 files}
|
14
14
|
s.email = %q{brad@lucky-dip.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -27,6 +27,8 @@ Gem::Specification.new do |s|
|
|
27
27
|
"lib/play_solder/fake.rb",
|
28
28
|
"lib/play_solder/image.rb",
|
29
29
|
"lib/play_solder/mp3.rb",
|
30
|
+
"lib/play_solder/swf.rb",
|
31
|
+
"placeholder.swf",
|
30
32
|
"play_solder.gemspec",
|
31
33
|
"spec/play_solder_spec.rb",
|
32
34
|
"spec/spec.opts",
|
data/spec/play_solder_spec.rb
CHANGED
@@ -16,6 +16,10 @@ describe PlaySolder::Fake, "for_path" do
|
|
16
16
|
it "should return an mp3 for mp3s" do
|
17
17
|
PlaySolder::Fake.for_path("test.mp3").class.should == PlaySolder::MP3
|
18
18
|
end
|
19
|
+
|
20
|
+
it "should return a swf for swfs" do
|
21
|
+
PlaySolder::Fake.for_path("test.swf").class.should == PlaySolder::Swf
|
22
|
+
end
|
19
23
|
|
20
24
|
it "should raise an error for other types" do
|
21
25
|
lambda { PlaySolder::Fake.for_path("test.blah") }.should raise_error(PlaySolder::UnfakeablePathException)
|
@@ -71,3 +75,17 @@ describe PlaySolder::MP3 do
|
|
71
75
|
File.exist?(@file).should be_true
|
72
76
|
end
|
73
77
|
end
|
78
|
+
|
79
|
+
describe PlaySolder::Swf do
|
80
|
+
before do
|
81
|
+
@file = PlaySolder::Swf.new("A test swf.swf").generate
|
82
|
+
end
|
83
|
+
|
84
|
+
after(:all) do
|
85
|
+
File.delete(@file) if @file
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should create a file" do
|
89
|
+
File.exist?(@file).should be_true
|
90
|
+
end
|
91
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: play_solder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brad Wilson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-08 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -54,6 +54,8 @@ files:
|
|
54
54
|
- lib/play_solder/fake.rb
|
55
55
|
- lib/play_solder/image.rb
|
56
56
|
- lib/play_solder/mp3.rb
|
57
|
+
- lib/play_solder/swf.rb
|
58
|
+
- placeholder.swf
|
57
59
|
- play_solder.gemspec
|
58
60
|
- spec/play_solder_spec.rb
|
59
61
|
- spec/spec.opts
|