motion-icon_generator 0.0.1 → 0.0.2

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: 98e2326be8a9b0141b4ff2a9441412caded0fe3b
4
- data.tar.gz: fd5c7ddb226ec0c231af4801bd5bb63658fe2efa
3
+ metadata.gz: ca38a71384c1af887167a6cc5af8d45febc8f562
4
+ data.tar.gz: 089a73cda85758f2b230b08eaf5021ca197a59e7
5
5
  SHA512:
6
- metadata.gz: e0b6f890a240a6e186ad3786e8b45adda0af65aff2b9ac92dd687aba268b4cc2282770e72d42f7b0d30fe8eb8254d9139ad097617dd627e68b277bf5de90e94f
7
- data.tar.gz: ccc92b84ab2dcc48528255915c6c179365fe10d84aa74b4b867347d9ed2e40bb4d00f27b383e9df3a49f0d78ffa3e1a0896a78e451a7fd6dc6e1304bd2291b93
6
+ metadata.gz: c6d7a1b8ac39cc59eb945dfb49030fc3493dbb0e0ac401ae5902c67b3a737793bc2e0de97fe02328306f6e766fec3ad75f336b078f3b74de7c07d7dc5005d93f
7
+ data.tar.gz: e55fa453fbe974d5424f59004ce095057a94cd639357e448f8f33fcab63f9812177cf6b5dc36e2d5a1caedf4f8c16d94d477ab50d7a30897d8cce1de98e4ba7f
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
- # Motion::IconGenerator
1
+ # Icon Generator
2
2
 
3
3
  Are you tired of spending hours creating all of the different icon versions you need for your app?
4
4
 
5
5
  **Well, dry your eyes little-one**.
6
6
 
7
- motion-icon_generator effortlessly generates all of the iOS icon versions you'll ever need.
7
+ **Icon Generator** effortlessly generates all of the iOS icon versions you'll ever need.
8
+
9
+ Need splash images? We gots them here: https://github.com/KatanaCode/motion-splash_generator
8
10
 
9
11
  ## Installation
10
12
 
@@ -67,5 +69,9 @@ We would really appreciate if someone could contribute the default icon sizes fo
67
69
  4. Push to the branch (`git push origin my-new-feature`)
68
70
  5. Create a new Pull Request
69
71
 
70
- By [Katana Code, web developers, mobile app developers, nice guys](http://katanacode.com/tools?utm_source=GitHub&utm_medium=README&utm_campaign=motion-icon_generator
71
- )
72
+ ## Acknowledgements
73
+
74
+ This was based partly on [https://github.com/spren9er/s9icongen](https://github.com/spren9er/s9icongen) by [@spren9er](https://github.com/spren9er)
75
+
76
+ By [Katana Code: web developers, mobile app developers, nice guys](http://katanacode.com/tools?utm_source=GitHub&utm_medium=README&utm_campaign=motion-icon_generator
77
+ )
@@ -1,27 +1,28 @@
1
1
  module Motion
2
2
  module IconGenerator
3
3
  class Image
4
-
5
- require 'rmagick'
6
-
7
- include Magick
8
-
4
+
5
+ require 'mini_magick'
6
+
7
+
8
+
9
+
9
10
  attr_reader :size
10
-
11
-
11
+
12
+
12
13
  # Create a new Image
13
14
  #
14
15
  # size - An ImageSize to specifcy the size and name of image.
15
16
  def initialize(size)
16
17
  @size = size
17
18
  end
18
-
19
+
19
20
  # Writes this image to disk
20
21
  def write!
21
22
  create_target_directory
22
23
  scaled_image.write(filename)
23
24
  end
24
-
25
+
25
26
  # Prints feedback to STDOUT
26
27
  def report
27
28
  if File.exist?(filename)
@@ -30,40 +31,40 @@ module Motion
30
31
  warn("Couldn't write #{filename}")
31
32
  end
32
33
  end
33
-
34
-
34
+
35
+
35
36
  private
36
37
 
37
-
38
+
38
39
  def scaled_image
39
- template_image.resize_to_fill(size.actual_width, size.actual_height)
40
+ template_image.resize("#{size.actual_width}x#{size.actual_height}")
40
41
  end
41
-
42
+
42
43
  def filename
43
44
  "#{target}/#{size.name}"
44
45
  end
45
-
46
+
46
47
  def template_image
47
48
  if File.exist?(img_name)
48
- ImageList.new(img_name)
49
+ MiniMagick::Image.open(img_name)
49
50
  else
50
51
  raise "No template image specified. Did you create resources/icon-template.png?"
51
52
  end
52
53
  end
53
-
54
+
54
55
  def create_target_directory
55
56
  FileUtils.mkdir(target) unless Dir.exist?(target)
56
57
  end
57
-
58
+
58
59
  def img_name
59
60
  ENV['TEMPLATE'] || "resources/icon-template.png"
60
61
  end
61
-
62
+
62
63
  def target
63
64
  ENV['TARGET'] || 'icons'
64
65
  end
65
66
 
66
67
  end
67
-
68
+
68
69
  end
69
70
  end
@@ -1,5 +1,5 @@
1
1
  module Motion
2
2
  module IconGenerator
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
data/lib/tasks/icons.rake CHANGED
@@ -4,28 +4,28 @@ require 'motion/icon_generator/size'
4
4
  require 'yaml'
5
5
 
6
6
  namespace :icons do
7
-
7
+
8
8
  desc "Creates splash images for all devices"
9
-
9
+
10
10
  task :generate do
11
- icon_image_sizes.each do |size|
11
+ icon_image_sizes.each do |size|
12
12
  Motion::IconGenerator::Image.new(size).tap do |icon_image|
13
13
  icon_image.write!
14
- icon_image.report
14
+ icon_image.report
15
15
  end
16
16
  end
17
17
  end
18
-
19
-
18
+
19
+
20
20
  private
21
21
 
22
-
22
+
23
23
  def icon_image_sizes
24
24
  @icon_image_sizes ||= begin
25
25
  default_icon_image_sizes + local_icon_image_sizes
26
26
  end
27
27
  end
28
-
28
+
29
29
  def default_icon_image_sizes
30
30
  load_icon_image_sizes_from_file("#{GEM_ROOT}/lib/motion/icon_generator/icons.yaml")
31
31
  end
@@ -33,15 +33,15 @@ namespace :icons do
33
33
  def local_icon_image_sizes
34
34
  load_icon_image_sizes_from_file("config/icons.yaml")
35
35
  end
36
-
36
+
37
37
  def load_icon_image_sizes_from_file(filename)
38
38
  begin
39
39
  YAML.load(File.read(filename)).map do |attributes|
40
- Motion::IconGenerator::Size.new(attributes)
41
- end.flatten
40
+ Motion::IconGenerator::Size.new(attributes)
41
+ end.flatten
42
42
  rescue Errno::ENOENT
43
43
  []
44
- end
44
+ end
45
45
  end
46
-
46
+
47
47
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = <<-DESC
13
13
  Simple gem that adds a rake task to create all of the versions of iOS icons you'll need to launch. Simply create a template image file and let the app do the rest.
14
14
  DESC
15
-
15
+
16
16
  spec.homepage = "http://github.com/katanacode/motion-icon_generator"
17
17
  spec.license = "MIT"
18
18
 
@@ -21,10 +21,10 @@ Gem::Specification.new do |spec|
21
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
22
  spec.require_paths = ["lib"]
23
23
 
24
-
25
- spec.add_dependency 'rmagick'
26
-
27
- spec.add_development_dependency "pry"
24
+
25
+ spec.add_dependency 'mini_magick'
26
+
28
27
  spec.add_development_dependency "bundler", "~> 1.7"
29
28
  spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", ">= 3.5.0"
30
30
  end
data/spec/main_spec.rb ADDED
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+
3
+ describe "Creating a new version" do
4
+
5
+ GEM_BASE = File.join(File.dirname(__FILE__), "..")
6
+
7
+ before(:all) do
8
+ ENV["TEMPLATE"] = "./spec/support/sample-image.jpg"
9
+ ENV["TARGET"] = "./tmp/results"
10
+ end
11
+
12
+ after(:all) do
13
+ FileUtils.rm_rf(File.join(GEM_BASE, "tmp", "results"))
14
+ end
15
+
16
+ let(:name) { "Test.png" }
17
+ let(:scale) { 2 }
18
+ let(:size) { 100 }
19
+
20
+ it "creates a new image file with the correct name" do
21
+ Image.new(Size.new(name: name, scale: scale, size: size)).write!
22
+ expect(File).to exist(File.join(GEM_BASE, "tmp", "results", name))
23
+ end
24
+
25
+ it "creates a file of the correct scale and size" do
26
+ result = MiniMagick::Image.open(File.join(GEM_BASE, "tmp", "results", name))
27
+ expect(result.width).to eql(size * scale)
28
+ expect(result.height).to eql(size * scale)
29
+ end
30
+
31
+ it "converts file to png" do
32
+ result = MiniMagick::Image.open(File.join(GEM_BASE, "tmp", "results", name))
33
+ expect(result.mime_type).to eql("image/jpeg")
34
+ end
35
+
36
+ end
@@ -0,0 +1,7 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
2
+
3
+
4
+ require 'motion/icon_generator/image'
5
+ require 'motion/icon_generator/size'
6
+
7
+ include Motion::IconGenerator
Binary file
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-icon_generator
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
  - Bodacious
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-11 00:00:00.000000000 Z
11
+ date: 2017-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rmagick
14
+ name: mini_magick
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,49 +25,50 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: pry
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.7'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '1.7'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.7'
47
+ version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.7'
54
+ version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: 3.5.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
69
- description: |2
70
- Simple gem that adds a rake task to create all of the versions of iOS icons you'll need to launch. Simply create a template image file and let the app do the rest.
68
+ version: 3.5.0
69
+ description: " Simple gem that adds a rake task to create all of the versions of
70
+ iOS icons you'll need to launch. Simply create a template image file and let the
71
+ app do the rest.\n"
71
72
  email:
72
73
  - gavin@katanacode.com
73
74
  executables: []
@@ -86,6 +87,9 @@ files:
86
87
  - lib/motion/icon_generator/version.rb
87
88
  - lib/tasks/icons.rake
88
89
  - motion-icon_generator.gemspec
90
+ - spec/main_spec.rb
91
+ - spec/spec_helper.rb
92
+ - spec/support/sample-image.jpg
89
93
  homepage: http://github.com/katanacode/motion-icon_generator
90
94
  licenses:
91
95
  - MIT
@@ -106,8 +110,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
110
  version: '0'
107
111
  requirements: []
108
112
  rubyforge_project:
109
- rubygems_version: 2.4.5
113
+ rubygems_version: 2.5.1
110
114
  signing_key:
111
115
  specification_version: 4
112
116
  summary: Automatically generates all of the iOS icons you'll never need
113
- test_files: []
117
+ test_files:
118
+ - spec/main_spec.rb
119
+ - spec/spec_helper.rb
120
+ - spec/support/sample-image.jpg