22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/f2h.rb', line 22
def main
opts = ARGV
case opts[0]
when "new"
@init.make_files
when "g", "generate"
case opts[1]
when "img"
case opts[2]
when "box"
puts "Couldnt Find the box html,css,js files" unless File.exists? (@get_current_foldername+"_box.html")
puts "Generating IMG tags for box in HTML, relative code for CSS and JS"
files_to_be_written = opts[3..-1]
@it.insert_img_html(files_to_be_written,"box")
@it.insert_img_css(files_to_be_written,"box")
@it.insert_img_js(files_to_be_written,"box")
when "banner"
puts "Couldnt Find the banner html,css,js files" unless File.exists? (@get_current_foldername+"_banner.html")
puts "Generating IMG tags for banner in HTML, relative code for CSS and JS"
files_to_be_written = opts[3..-1]
@it.insert_img_html(files_to_be_written,"banner")
@it.insert_img_css(files_to_be_written,"banner")
@it.insert_img_js(files_to_be_written,"banner")
when "both"
puts "Generating tags for both box and banner"
files_to_be_written = opts[3..-1]
["box","banner"].each do |type|
@it.insert_img_html(files_to_be_written,type)
@it.insert_img_css(files_to_be_written,type)
@it.insert_img_js(files_to_be_written,type)
end
else
puts "either pass 'box','banner' or 'both' as flags after generate"
end
when "pdf"
puts "This is the pdf"
pdf_files = opts[2..-1]
@pdf2img.do_the_pdf(pdf_files)
else
puts "either pass img or pdf"
end
when "-help"
puts help
else
puts "Please use a proper flag\nUse -help flag to see all the options"
end
end
|