f2h 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a64482627b170ed10b576eb0ffaf51b9f1584b7
4
+ data.tar.gz: 3f0e18d4508f97f88e7bbd7e872d37e8eae364fc
5
+ SHA512:
6
+ metadata.gz: b6c533ea3ad794ffa3fbd69145a3ec3b43810a6462256edd4c8d68288be30dfc4d5262f99b2d4b52929ff1c11dace9a0f08494bd1d124906877b9a539a44a2a3
7
+ data.tar.gz: 5294be14f4144fb97937b29705bfbb75d705319ba84fd06c42406dd1fe62294001f13422e25244810eebe26b0b031054b3367662ff583a36fe3a9dce47cf0a50
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in f2h.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ismail Kalimi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ismail Kalimi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Flash2HTML
2
+ Boilerplate code that provides sane default settings when making html5 assets using html,css and js from Flash creatives
3
+
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'f2h'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install f2h
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ismk/Flash2HTML. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
34
+
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
39
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "f2h"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/f2h ADDED
@@ -0,0 +1,7 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'f2h'
4
+
5
+ chatter = F2h::Flash2HTML.new
6
+
7
+ chatter.main
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/f2h.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'f2h/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "f2h"
8
+ spec.version = F2h::VERSION
9
+ spec.authors = ["Ismail Kalimi"]
10
+ spec.email = ["ismailkalimi@gmail.com"]
11
+
12
+ spec.summary = %q{Generates boilerplate code for HTML5 creatives from Flash files}
13
+ spec.description = %q{This just generates and downloads sane defaults for html5 animations from Flash}
14
+ spec.homepage = "https://ikalimi.com/flash2html"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "bin"
27
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.executables = ["f2h"]
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_dependency "rmagick"
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.10"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec"
36
+ end
@@ -0,0 +1,3 @@
1
+ module F2h
2
+ VERSION = "0.9.0"
3
+ end
data/lib/f2h.rb ADDED
@@ -0,0 +1,509 @@
1
+ require "f2h/version"
2
+ require 'rmagick'
3
+
4
+ module F2h
5
+ class Flash2HTML
6
+
7
+ #===================== BOX BOILERPLATE ==============================
8
+
9
+ def html_boilerplate(foldername, type)
10
+ <<eos
11
+ <!DOCTYPE html>
12
+ <html lang="en">
13
+ <head>
14
+ <meta charset="UTF-8">
15
+ <title></title>
16
+ <link rel="stylesheet" href="css/#{foldername}_#{type}.css">
17
+ <script src="js/jquery.min.js"></script>
18
+ <script src="js/TweenMax.min.js"></script>
19
+ <script src="js/#{foldername}_#{type}.js"></script>
20
+ </head>
21
+ <body>
22
+
23
+
24
+ <!-- Start-of-the-Image-Tags -->
25
+ <!-- End-of-the-Image-Tags -->
26
+
27
+ <!-- Start-of-the-ISI -->
28
+ <div id="isi"></div>
29
+ <!-- End-of-the-ISI -->
30
+
31
+ </body>
32
+ </html>
33
+ eos
34
+ end
35
+
36
+ def box_css_boilerplate
37
+ <<eos
38
+ body{
39
+ position: fixed;
40
+ padding: 0;
41
+ margin: 0;
42
+ top: 0;
43
+ left: 0;
44
+ }
45
+
46
+ #overall_mask{
47
+ position: absolute;
48
+ height: 250px;
49
+ width: 300px;
50
+ }
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+ /* Start-of-the-ISI */
59
+ #isi{
60
+ position: absolute;
61
+ background-color: white;
62
+ top: 250px;
63
+ width: 300px;
64
+ height: 76px;
65
+ font-size: 12px;
66
+ overflow-y: scroll;
67
+ overflow-x: hidden;
68
+ font-family: "Arial-Narrow";
69
+ padding-left: 5px;
70
+ }
71
+
72
+ #isi::-webkit-scrollbar {
73
+ width: 20px;
74
+ }
75
+
76
+ #isi::-webkit-scrollbar-track {
77
+ background-image: url();
78
+ background-position: center;
79
+ background-repeat: no-repeat;
80
+ background-size: 4px 97%;
81
+ }
82
+
83
+ #isi::-webkit-scrollbar-thumb {
84
+ height: 25px;
85
+ background-image: url();
86
+ background-position: center;
87
+ background-repeat: no-repeat;
88
+ }
89
+ /* End-of-the-ISI */
90
+
91
+ eos
92
+ end
93
+
94
+ def box_js_boilerplate
95
+ <<eos
96
+ $(function(){
97
+ // WebViewCommunicator.sendJavascriptTo("main", "javascript:appRouter.homeView.flashAdImpressionTrack('box-ad')");
98
+
99
+ //Start-of-the-animation-code
100
+ //End-of-the-animation-code
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+ function autoScroll(){
117
+ ascroll = setInterval(function(){
118
+ elem = $("#isi")[0];
119
+ if (elem.scrollTop != 1075){
120
+ elem.scrollTop += 2;
121
+ }
122
+ }, 200);
123
+ }
124
+
125
+ $(document).on("touchstart", "#isi", function(){
126
+ clearInterval(ascroll);
127
+ });
128
+
129
+
130
+ $("#overall_mask").on("click", function(){
131
+ console.log("overall mask was clicked");
132
+ WebViewCommunicator.sendJavascriptTo("main", "javascript:appRouter.homeView.openChildBrowser('', '<div data-advtype=box-mainClickThrough/>')");
133
+ });
134
+
135
+ $("#fdaBtn").on("click", function(){
136
+ console.log("fda btn open button clicked");
137
+ WebViewCommunicator.sendJavascriptTo("main", "javascript:appRouter.homeView.openChildBrowser('http://www.fda.gov/medwatch/', '<div data-advtype=box-fda-medwatch/>')");
138
+ });
139
+
140
+ $("#pi").on("click", function(){
141
+ console.log("pi button clicked");
142
+ WebViewCommunicator.sendJavascriptTo("main", "javascript:appRouter.homeView.openChildBrowser('http://127.0.0.1:8081/', '<div data-advtype=box-pres-info/>')");
143
+ });
144
+
145
+ $("#medguide").on("click", function(){
146
+ console.log("medguide button clicked");
147
+ WebViewCommunicator.sendJavascriptTo("main", "javascript:appRouter.homeView.openChildBrowser('http://127.0.0.1:8081/', '<div data-advtype=box-med-guide/>')");
148
+ });
149
+
150
+
151
+ });
152
+
153
+ eos
154
+ end
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+ ######################## BANNER BOILERPLATE ##########################
167
+
168
+ def banner_css_boilerplate
169
+ <<eos
170
+ body{
171
+ position: fixed;
172
+ padding: 0;
173
+ margin: 0;
174
+ top: 0;
175
+ left: 0;
176
+ }
177
+
178
+ #overall_mask{
179
+ position: absolute;
180
+ height: 90px;
181
+ width: 728px;
182
+ }
183
+
184
+ /* Start-of-the-ISI */
185
+ #isi{
186
+ position: absolute;
187
+ background-color: white;
188
+ border-left: 1px solid gray;
189
+ top: 18px;
190
+ left: 428px;
191
+ width: 300px;
192
+ height: 72px;
193
+ font-size: 11px;
194
+ overflow-y: scroll;
195
+ overflow-x: hidden;
196
+ font-family: "Arial-Narrow";
197
+ padding-left: 5px;
198
+ }
199
+
200
+ #isi::-webkit-scrollbar {
201
+ width: 30px;
202
+ margin-top: 10px
203
+ }
204
+
205
+ #isi::-webkit-scrollbar-track {
206
+ background-image: url();
207
+ background-position: center;
208
+ background-repeat: no-repeat;
209
+ background-size: 4px 90%;
210
+ }
211
+
212
+ #isi::-webkit-scrollbar-thumb {
213
+ height: 25px;
214
+ background-image: url();
215
+ background-position: center;
216
+ background-repeat: no-repeat;
217
+ }
218
+ /* End-of-the-ISI */
219
+
220
+ eos
221
+ end
222
+
223
+ def banner_js_boilerplate
224
+ <<eos
225
+ $(function(){
226
+ // WebViewCommunicator.sendJavascriptTo("main", "javascript:appRouter.homeView.flashAdImpressionTrack('banner-ad')");
227
+
228
+ //Start-of-the-animation-code
229
+ //End-of-the-animation-code
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+ function autoScroll(){
246
+ ascroll = setInterval(function(){
247
+ elem = $("#isi")[0];
248
+ if (elem.scrollTop != 1075){
249
+ elem.scrollTop += 2;
250
+ }
251
+ }, 200);
252
+ }
253
+
254
+ $(document).on("touchstart", "#isi", function(){
255
+ clearInterval(ascroll);
256
+ });
257
+
258
+
259
+ $("#overall_mask").on("click", function(){
260
+ console.log("overall mask was clicked");
261
+ WebViewCommunicator.sendJavascriptTo("main", "javascript:appRouter.homeView.openChildBrowser('', '<div data-advtype=banner-mainClickThrough/>')");
262
+ });
263
+
264
+ $("#fdaBtn").on("click", function(){
265
+ console.log("fda btn open button clicked");
266
+ WebViewCommunicator.sendJavascriptTo("main", "javascript:appRouter.homeView.openChildBrowser('http://www.fda.gov/medwatch/', '<div data-advtype=banner-fda-medwatch/>')");
267
+ });
268
+
269
+ $("#pi").on("click", function(){
270
+ console.log("pi button clicked");
271
+ WebViewCommunicator.sendJavascriptTo("main", "javascript:appRouter.homeView.openChildBrowser('http://127.0.0.1:8081/', '<div data-advtype=banner-pres-info/>')");
272
+ });
273
+
274
+ $("#medguide").on("click", function(){
275
+ console.log("medguide button clicked");
276
+ WebViewCommunicator.sendJavascriptTo("main", "javascript:appRouter.homeView.openChildBrowser('http://127.0.0.1:8081/', '<div data-advtype=banner-med-guide/>')");
277
+ });
278
+
279
+
280
+ });
281
+
282
+ eos
283
+ end
284
+
285
+ def pdf_html
286
+ <<eos
287
+ <!doctype html>
288
+ <html>
289
+ <head>
290
+ <meta charset="utf-8">
291
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
292
+ <title></title>
293
+ <style>
294
+ img{
295
+ display: block;
296
+ width:100%;
297
+ }
298
+ </style>
299
+ </head>
300
+
301
+ <body>
302
+ </body>
303
+ </html>
304
+ eos
305
+ end
306
+
307
+
308
+
309
+ #==================================================
310
+
311
+ def img_html(filename, loc)
312
+ <<eos
313
+ <img id="#{filename}" src="#{loc}_images/#{filename}.png" alt="">
314
+ eos
315
+ end
316
+
317
+ def img_css(filename)
318
+ <<eos
319
+
320
+ ##{filename}{
321
+ position: absolute;
322
+ top: 0;
323
+ left: 0;
324
+ }
325
+
326
+ eos
327
+ end
328
+
329
+ def img_js(filename)
330
+ <<eos
331
+ TweenMax.to(#{filename}, 0.0, {});
332
+ eos
333
+ end
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+ def make_files
356
+ make_dirs
357
+ @types.each do |t|
358
+ @ext.each do |k,value|
359
+ if value
360
+ File.open("#{k}/"+@get_current_foldername+"_#{t}.#{k}", 'w+') do |file|
361
+ file.write(send("#{t}_#{k}_boilerplate"))
362
+ end
363
+ else
364
+ File.open(@get_current_foldername+"_#{t}.#{k}", 'w+') do |file|
365
+ to_write = html_boilerplate(@get_current_foldername, t)
366
+ file.write(to_write)
367
+ end
368
+ end
369
+ end
370
+ end
371
+ exec('curl -o js/TweenMax.min.js http://cdnjs.cloudflare.com/ajax/libs/gsap/1.17.0/TweenMax.min.js;curl -o js/jquery.min.js https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js')
372
+ end
373
+
374
+ def make_dirs
375
+ Dir.mkdir("js") unless Dir.exist?("js")
376
+ Dir.mkdir("css") unless Dir.exist?("css")
377
+ Dir.mkdir("box_images") unless Dir.exist?("box_images")
378
+ Dir.mkdir("banner_images") unless Dir.exist?("banner_images")
379
+ end
380
+
381
+ def insert_img_html(filenames,location)
382
+ text_to_be_inserted = ""
383
+ filenames.each do |f|
384
+ text_to_be_inserted << img_html(f,location)
385
+ end
386
+ read = File.read(@get_current_foldername+"_#{location}.html")
387
+ first_part, second_part, third_part = read.split(/(<!-- End-of-the-Image-Tags -->)/)
388
+ first_part << text_to_be_inserted
389
+ everything = first_part + second_part + third_part
390
+ File.open(@get_current_foldername+"_#{location}.html", "w+") do |f|
391
+ f.write(everything)
392
+ end
393
+ end
394
+
395
+ def insert_img_css(filenames,location)
396
+ text_to_be_inserted = ""
397
+ filenames.each do |f|
398
+ text_to_be_inserted << img_css(f)
399
+ end
400
+ read = File.read("css/"+@get_current_foldername+"_#{location}.css")
401
+ first_part, second_part, third_part = read.split(/(\/\* Start-of-the-ISI \*\/)/)
402
+ first_part << text_to_be_inserted
403
+ everything = first_part + second_part + third_part
404
+ File.open("css/" + @get_current_foldername+"_#{location}.css", "w+") do |f|
405
+ f.write(everything)
406
+ end
407
+ end
408
+
409
+ def insert_img_js(filenames,location)
410
+ text_to_be_inserted = ""
411
+ filenames.each do |f|
412
+ text_to_be_inserted << img_js(f)
413
+ end
414
+ read = File.read("js/"+@get_current_foldername+"_#{location}.js")
415
+ first_part, second_part, third_part = read.split(/(\/\/End-of-the-animation-code)/)
416
+ first_part << text_to_be_inserted
417
+ everything = first_part + second_part + third_part
418
+ File.open("js/" + @get_current_foldername+"_#{location}.js", "w+") do |f|
419
+ f.write(everything)
420
+ end
421
+ end
422
+
423
+ def do_the_pdf(pdfs_to_html)
424
+ p pdfs_to_html
425
+ html_pdf_imgs = []
426
+ pdfs_to_html.each do |file|
427
+ if file.include? " "
428
+ File.rename(file, file.gsub(" ","_"))
429
+ file = file.gsub(" ","_")
430
+ end
431
+ pdf_folder_name = File.basename(file, ".*")
432
+ Dir.mkdir(pdf_folder_name)
433
+ p file
434
+ imgs_from_pdf = Magick::Image.read(file) { self.density = 300 }
435
+ imgs_from_pdf.each_with_index do |img,idx|
436
+ img_tag = ['<img src="', '" alt="">']
437
+ img_tag.insert(1,"#{pdf_folder_name}/#{pdf_folder_name}_#{idx}.png")
438
+ html_pdf_imgs << img_tag.join
439
+ img.write(pdf_folder_name+"/#{pdf_folder_name}_#{idx}.png") { self.quality = 100}
440
+ end
441
+ temp = pdf_html
442
+ temp = temp.split(/(<body>)/)
443
+ temp.insert(2,html_pdf_imgs.join("\n"))
444
+ temp = temp.join
445
+ puts temp
446
+ File.open(pdf_folder_name+".html", "w+") do |f|
447
+ f.write(temp)
448
+ end
449
+ end
450
+ end
451
+
452
+ def main
453
+
454
+ @get_current_dir = Dir.getwd
455
+ @get_current_foldername = File.basename(@get_current_dir)
456
+ @box_name = ""
457
+ @banner_name = ""
458
+
459
+ @types = ["box", "banner"]
460
+ @ext = { "html" => false,"css" => true,"js" => true }
461
+
462
+ opts = ARGV
463
+ case opts[0]
464
+ when "new"
465
+ make_files
466
+ when "g", "generate"
467
+ case opts[1]
468
+ when "img"
469
+ case opts[2]
470
+ when "box"
471
+ puts "Couldnt Find the box html,css,js files" unless File.exists? (@get_current_foldername+"_box.html")
472
+ puts "Generating IMG tags for box in HTML, relative code for CSS and JS"
473
+ files_to_be_written = opts[3..-1]
474
+ insert_img_html(files_to_be_written,"box")
475
+ insert_img_css(files_to_be_written,"box")
476
+ insert_img_js(files_to_be_written,"box")
477
+ when "banner"
478
+ puts "Couldnt Find the banner html,css,js files" unless File.exists? (@get_current_foldername+"_banner.html")
479
+ puts "Generating IMG tags for banner in HTML, relative code for CSS and JS"
480
+ files_to_be_written = opts[3..-1]
481
+ insert_img_html(files_to_be_written,"banner")
482
+ insert_img_css(files_to_be_written,"banner")
483
+ insert_img_js(files_to_be_written,"banner")
484
+ when "both"
485
+ puts "Generating tags for both box and banner"
486
+ files_to_be_written = opts[3..-1]
487
+ ["box","banner"].each do |type|
488
+ insert_img_html(files_to_be_written,type)
489
+ insert_img_css(files_to_be_written,type)
490
+ insert_img_js(files_to_be_written,type)
491
+ end
492
+ else
493
+ puts "either pass 'box','banner' or 'both' as flags after generate"
494
+ end
495
+ when "pdf"
496
+ puts "this is the pdf"
497
+ pdf_files = opts[2..-1]
498
+ do_the_pdf(pdf_files)
499
+ else
500
+ puts "either pass img or pdf"
501
+ end
502
+ when "-help"
503
+ puts "Flags are:\nnew\ng or generate"
504
+ else
505
+ puts "Please use a proper flag\nUse -help flag to see all the options"
506
+ end
507
+ end
508
+ end
509
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: f2h
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Ismail Kalimi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rmagick
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: This just generates and downloads sane defaults for html5 animations
70
+ from Flash
71
+ email:
72
+ - ismailkalimi@gmail.com
73
+ executables:
74
+ - f2h
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".DS_Store"
79
+ - ".gitignore"
80
+ - ".rspec"
81
+ - ".travis.yml"
82
+ - CODE_OF_CONDUCT.md
83
+ - Gemfile
84
+ - LICENSE
85
+ - LICENSE.txt
86
+ - README.md
87
+ - Rakefile
88
+ - bin/console
89
+ - bin/f2h
90
+ - bin/setup
91
+ - f2h.gemspec
92
+ - lib/f2h.rb
93
+ - lib/f2h/version.rb
94
+ homepage: https://ikalimi.com/flash2html
95
+ licenses:
96
+ - MIT
97
+ metadata:
98
+ allowed_push_host: https://rubygems.org
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.4.7
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Generates boilerplate code for HTML5 creatives from Flash files
119
+ test_files: []