ii 0.0.8 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -2
  3. data/bin/ii +2 -2
  4. data/lib/ii.rb +6 -3
  5. data/lib/ii/version.rb +1 -1
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26c86e28e74d8798e9342e0db87e5c8c4cad6129
4
- data.tar.gz: b58c065072f8bb570804a2e8b8d5ad0eb5fc1d59
3
+ metadata.gz: 5f67faa379c4b327b1dbe7c965a9933d88ac867d
4
+ data.tar.gz: 092947bc9457c4f3f52d92b813de0623c5c4ca8b
5
5
  SHA512:
6
- metadata.gz: c579c72dc5e099656468b91e3627f100c6f81280a5ec85dd50dbb461112ee0531c6cddb7e891a27798c95e71722b5586775c10f21e2928f39cecfdf92b7a83c4
7
- data.tar.gz: 99b607bc7b13be141f187cebeae779d20d57c23996bd3b037c81098cc33946d55513c27fd6a5bc1ecd5b6650e641252d2e8391014c0dbe40b96164a79f7263b7
6
+ metadata.gz: 0268ee6351ce71aca79293f238bc60c51057941c82b7fe701423f080d197b5812cf989a333dbc9adedea11d55440b39692b01a98233837c80de958616bd61567
7
+ data.tar.gz: 9c445c34601fae04d6db81fdab854a4ed77c6c107d7568b463c3410886188a2c9f6a7f210019a813487efdd507e5511b86de0aefc2bbadc916a99ccb4b1a38d1
data/README.md CHANGED
@@ -1,9 +1,15 @@
1
- # Ii
1
+ # ii
2
2
 
3
- TODO: Write a gem description
3
+ ii(image idea) is a image tool set for mobile app image operate.
4
+
5
+ ii(image idea)是一个处理移动端图片的工作套件。
4
6
 
5
7
  ## Installation
6
8
 
9
+ Install Ruby and gem, if you don't know how to do it, see [this document]().
10
+
11
+ 安装Ruby和gem,如果你不知道如何安装,看看[这篇文章]()。
12
+
7
13
  Add this line to your application's Gemfile:
8
14
 
9
15
  gem 'ii'
data/bin/ii CHANGED
@@ -48,8 +48,6 @@ if File.directory? source_dir
48
48
  end
49
49
  end
50
50
 
51
- puts files
52
-
53
51
  # 全部拷贝到iOS目标路径
54
52
  FileUtils.cp_r source_dir + '/.', dest_ios_dir
55
53
 
@@ -57,11 +55,13 @@ if File.directory? source_dir
57
55
  files.each do |filename|
58
56
  # 如果是文件夹,就复制一份
59
57
  if File.directory? filename
58
+ puts 'Copying Directory: ' + filename
60
59
  FileUtils.mkdir_p dest_android_xhdpi_dir + filename.slice(/\/.*/)
61
60
  FileUtils.mkdir_p dest_android_hdpi_dir + filename.slice(/\/.*/)
62
61
  FileUtils.mkdir_p dest_android_mdpi_dir + filename.slice(/\/.*/)
63
62
  ## 如果是文件,就改名并拷贝文件
64
63
  else
64
+ puts 'Resizing image: ' + filename
65
65
  relative_filename = filename.slice(/\/.*/).sub('@2x','')
66
66
  FileUtils.cp filename,dest_android_xhdpi_dir + relative_filename
67
67
  Ii.resize filename, dest_android_hdpi_dir + relative_filename, 0.75
data/lib/ii.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "ii/version"
2
- require "Parallel"
3
- require "RMagick"
2
+ require "parallel"
3
+ require "rmagick"
4
4
  require "Find"
5
5
 
6
6
 
@@ -18,11 +18,14 @@ class Ii
18
18
  dest_height = height*resize_ratio
19
19
  dest_width = width*resize_ratio
20
20
 
21
+ # make sure height and width is not 0
22
+ dest_height = dest_height < 1 ? 1 : dest_height
23
+ dest_width = dest_width < 1 ? 1:dest_width
21
24
 
22
25
  # resize the new image
23
26
  # the api can be found at http://studio.imagemagick.org/RMagick/doc/constants.html#GravityType
24
27
  new_img = img.resize(dest_width, dest_height, Magick::LanczosFilter, 0.8)
25
- # new_img = img.resize(0.75)
28
+ new_img2 = img.
26
29
 
27
30
  # set quality
28
31
  new_img.write(new_filename) {self.quality = 70 }
@@ -1,3 +1,3 @@
1
1
  class Ii
2
- VERSION = "0.0.8"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ii
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yuguo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-21 00:00:00.000000000 Z
11
+ date: 2014-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler