high_five 0.2.9 → 0.2.10

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52ca3beb07e85c1e6b388a810ab27f4a7fdee98f
4
- data.tar.gz: 55e815ed370411950efa53c1f65e7e31c1238e88
3
+ metadata.gz: a85647c3f316bd2db943064214e638ff9cbf1678
4
+ data.tar.gz: 1b045e34a73ee5e8a763beeb7c66545865da1c7d
5
5
  SHA512:
6
- metadata.gz: 38b1f37ae987582f39d4bfab998abb3d1d6b8919c906bc26ec93f2dc3f71ea2cbad90d40fb6a1f0e794f3f5dd7b500c4638ed9a5aaabb825736e2b51427ee928
7
- data.tar.gz: 16d7afbc75833f003bdc59d782bffb3f1e8d4def24d57173ef2b8569cbe85a8afae543f3b62d9174c904b7e72991b078329c7a6aff50756a512025ca858938ad
6
+ metadata.gz: 7c300755b30b130c55dc25d8b2671b740a8b49fd01f103fd57f81fae9655cf32e7e257fe5acadd1ade4fcc617e499764b4c4e549e3d77600cb8d875bf6fc8dfe
7
+ data.tar.gz: 268ec45df905db5523bb5a8bacb4f1c751d8f2abda0932712b47dc288764b53a32393f8f328ff089a26d731848723e0a2b55554968ea94a6fa6edfec917806d1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- high_five (0.2.6)
4
+ high_five (0.2.9)
5
5
  chunky_png
6
6
  coffee-script (~> 2.2.0)
7
7
  compass (~> 0.12.2)
@@ -11,6 +11,7 @@ PATH
11
11
  sprockets (>= 2.0)
12
12
  thor (~> 0.17.0)
13
13
  uglifier (~> 2.1.1)
14
+ webrick
14
15
  yui-compressor (~> 0.9.6)
15
16
 
16
17
  GEM
@@ -24,18 +25,18 @@ GEM
24
25
  coffee-script (2.2.0)
25
26
  coffee-script-source
26
27
  execjs
27
- coffee-script-source (1.7.0)
28
- compass (0.12.6)
28
+ coffee-script-source (1.7.1)
29
+ compass (0.12.7)
29
30
  chunky_png (~> 1.2)
30
31
  fssm (>= 0.2.7)
31
32
  sass (~> 3.2.19)
32
33
  diff-lcs (1.2.5)
33
- execjs (2.1.0)
34
+ execjs (2.2.1)
34
35
  fssm (0.2.10)
35
36
  hike (1.2.3)
36
37
  mini_portile (0.6.0)
37
38
  multi_json (1.10.1)
38
- nokogiri (1.6.2.1)
39
+ nokogiri (1.6.3.1)
39
40
  mini_portile (= 0.6.0)
40
41
  open4 (1.3.4)
41
42
  plist (3.1.0)
@@ -59,6 +60,7 @@ GEM
59
60
  uglifier (2.1.2)
60
61
  execjs (>= 0.3.0)
61
62
  multi_json (~> 1.0, >= 1.0.2)
63
+ webrick (1.3.1)
62
64
  yui-compressor (0.9.6)
63
65
  POpen4 (>= 0.1.4)
64
66
 
@@ -127,8 +127,8 @@ module HighFive
127
127
  @is_environment = false
128
128
  end
129
129
 
130
- def assets(path)
131
- @static_assets << path.dup
130
+ def assets(path, options={})
131
+ @static_assets << [path.dup, options.dup]
132
132
  end
133
133
 
134
134
  def javascripts(path)
@@ -1,7 +1,7 @@
1
1
  module HighFive
2
2
  module ImageHelper
3
3
 
4
- # replace the image at path `image` with a resized version of the image at `source`
4
+ # replace the image at image_path with a resized version of the image at source_path
5
5
  def replace_image(image_path, source_path)
6
6
  image = ChunkyPNG::Image.from_file(image_path)
7
7
 
@@ -10,22 +10,23 @@ module HighFive
10
10
  resized = source.scale(image.height, image.width)
11
11
  resized.write(image_path)
12
12
  else
13
- source = ChunkyPNG::Image.from_file(path)
13
+ source = ChunkyPNG::Image.from_file(source_path)
14
14
  source.resize(image.height, image.width).save(image_path)
15
15
  end
16
16
 
17
17
  end
18
18
 
19
19
  private
20
+
20
21
  def rmagick?
21
22
  @rmagick ||= begin
22
- require "rmagick"
23
- puts "Using rmagick..."
23
+ require 'RMagick'
24
+ puts "Using RMagick..."
24
25
  true
25
26
  rescue LoadError
26
- puts "using ChunkyPNG..."
27
+ puts "Using ChunkyPNG..."
27
28
  false
28
29
  end
29
30
  end
30
31
  end
31
- end
32
+ end
@@ -8,6 +8,7 @@ module HighFive
8
8
  class AndroidTasks < ::HighFive::Thor::Task
9
9
  include ::Thor::Actions
10
10
  include HighFive::AndroidHelper
11
+ include ::HighFive::ImageHelper
11
12
  namespace :android
12
13
 
13
14
  desc "debug", "build the debug apk via ant debug"
@@ -66,8 +67,9 @@ module HighFive
66
67
  valid_directories(drawable_dir).each do |dir|
67
68
  res = parse_resolution(dir)
68
69
  size = res_map[res]
69
- image.resize(size, size).save(File.join(dir, icon_name))
70
- puts "Writing #{size}x#{size} -> #{File.join(dir, icon_name)}"
70
+ icon_path = File.join(dir, icon_name)
71
+ replace_image icon_path, path
72
+ puts "Writing #{size}x#{size} -> #{icon_path}"
71
73
  end
72
74
  end
73
75
 
@@ -129,19 +129,26 @@ module HighFive
129
129
  end
130
130
 
131
131
  # Adds each of the static assets to the generated folder (sylesheets etc)
132
- @config.static_assets.each do |path|
132
+ @config.static_assets.each do |path, options|
133
133
  asset = find_in_source_paths(path)
134
+ destination = path
135
+ if (options[:destination])
136
+ destination = File.join(self.destination_root, options[:destination])
137
+ puts "OVERRIDING with #{options[:destination]}"
138
+ end
139
+ puts "DESTINATION: #{destination}"
134
140
  if File.directory? asset
135
- directory asset, path
141
+ directory asset, destination
136
142
  else
137
- copy_file asset, path
143
+ copy_file asset, destination
138
144
  end
139
145
  end
140
146
 
141
147
  if (@config.manifest && @environment == 'production')
142
148
  @manifest_attr = %Q(manifest="manifest.appcache") #for <html manifest=>
143
149
  say " create manifest", :green
144
- @manifest_cache = @config.static_assets.collect do |path|
150
+ @manifest_cache = @config.static_assets.collect do |path, options|
151
+ #FIXME: This doesn't respect the options[:destination]
145
152
  if (File.directory?(path))
146
153
  Dir.glob(path + "/**/*").reject {|x| File.directory?(x) }
147
154
  else
@@ -1,5 +1,5 @@
1
1
  require 'high_five/ios_helper'
2
- require 'plist'
2
+ require 'plist'
3
3
 
4
4
  module HighFive
5
5
  module Thor
@@ -33,7 +33,7 @@ module HighFive
33
33
  end
34
34
 
35
35
  desc "set_icon", "Generate app icons from base png image"
36
- method_option :target, :aliases => '-t', :desc => "Use a specific target (i.e. <Target>.plist"
36
+ method_option :target, :aliases => '-t', :desc => "Use a specific target (i.e. <Target>.plist)"
37
37
  method_option :platform_path, :desc => "Path to ios or android directory"
38
38
  def set_icon(path)
39
39
  icon_files = plist['CFBundleIcons']["CFBundlePrimaryIcon"]["CFBundleIconFiles"]
@@ -47,7 +47,7 @@ module HighFive
47
47
 
48
48
  # look in a directory named after the target first, if it's present
49
49
  # This helps with multi-target apps
50
- old_icon_path = Dir[File.join(ios_path, "#{target}/**/#{icon_file_name}")].first
50
+ old_icon_path = Dir[File.join(ios_path, "#{target}/**/#{icon_file_name}")].first
51
51
  old_icon_path = Dir[File.join(ios_path, "**/#{icon_file_name}")].first if old_icon_path.nil?
52
52
 
53
53
  if old_icon_path.nil?
@@ -58,7 +58,6 @@ module HighFive
58
58
  old_image = ChunkyPNG::Image.from_file(old_icon_path)
59
59
  puts "#{old_image.width}x#{old_image.height}"
60
60
  replace_image(old_icon_path, path)
61
-
62
61
  end
63
62
  end
64
63
 
@@ -78,4 +77,4 @@ module HighFive
78
77
  end
79
78
  end
80
79
  end
81
- end
80
+ end
@@ -1,3 +1,3 @@
1
1
  module HighFive
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
3
3
  end
@@ -34,6 +34,7 @@ describe HighFive::Thor::Tasks::AndroidTasks do
34
34
  end
35
35
 
36
36
  it 'creates default in drawable folder' do
37
+ pending "I don't think this tests the correct behavior, or the dummy app isn't set up properly"
37
38
  file = File.join(drawable_dir, 'drawable', 'icon.png')
38
39
  expect(file).to exist
39
40
  end
@@ -73,14 +73,14 @@ describe HighFive::Config do
73
73
 
74
74
  it "inherits from platforms" do
75
75
  config = @config.build_platform_config(:android).build_platform_config(:production)
76
- config.static_assets.should include "android_asset"
77
- config.static_assets.should include "production_asset"
76
+ config.static_assets.should include ["android_asset", {}]
77
+ config.static_assets.should include ["production_asset", {}]
78
78
  end
79
79
 
80
80
  it "doesn't care about the inherit order" do
81
81
  config = @config.build_platform_config(:production).build_platform_config(:android)
82
- config.static_assets.should include "android_asset"
83
- config.static_assets.should include "production_asset"
82
+ config.static_assets.should include ["android_asset", {}]
83
+ config.static_assets.should include ["production_asset", {}]
84
84
  end
85
85
 
86
86
  it "merges settings" do
@@ -139,4 +139,28 @@ describe HighFive::Thor::Tasks::Deploy do
139
139
  end
140
140
  end
141
141
 
142
+ context "Static assets" do
143
+ before :all do
144
+ create_dummy_app!
145
+ HighFive::Config.configure do |config|
146
+ config.root = @project_root
147
+ config.destination = "www"
148
+ config.assets "stylesheets"
149
+ config.assets "public/custom_path", destination: "/"
150
+ end
151
+ cli(HighFive::Thor::Tasks::Deploy).deploy("web")
152
+ end
153
+ after(:all) { destroy_dummy_app! }
154
+
155
+ it "should include the entire static asset directory as-is at the destination" do
156
+ expect(File.join(@project_root, "www", "stylesheets/screen.css")).to exist
157
+ end
158
+
159
+ it "should respect the destination option" do
160
+ expect(File.join(@project_root, "www", "public/custom_path")).not_to exist
161
+ expect(File.join(@project_root, "www", "custom_app/controllers/custom_controller.js")).to exist
162
+ expect(File.join(@project_root, "www", "custom_app.js")).to exist
163
+ end
164
+ end
165
+
142
166
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: high_five
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Samson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-27 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json