swftly 0.1.4 → 0.1.42

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGQyMmRiMmRhNWRmMTE0Njk5ODQ0MWRkOTM5MDkyOWUwZTRlYzUxMg==
4
+ OTIyOTlkNzg1NjIyYzdmOWE5NjhkNTIwMmE0YzI0YTNiYzI0YWE1Yw==
5
5
  data.tar.gz: !binary |-
6
- ZTU3NjFjZjBjMjZhZDYyMTUyZTBhMTYxYzI5Njk5NGRkN2E4NTZjYQ==
6
+ ZTUyZmJjZDMzODJmOTlkZjg5NzYwMzljNTdiZDBhZGQwNTFhOWNhYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjVkYjhiODFmY2JmN2VhZmViYTdiYTk4NTBjODRlMjcwN2RhMDdhMmM4ZTdj
10
- MmZhYjVkYjM3YmQ3NzY1N2ZmN2I1MTE4MGI0ODI5OTI4ODEwMmRkZWViYmEx
11
- MGMzMTQ0MWE3NDY0MTQ3ZGY2OTA0MzkzODFhMGMxN2U1ZGI4MTc=
9
+ ZGYyYzFiMGRlNjAzOWM5YzMwMDJhMjJiODQ0YWU4NmU0ZTFjNmVmYmM5ZTI4
10
+ NTk2NDIyYzE0NWFkNmJlODQ5ZGU4YjBiNjc1MjE0YzNlYmU2OTI5NDZhMGY2
11
+ OGVkZDA4ZjIyZWI3ZGUxODUwNmFlMWQ5YjZlMTdlNDdkYWEwZGE=
12
12
  data.tar.gz: !binary |-
13
- Mjc2MjM5NDgwYmVmMDA1Y2ZlZmM1MDg2ZGE3NTZiNDY4MDM5NzkxYzlkMmVi
14
- ZTllMWM2OTQzOGNhZTIxMGEzYzA1ZWVkZThmODY0OTQ3OWIwYzVjMDRhOTFj
15
- YzQzNTc4ZGFkMmI4OGU0ZTQ4ZTdlNzZhNDIyYTk4NTZjZmRhYTg=
13
+ YzNmM2Y0OGM3MzRlNmQzNmQyZWUxOWVjMWQ2MDFiMzA3YzZiN2NmZDlmYjdi
14
+ MzZiODZiYWQ1NDk3ZDcxMjMzOGRhYWI5MTUxNDY4YjQxNDU4MGM1Y2UzNTgz
15
+ YzAyZmUyYTg4YjdhNTE0NjcwMzdmYjdhYzE2YWJiZjJlZDcwMmI=
@@ -0,0 +1,3 @@
1
+ Gemfile.lock
2
+ .DS_Store
3
+
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ The MIT License (MIT)
2
+ Copyright © 2013 Jeremy Flores
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5
+ documentation files (the “Software”), to deal in the Software without restriction, including without
6
+ limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
8
+ conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial
11
+ portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
14
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
15
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
16
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
17
+ OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,66 @@
1
+ # Swftly - I don't like swf files.
2
+
3
+ Swftly is a tiny gem that abstracts interactions with Google's Swiffy service, which does a decent job of providing a Javascript-driven equivalent/alternative to a swf file. This project came about because I needed to push something like 6,000 individual swfs through Swiffy. I guess I could have used [Google's Flash extension](https://www.google.com/doubleclick/studio/swiffy/extension.html), but making a gem seemed like more fun.
4
+
5
+ * [Github project](http://github.com/jnf/swftly)
6
+ * [Read bout Swiffy](https://www.google.com/doubleclick/studio/swiffy/)
7
+
8
+ ## License
9
+
10
+ Check the LICENSE file.
11
+
12
+ ## Dependencies
13
+
14
+ * [Curb](https://rubygems.org/gems/curb)
15
+ * [Rspec (only for development)](http://rspec.info/)
16
+
17
+ ## Installation...
18
+
19
+ $ gem install swftly
20
+
21
+ Or, in your Gemfile:
22
+
23
+ gem 'swftly'
24
+
25
+ ### Using Swftly
26
+
27
+ ```ruby
28
+ the_swf = '/absolute/path/to/yourfile.swf'
29
+ swftly = Swftly.new(the_swf) #fire her up
30
+ swftly.swiff #send the_swf off to Google's hosted service for conversion
31
+
32
+ #the runtime class has info about Swiffy's client-side runtime.js
33
+ swftly.runtime.version #=> "v5.2"
34
+ swftly.runtime.url #=> "https://www.gstatic.com/swiffy/v5.2/runtime.js"
35
+
36
+ #the converted class lets you work with the markup/javascript generated by Swiffy
37
+ swftly.converted.markup #=> returns the complete html document generated by Swiffy
38
+ swftly.converted.json_definition #=> returns just the javascript that creates the swiffyobject json object
39
+
40
+ #Without auto_processig
41
+ the_swf = '/absolute/path/to/yourfile.swf'
42
+ swftly = Swftly.new(the_swf, false) #don't auto process
43
+ swftly.swiff #send the_swf off to Google's hosted service for conversion
44
+
45
+ if swftly.converter_response_code == 200 #success!
46
+ swftly.process! #buildout the Runtime and Converted stuffs
47
+ ...
48
+ #do some persistence or rendering or whatevs
49
+ else
50
+ ...
51
+ #do something fancy here like raise a warning or requeue
52
+ end
53
+
54
+ ```
55
+
56
+ ### Under the Hood
57
+
58
+ Swftly takes two arguments, both optional, when instantiating. The first is a String representing the path to a swf file and is accessible on the object as `swf_path`. The second, available on the object as `auto_process`, is a boolean that, when true, automatically triggers post-processing the conversion result. This post-processing creates and populates the Runtime and Converted class objects.
59
+
60
+ If `auto_process` is false, calling `Swftly#swiff` will post the swf to Swiffy and set `Swftly.converter_response_code` and `Swftly.raw`. This is helpful if you're batching many swfs for conversion because it allows for confirmation of a successful conversion (response code == 200) before trying to do any of the post-processing.
61
+
62
+ Also, both `swf_path` and `auto_process` are attr_accessible. Setting a new swf_path and calling `Swftly#swiff` will generate a new set of conversion data, allowing one instance to perform many conversions.
63
+
64
+ ### Development & Contact
65
+
66
+ Please feel free to contribute fixes and features via fork'n'pull. Drop tests into spec/. If you wanna talk about Swftly (or most anything else, really), I'm most reachable at [@_jnf](http://www.twitter.com/_jnf).
@@ -0,0 +1,6 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new('spec')
4
+
5
+ task :default => :spec
6
+
@@ -0,0 +1,13 @@
1
+ class Converted
2
+ MATCHER = /swiffyobject\s*?=\s*?(\{.*\})/
3
+ attr_reader :markup, :json_blob
4
+
5
+ def initialize(markup)
6
+ @markup = markup
7
+ end
8
+
9
+ def json_definition
10
+ @json_blob ||= @markup.match(MATCHER).to_s
11
+ @json_blob
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Converted do
4
+ it "should isolate the json necessary to execute the converted interactions" do
5
+ basepath = File.dirname(__FILE__)
6
+ path = "#{basepath}/fixtures/files/test.swf"
7
+ data = File.read("#{basepath}/fixtures/files/json_definition_test")
8
+
9
+ swftly = Swftly.new path
10
+ VCR.use_cassette('swiff_and_process') do
11
+ swftly.swiff
12
+ end
13
+
14
+ swftly.converted.should_not be_nil
15
+ swftly.converted.json_definition.should eql(data)
16
+ end
17
+ end
@@ -0,0 +1,149 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.google.com/doubleclick/studio/swiffy/upload
6
+ body:
7
+ encoding: US-ASCII
8
+ string: swfFile=%2FUsers%2Fjeremy%2Fprojects%2Fswftly%2Fspec%2Ffixtures%2Ffiles%2Ftest.swf
9
+ headers:
10
+ User-Agent:
11
+ - Curl/Ruby
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: !binary |-
16
+ T0s=
17
+ headers:
18
+ !binary "Q29udGVudC1UeXBl":
19
+ - !binary |-
20
+ dGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04
21
+ !binary "VmFyeQ==":
22
+ - !binary |-
23
+ QWNjZXB0LUVuY29kaW5n
24
+ !binary "RGF0ZQ==":
25
+ - !binary |-
26
+ U3VuLCAyMSBKdWwgMjAxMyAxOTo1NToyNiBHTVQ=
27
+ !binary "U2VydmVy":
28
+ - !binary |-
29
+ R29vZ2xlIEZyb250ZW5k
30
+ !binary "Q2FjaGUtQ29udHJvbA==":
31
+ - !binary |-
32
+ cHJpdmF0ZQ==
33
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
34
+ - !binary |-
35
+ Y2h1bmtlZA==
36
+ body:
37
+ encoding: ASCII-8BIT
38
+ string: !binary |-
39
+ Ly9PS1s3OTcsMS4wNzMyNDIxODc1LDAuODUzNTE1NjI1LDcsNiwwLDUsNCwz
40
+ LDM2MywwLDIsMSxbIjUiLCJhYTY1YTEyYS03M2NlLTRhZDgtOTAyNy0wODNi
41
+ ZDdhMjM1YmEiLCIlMkZVc2VycyUyRmplcmVteSUyRnByb2plY3RzJTJGc3dm
42
+ dGx5JTJGc3BlYyUyRmZpeHR1cmVzJTJGZmlsZXMlMkZ0ZXN0LnN3ZiIsImh0
43
+ dHBzOi8vc3dpZmZ5cHJldmlld3MuZ29vZ2xldXNlcmNvbnRlbnQuY29tL3Zp
44
+ ZXcvaS9hYTY1YTEyYS03M2NlLTRhZDgtOTAyNy0wODNiZDdhMjM1YmEvIiwi
45
+ ZSIsIiUyRlVzZXJzJTJGamVyZW15JTJGcHJvamVjdHMlMkZzd2Z0bHklMkZz
46
+ cGVjJTJGZml4dHVyZXMlMkZmaWxlcyUyRnRlc3QuaHRtbCIsImh0dHBzOi8v
47
+ c3dpZmZ5cHJldmlld3MuZ29vZ2xldXNlcmNvbnRlbnQuY29tL3ZpZXcvby9h
48
+ YTY1YTEyYS03M2NlLTRhZDgtOTAyNy0wODNiZDdhMjM1YmEvIl0sMSw3XQ==
49
+ http_version:
50
+ recorded_at: Sun, 21 Jul 2013 19:55:30 GMT
51
+ - request:
52
+ method: get
53
+ uri: https://swiffypreviews.googleusercontent.com/view/o/aa65a12a-73ce-4ad8-9027-083bd7a235ba/%2FUsers%2Fjeremy%2Fprojects%2Fswftly%2Fspec%2Ffixtures%2Ffiles%2Ftest.html
54
+ body:
55
+ encoding: US-ASCII
56
+ string: ''
57
+ headers: {}
58
+ response:
59
+ status:
60
+ code: 200
61
+ message: !binary |-
62
+ T0s=
63
+ headers:
64
+ !binary "RXhwaXJlcw==":
65
+ - !binary |-
66
+ U3VuLCAyMSBKdWwgMjAxMyAyMDoxMDoyNiBHTVQ=
67
+ !binary "Q2FjaGUtQ29udHJvbA==":
68
+ - !binary |-
69
+ cHVibGljLCBtYXgtYWdlPTkwMA==
70
+ !binary "Q29udGVudC1UeXBl":
71
+ - !binary |-
72
+ dGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04
73
+ !binary "VmFyeQ==":
74
+ - !binary |-
75
+ QWNjZXB0LUVuY29kaW5n
76
+ !binary "RGF0ZQ==":
77
+ - !binary |-
78
+ U3VuLCAyMSBKdWwgMjAxMyAxOTo1NToyNiBHTVQ=
79
+ !binary "U2VydmVy":
80
+ - !binary |-
81
+ R29vZ2xlIEZyb250ZW5k
82
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
83
+ - !binary |-
84
+ Y2h1bmtlZA==
85
+ body:
86
+ encoding: ASCII-8BIT
87
+ string: !binary |-
88
+ PCFkb2N0eXBlIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPG1ldGEgY2hh
89
+ cnNldD0idXRmLTgiPgogICAgPG1ldGEgaHR0cC1lcXVpdj0iWC1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ICA8Ym9keSBzdHlsZT0ibWFy
140
+ Z2luOiAwOyBvdmVyZmxvdzogaGlkZGVuIj4KICAgIDxkaXYgaWQ9InN3aWZm
141
+ eWNvbnRhaW5lciIgc3R5bGU9IndpZHRoOiA3OTdweDsgaGVpZ2h0OiAzNjNw
142
+ eCI+CiAgICA8L2Rpdj4KICAgIDxzY3JpcHQ+CiAgICAgIAogICAgICB2YXIg
143
+ c3RhZ2UgPSBuZXcgc3dpZmZ5LlN0YWdlKGRvY3VtZW50LmdldEVsZW1lbnRC
144
+ eUlkKCdzd2lmZnljb250YWluZXInKSwKICAgICAgICAgICAgICAgICAgICAg
145
+ ICAgICAgICAgICAgICBzd2lmZnlvYmplY3QpOwogICAgICAKICAgICAgc3Rh
146
+ Z2Uuc3RhcnQoKTsKICAgIDwvc2NyaXB0PgogIDwvYm9keT4KPC9odG1sPgo=
147
+ http_version:
148
+ recorded_at: Sun, 21 Jul 2013 19:55:30 GMT
149
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://www.google.com/doubleclick/studio/swiffy/upload
6
+ body:
7
+ encoding: US-ASCII
8
+ string: swfFile=%2FUsers%2Fjeremy%2Fprojects%2Fswftly%2Fspec%2Ffixtures%2Ffiles%2Ftest.swf
9
+ headers:
10
+ User-Agent:
11
+ - Curl/Ruby
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: !binary |-
16
+ T0s=
17
+ headers:
18
+ !binary "Q29udGVudC1UeXBl":
19
+ - !binary |-
20
+ dGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04
21
+ !binary "VmFyeQ==":
22
+ - !binary |-
23
+ QWNjZXB0LUVuY29kaW5n
24
+ !binary "RGF0ZQ==":
25
+ - !binary |-
26
+ U3VuLCAyMSBKdWwgMjAxMyAyMDowNjowMyBHTVQ=
27
+ !binary "U2VydmVy":
28
+ - !binary |-
29
+ R29vZ2xlIEZyb250ZW5k
30
+ !binary "Q2FjaGUtQ29udHJvbA==":
31
+ - !binary |-
32
+ cHJpdmF0ZQ==
33
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
34
+ - !binary |-
35
+ Y2h1bmtlZA==
36
+ body:
37
+ encoding: ASCII-8BIT
38
+ string: !binary |-
39
+ Ly9PS1s3OTcsMS4wNzMyNDIxODc1LDAuODUzNTE1NjI1LDcsNiwwLDUsNCwz
40
+ LDM2MywwLDIsMSxbIjUiLCI5Zjk4OWM3ZS0xZDNlLTRmZjMtOTk0OS0wOWY5
41
+ MTRiNjVhYWEiLCIlMkZVc2VycyUyRmplcmVteSUyRnByb2plY3RzJTJGc3dm
42
+ dGx5JTJGc3BlYyUyRmZpeHR1cmVzJTJGZmlsZXMlMkZ0ZXN0LnN3ZiIsImh0
43
+ dHBzOi8vc3dpZmZ5cHJldmlld3MuZ29vZ2xldXNlcmNvbnRlbnQuY29tL3Zp
44
+ ZXcvaS85Zjk4OWM3ZS0xZDNlLTRmZjMtOTk0OS0wOWY5MTRiNjVhYWEvIiwi
45
+ ZSIsIiUyRlVzZXJzJTJGamVyZW15JTJGcHJvamVjdHMlMkZzd2Z0bHklMkZz
46
+ cGVjJTJGZml4dHVyZXMlMkZmaWxlcyUyRnRlc3QuaHRtbCIsImh0dHBzOi8v
47
+ c3dpZmZ5cHJldmlld3MuZ29vZ2xldXNlcmNvbnRlbnQuY29tL3ZpZXcvby85
48
+ Zjk4OWM3ZS0xZDNlLTRmZjMtOTk0OS0wOWY5MTRiNjVhYWEvIl0sMSw3XQ==
49
+ http_version:
50
+ recorded_at: Sun, 21 Jul 2013 20:06:07 GMT
51
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,101 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://swiffypreviews.googleusercontent.com/view/o/9f989c7e-1d3e-4ff3-9949-09f914b65aaa/%2FUsers%2Fjeremy%2Fprojects%2Fswftly%2Fspec%2Ffixtures%2Ffiles%2Ftest.html
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: !binary |-
14
+ T0s=
15
+ headers:
16
+ !binary "RXhwaXJlcw==":
17
+ - !binary |-
18
+ U3VuLCAyMSBKdWwgMjAxMyAyMDoyMTowMyBHTVQ=
19
+ !binary "Q2FjaGUtQ29udHJvbA==":
20
+ - !binary |-
21
+ cHVibGljLCBtYXgtYWdlPTkwMA==
22
+ !binary "Q29udGVudC1UeXBl":
23
+ - !binary |-
24
+ dGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04
25
+ !binary "VmFyeQ==":
26
+ - !binary |-
27
+ QWNjZXB0LUVuY29kaW5n
28
+ !binary "RGF0ZQ==":
29
+ - !binary |-
30
+ U3VuLCAyMSBKdWwgMjAxMyAyMDowNjowMyBHTVQ=
31
+ !binary "U2VydmVy":
32
+ - !binary |-
33
+ R29vZ2xlIEZyb250ZW5k
34
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
35
+ - !binary |-
36
+ Y2h1bmtlZA==
37
+ body:
38
+ encoding: ASCII-8BIT
39
+ string: !binary |-
40
+ PCFkb2N0eXBlIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPG1ldGEgY2hh
41
+ cnNldD0idXRmLTgiPgogICAgPG1ldGEgaHR0cC1lcXVpdj0iWC1VQS1Db21w
42
+ YXRpYmxlIiBjb250ZW50PSJJRT1lZGdlIj4KICAgIDx0aXRsZT5Td2lmZnkg
43
+ b3V0cHV0PC90aXRsZT4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL3d3dy5n
44
+ c3RhdGljLmNvbS9zd2lmZnkvdjUuMi9ydW50aW1lLmpzIj48L3NjcmlwdD4K
45
+ CiAgICA8c2NyaXB0PgogICAgICBzd2lmZnlvYmplY3QgPSB7ImludGVybmVk
46
+ U3RyaW5ncyI6WyJQQUNLQUdFIl0sInRhZ3MiOlt7ImZyYW1lcyI6W10sInNj
47
+ ZW5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gICAgICAg
97
+ ICAgICAgICAgICAgICBzd2lmZnlvYmplY3QpOwogICAgICAKICAgICAgc3Rh
98
+ Z2Uuc3RhcnQoKTsKICAgIDwvc2NyaXB0PgogIDwvYm9keT4KPC9odG1sPgo=
99
+ http_version:
100
+ recorded_at: Sun, 21 Jul 2013 20:06:07 GMT
101
+ recorded_with: VCR 2.4.0
@@ -0,0 +1 @@
1
+ swiffyobject = {"internedStrings":["PACKAGE"],"tags":[{"frames":[],"scenes":[{"name":"Scene 1","offset":0}],"type":23},{"classes":[{"ns":3,"cinit":0,"ctraits":[],"name":1,"init":2,"traits":[{"name":3,"value":1,"kind":"methods"}],"supertype":2}],"methods":[{"exceptions":[],"locals":1,"traits":[],"params":[],"code":"0DBH","type":0,"optionals":[]},{"exceptions":[],"locals":1,"traits":[],"params":[],"code":"0DBdBE8EANBdBWAFZgYmSgUCTwcBRw\u003d\u003d","type":0,"optionals":[]},{"exceptions":[],"locals":1,"traits":[],"params":[],"code":"0DDQSQBdCCQB0GYDTwgCRw\u003d\u003d","type":0,"optionals":[]},{"exceptions":[],"locals":1,"traits":[],"params":[],"code":"0DBlAGAJMGAKMGALMGAMMGANMGAOMGACMGACWAAdHR0dHR0daAFH","type":0,"optionals":[]}],"scripts":[{"init":3,"traits":[{"writable":true,"name":1,"value":0,"slot":1,"kind":"classes"}]}],"multinames":[{"ns":1,"name":2,"kind":7},{"ns":2,"name":4,"kind":7},{"ns":4,"name":6,"kind":7},{"ns":5,"name":8,"kind":7},{"ns":6,"name":10,"kind":7},{"ns":5,"name":11,"kind":7},{"ns":5,"name":12,"kind":7},{"ns":5,"name":13,"kind":7},{"ns":5,"name":14,"kind":7},{"ns":6,"name":15,"kind":7},{"ns":2,"name":16,"kind":7},{"ns":2,"name":17,"kind":7},{"ns":2,"name":18,"kind":7},{"ns":2,"name":19,"kind":7}],"namespacesets":[],"strings":["","EventOnly_fla","MainTimeline","flash.display","MovieClip","EventOnly_fla:MainTimeline","frame2","","stop","flash.events","Event","COMPLETE","dispatchEvent","addFrameScript","Object","EventDispatcher","DisplayObject","InteractiveObject","DisplayObjectContainer","Sprite"],"type":18,"uints":[0],"ints":[0],"namespaces":[{"name":1,"kind":"#0"},{"name":3,"kind":"#0"},{"name":5,"kind":"PROTECTED"},{"name":1,"kind":"PACKAGE_INTERNAL"},{"name":7,"kind":"#0"},{"name":9,"kind":"#0"}]},{"references":[{"id":0,"name":"EventOnly_fla.MainTimeline"}],"type":19},{"type":2},{"type":2}],"fileSize":874,"v":"5.2.0","backgroundColor":-1,"frameSize":{"ymin":0,"ymax":7260,"xmin":0,"xmax":15940},"frameCount":2,"frameRate":24,"version":15}
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Runtime do
4
+ it "should return the version of the runtime supplied by Google" do
5
+ path = File.dirname(__FILE__) + '/fixtures/files/test.swf'
6
+ swftly = Swftly.new path
7
+ VCR.use_cassette('swiff_and_process') do
8
+ swftly.swiff
9
+ end
10
+
11
+ swftly.runtime.should_not be_nil
12
+ swftly.runtime.version.should eql("v5.2")
13
+ end
14
+
15
+ it "should provide a complete url to the cdn-provided version of the runtime" do
16
+ path = File.dirname(__FILE__) + '/fixtures/files/test.swf'
17
+ swftly = Swftly.new path
18
+ VCR.use_cassette('swiff_and_process') do
19
+ swftly.swiff
20
+ end
21
+
22
+ swftly.runtime.should_not be_nil
23
+ swftly.runtime.url.should eql("https://www.gstatic.com/swiffy/v5.2/runtime.js")
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'webmock/rspec'
4
+ require 'vcr'
5
+ require 'swftly'
6
+
7
+ VCR.configure do |c|
8
+ c.cassette_library_dir = 'spec/fixtures/cassettes'
9
+ c.hook_into :webmock
10
+ end
11
+
12
+ # This file was generated by the `rspec --init` command. Conventionally, all
13
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
14
+ # Require this file using `require "spec_helper"` to ensure that it is only
15
+ # loaded once.
16
+ #
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ config.treat_symbols_as_metadata_keys_with_true_values = true
20
+ config.run_all_when_everything_filtered = true
21
+ config.filter_run :focus
22
+
23
+ # Run specs in random order to surface order dependencies. If you find an
24
+ # order dependency and want to debug it, you can fix the order by providing
25
+ # the seed, which is printed after each run.
26
+ # --seed 1234
27
+ config.order = 'random'
28
+ end
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ describe Swftly do
4
+ it "shouldn't require any variables to successfully instantiate" do
5
+ swftly = Swftly.new
6
+ swftly.should_not be_nil
7
+ end
8
+
9
+ it "should be able to reassign swf_path on demand" do
10
+ swftly = Swftly.new
11
+ swftly.swf_path.should be_empty
12
+ swftly.swf_path = "test/path"
13
+ swftly.swf_path.should eql('test/path')
14
+ end
15
+
16
+ it "should submit the specified swf to Swiffy" do
17
+ path = File.dirname(__FILE__) + '/fixtures/files/test.swf'
18
+ swftly = Swftly.new path
19
+ VCR.use_cassette('swiff_and_process') do
20
+ swftly.swiff
21
+ end
22
+
23
+ #conversion (cassette or real) should work
24
+ swftly.converter_response_code.should eql(200)
25
+ swftly.raw.should_not be_empty
26
+
27
+ #and since auto_process is true, we should have populated runtime and converted
28
+ swftly.fetcher_response_code.should eql(200)
29
+ swftly.runtime.should_not be_nil
30
+ swftly.converted.should_not be_nil
31
+
32
+ end
33
+
34
+ it "should wait on post-processing if auto_process is false" do
35
+ path = File.dirname(__FILE__) + '/fixtures/files/test.swf'
36
+ swftly = Swftly.new path, false #no autoprocessing
37
+ VCR.use_cassette('swiff_no_process') do
38
+ swftly.swiff
39
+ end
40
+
41
+ #conversion (cassette or real) should work
42
+ swftly.converter_response_code.should eql(200)
43
+ swftly.raw.should_not be_empty
44
+
45
+ #but runtime and converted should not exist yet
46
+ swftly.runtime.should be_nil
47
+ swftly.converted.should be_nil
48
+
49
+ VCR.use_cassette('swiff_process!') do
50
+ swftly.process! #trigger post-processing
51
+ end
52
+
53
+ #now we should have all the other stuff
54
+ swftly.fetcher_response_code.should eql(200)
55
+ swftly.runtime.should_not be_nil
56
+ swftly.converted.should_not be_nil
57
+ end
58
+ end
@@ -0,0 +1,22 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'swftly'
3
+ spec.version = '0.1.42'
4
+ spec.summary = "swftly abstracts and automates interactions with Swiffy, Google's hosted swf converter."
5
+ spec.description = "swftly abstracts and automates interactions with Swiffy, Google's hosted swf converter."
6
+ spec.platform = Gem::Platform::RUBY
7
+ spec.files = `git ls-files`.split("\n")
8
+ spec.test_files = `git ls-files -- {spec,features}/*`.split("\n")
9
+ spec.require_paths = %w(lib)
10
+ spec.authors = ["jnf"]
11
+ spec.email = 'jeremy.flores@gmail.com'
12
+ spec.homepage = 'https://github.com/jnf/swftly'
13
+ spec.license = 'MIT'
14
+
15
+ #for always
16
+ spec.add_dependency "curb", "~> 0.8.4" #we'll use curl to talk to swiffy
17
+
18
+ #for dev/testing
19
+ spec.add_development_dependency "rspec"
20
+ spec.add_development_dependency "vcr"
21
+ spec.add_development_dependency "webmock"
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swftly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - jnf
@@ -73,8 +73,25 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - .gitignore
77
+ - .rspec
78
+ - Gemfile
79
+ - LICENSE
80
+ - README.markdown
81
+ - Rakefile
76
82
  - lib/swftly.rb
83
+ - lib/swftly/converted.rb
77
84
  - lib/swftly/runtime.rb
85
+ - spec/converted_spec.rb
86
+ - spec/fixtures/cassettes/swiff_and_process.yml
87
+ - spec/fixtures/cassettes/swiff_no_process.yml
88
+ - spec/fixtures/cassettes/swiff_process_.yml
89
+ - spec/fixtures/files/json_definition_test
90
+ - spec/fixtures/files/test.swf
91
+ - spec/runtime_spec.rb
92
+ - spec/spec_helper.rb
93
+ - spec/swftly_spec.rb
94
+ - swftly.gemspec
78
95
  homepage: https://github.com/jnf/swftly
79
96
  licenses:
80
97
  - MIT
@@ -100,4 +117,13 @@ signing_key:
100
117
  specification_version: 4
101
118
  summary: swftly abstracts and automates interactions with Swiffy, Google's hosted
102
119
  swf converter.
103
- test_files: []
120
+ test_files:
121
+ - spec/converted_spec.rb
122
+ - spec/fixtures/cassettes/swiff_and_process.yml
123
+ - spec/fixtures/cassettes/swiff_no_process.yml
124
+ - spec/fixtures/cassettes/swiff_process_.yml
125
+ - spec/fixtures/files/json_definition_test
126
+ - spec/fixtures/files/test.swf
127
+ - spec/runtime_spec.rb
128
+ - spec/spec_helper.rb
129
+ - spec/swftly_spec.rb