widget_bundler 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzYxZjljYWMyNzc0Njk2MjMyNmI0ODNiZDhkODk0MWQxMTMzNjM3Mg==
4
+ MThiMmU0NjUwODIxNjY1MmMyMzNmZDhkYjM1NzU5OTQ4MjExY2YyZQ==
5
5
  data.tar.gz: !binary |-
6
- ZGY1MWY4NmUyOWEwMzY3Mzg5ZGQ0N2YxODg3MzY5OTExMmY3MTcwZg==
6
+ YmQ4MDc2YTc3ODU2ODRiMTExMGQ3YjNiNTk2M2YzZWMzMWNjYmE3YQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZmVkNzQ4MDVjZGU1M2NjNzA1ZDIzNmVhMjMzNzAxMmVjMTg4ZGNhZTIzNjI4
10
- MDZiMTkyZWM3ZWY3YjcxODgxOGMwODg5NjA5Mzk5NTQ1NmNjMzE5NDAxZDc3
11
- YjUwZWM0ZDdhYWVhYTc2M2UyZDY2YTdiNzYxMTYwYWQ1YjU4YjI=
9
+ NDhjYjc4YzUwMjM4MmUxZWNkYTc3YTk3ZmRiYTg4YzYxYzI4N2I3MzQwNzI5
10
+ ZjFkODhkNjZiNTQ0ZDNmYzI4ZmU2ZDgyYTc3ZTMxZWI3YzJkMjU0Mzg3Y2Uy
11
+ NDIyYzQyN2NlMjJjOTFhZGRiOTlkZGI2YTdhNTc2MDk0YjM2ZDY=
12
12
  data.tar.gz: !binary |-
13
- MWRkZjJkNWNkZGFiMDE5ZDE5NWVmYzcxMDkwZTY4OGI3NTFkNzRkMjJmYTlj
14
- YTM3YTQzYzhmZThmMzVlZjM0Mzk2OWM5NjBhZTA1ZTNhMWVlMWYzNzYzOTg5
15
- ODM3YjA2MjhlNWI4ZTU0NGU5MjI0MDE3NDYwOTRjZGFlMzc2YTY=
13
+ ZWRjMmM3ZGM5ZTlkODA1OWYxNWYxYzAzOTE0NDg4ODUxYzNkMTdlZmUzZDNj
14
+ Y2IzMjQ3YTQ3MThiNTk3OGFhODI3ZGFkMTg0OGViMGMyMzc3ZDRjZTgzZWYw
15
+ MGJlMjEwNTgzYjFlYTY5NzgwZmI1YmRhZTg4OWFiOWJkNjRkOWE=
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Class for packaging set of html, javascript, image and stylesheet files into a widget for an iBook
3
3
  # => accepts an array of images, stylesheets and javascripts as full paths
4
+ # => images should be paperclip .url method path
4
5
  # => acceps main haml file as string (fullpath)
5
6
  #
6
7
  require 'active_model'
@@ -32,18 +33,26 @@ class WidgetBundle
32
33
  FileUtils.mkdir_p path
33
34
 
34
35
  # make requred directories
35
- images_dir = FileUtils.mkdir "#{path}/images/"
36
- stylesheets_dir = FileUtils.mkdir "#{path}/stylesheets/"
37
- javascripts_dir = FileUtils.mkdir "#{path}/javascripts/"
36
+ # images_dir = FileUtils.mkdir("#{path}/")[0]
37
+ images_dir = path
38
+ css_js_dir = FileUtils.mkdir("#{path}/assets/")[0]
38
39
 
39
40
  # copy images
40
- FileUtils.cp images, images_dir if images
41
+ # TODO: tried doing this all with FileUtils.cp_r but couldn't get it to work properly, had to use this block instead
42
+ if images
43
+ images.each do |i|
44
+ file = "#{Rails.root}/public#{i}".split("?")[0]
45
+ dir = "#{images_dir}/#{File.dirname(i)}".gsub('//', '/')
46
+ FileUtils.mkdir_p dir
47
+ FileUtils.cp file, dir
48
+ end
49
+ end
41
50
 
42
51
  # copy stylesheets
43
- FileUtils.cp stylesheets, stylesheets_dir if stylesheets
52
+ FileUtils.cp stylesheets, css_js_dir if stylesheets
44
53
 
45
54
  # copy javascripts
46
- FileUtils.cp javascripts, javascripts_dir if javascripts
55
+ FileUtils.cp javascripts, css_js_dir if javascripts
47
56
 
48
57
  # create Info.plist
49
58
  File.open("#{path}/Info.plist", "w") { |file| file.write(plist_content(display_name, bundle_identifier, bundle_name)) }
@@ -53,7 +62,7 @@ class WidgetBundle
53
62
  File.open("#{path}/main.html", "w") { |file| file.write( compiled_haml ) }
54
63
 
55
64
  # compress the *.wdgt folder and return the full path to the zip archive
56
- compress(path)
65
+ compress(path)
57
66
  end
58
67
 
59
68
  protected
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: widget_bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Franken