rubyapple 0.0.1 → 0.1.1

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
  SHA256:
3
- metadata.gz: 80f2fd2a37f82ad5a8b9f6b5886012200213bf733c7459948f26f357d9167508
4
- data.tar.gz: b3b98dbafcfbabf800792f5eb0c8280884f988b2d2257c9cd7cc3cf14cb9fb4f
3
+ metadata.gz: 4a60b39aa49ab33bfc0f8d2330652b2573a562b11e3ed6eaa6d5f40af51fc28d
4
+ data.tar.gz: 7231674e31730e800cd3c3a05c0bef51f5f7ed11682190da9605c739c73d35dc
5
5
  SHA512:
6
- metadata.gz: a871989e6318450a264cb6e481b2beb39be59e53b595471df6ddcd21bc66bf1cda9997219bd8ef9facc805b1ebf796ea4a99d352a9d39f50aa3c579a91b1d576
7
- data.tar.gz: bbc662830c865929a4d954c6e84ff939c95caa89b783eb5fe4e985912e2e7d3ed2cf207ebefbb4cedeb23e34110fd6c3b3a3b4e995d7a73c6fff125426926e51
6
+ metadata.gz: 5af0c2333d217a94c05f9f4f39418cb6344737fed7a0aacb3c171fb98feb427394fc38c56c71925ca226bd3ac4f472c79d47a7274e698a66ac9e74de203aa296
7
+ data.tar.gz: 4414a606c014fb170acb297ede1fb4222a8f261f39259a43926f9d86ab8fa7f9c81e5268e7f6e09210685b9914920f804544990f5c773d3d7f3db4fd1cd74d6f
data/README.md CHANGED
@@ -6,30 +6,89 @@
6
6
 
7
7
 
8
8
  >This is Rubyapple
9
- > A gem to convert a png picture into respective:
9
+ > a gem to convert a png picture into respective:
10
+ >
10
11
  > apple-touch-icon-sizexsize.png
11
- > and
12
+ >
12
13
  > apple-touch-icon-sizexsize-precompiled.png
13
- >
14
+
15
+
16
+ ## PRE-Installation
17
+ ```rb
18
+ sudo apt-get install -f libmagickwand-dev imagemagick
19
+ ```
14
20
 
15
21
  ## Installation
16
22
 
17
23
  ```rb
18
- gem install Rubyapple
24
+ gem install rubyapple
19
25
  ```
20
26
 
21
27
  ## Usage
22
28
 
23
- NOTE! init should check if the name is in use or not, but we check to be certain.
29
+ NOTE! Create the apple_images folder where you invoke the rubyapple command, but do not enter it.
30
+ ```rb
31
+ rubyapple help
32
+ ```
24
33
 
34
+ Recommended original file beeing larger then 310x310, that is the current largest scaling in this gem.
25
35
  ```rb
26
- rubyapple picture.png
36
+ rubyapple gen-type picture.png
27
37
  ```
28
38
 
29
39
  output will be contained in the following folder where you invoked the command
30
40
 
31
41
  ```rb
32
- apple_images/*
42
+ type_images/
43
+ ```
44
+
45
+ Example output from `gen-apple-touch` 's `apple_images` folder:
46
+ ```
47
+ user@computer:~/apple_images$ ls -l
48
+ total 840
49
+ -rw-rw-r-- 1 user user 20960 Sep 17 17:26 apple-touch-icon-114x114.png
50
+ -rw-rw-r-- 1 user user 20960 Sep 17 17:26 apple-touch-icon-114x114-precomposed.png
51
+ -rw-rw-r-- 1 user user 22637 Sep 17 17:26 apple-touch-icon-120x120.png
52
+ -rw-rw-r-- 1 user user 22637 Sep 17 17:26 apple-touch-icon-120x120-precomposed.png
53
+ -rw-rw-r-- 1 user user 29994 Sep 17 17:26 apple-touch-icon-144x144.png
54
+ -rw-rw-r-- 1 user user 29994 Sep 17 17:26 apple-touch-icon-144x144-precomposed.png
55
+ -rw-rw-r-- 1 user user 32619 Sep 17 17:26 apple-touch-icon-152x152.png
56
+ -rw-rw-r-- 1 user user 32619 Sep 17 17:26 apple-touch-icon-152x152-precomposed.png
57
+ -rw-rw-r-- 1 user user 37595 Sep 17 17:26 apple-touch-icon-167x167.png
58
+ -rw-rw-r-- 1 user user 37595 Sep 17 17:26 apple-touch-icon-167x167-precomposed.png
59
+ -rw-rw-r-- 1 user user 1141 Sep 17 17:26 apple-touch-icon-16x16.png
60
+ -rw-rw-r-- 1 user user 1141 Sep 17 17:26 apple-touch-icon-16x16-precomposed.png
61
+ -rw-rw-r-- 1 user user 42094 Sep 17 17:26 apple-touch-icon-180x180.png
62
+ -rw-rw-r-- 1 user user 42094 Sep 17 17:26 apple-touch-icon-180x180-precomposed.png
63
+ -rw-rw-r-- 1 user user 76201 Sep 17 17:26 apple-touch-icon-270x270.png
64
+ -rw-rw-r-- 1 user user 76201 Sep 17 17:26 apple-touch-icon-270x270-precomposed.png
65
+ -rw-rw-r-- 1 user user 92879 Sep 17 17:26 apple-touch-icon-310x310.png
66
+ -rw-rw-r-- 1 user user 92879 Sep 17 17:26 apple-touch-icon-310x310-precomposed.png
67
+ -rw-rw-r-- 1 user user 2381 Sep 17 17:26 apple-touch-icon-32x32.png
68
+ -rw-rw-r-- 1 user user 2381 Sep 17 17:26 apple-touch-icon-32x32-precomposed.png
69
+ -rw-rw-r-- 1 user user 6634 Sep 17 17:26 apple-touch-icon-57x57.png
70
+ -rw-rw-r-- 1 user user 6634 Sep 17 17:26 apple-touch-icon-57x57-precomposed.png
71
+ -rw-rw-r-- 1 user user 9402 Sep 17 17:26 apple-touch-icon-70x70.png
72
+ -rw-rw-r-- 1 user user 9402 Sep 17 17:26 apple-touch-icon-70x70-precomposed.png
73
+ -rw-rw-r-- 1 user user 10832 Sep 17 17:26 apple-touch-icon-76x76.png
74
+ -rw-rw-r-- 1 user user 10832 Sep 17 17:26 apple-touch-icon-76x76-precomposed.png
75
+ -rw-rw-r-- 1 user user 15913 Sep 17 17:26 apple-touch-icon-96x96.png
76
+ -rw-rw-r-- 1 user user 15913 Sep 17 17:26 apple-touch-icon-96x96-precomposed.png
77
+ user@computer:~/apple_images$
78
+ ```
79
+
80
+ Example output from `gen-drawables` 's `drawable_images` folder:
81
+
82
+ ```
83
+ user@computer:~/drawable_images$ ls -l
84
+ total 40
85
+ -rw-r--r-- 1 user user 2908 Sep 18 17:23 drawable-hdpi-icon.png
86
+ -rw-r--r-- 1 user user 1318 Sep 18 17:23 drawable-ldpi-icon.png
87
+ -rw-r--r-- 1 user user 1796 Sep 18 17:23 drawable-mdpi-icon.png
88
+ -rw-r--r-- 1 user user 4228 Sep 18 17:23 drawable-xhdpi-icon.png
89
+ -rw-r--r-- 1 user user 7220 Sep 18 17:23 drawable-xxhdpi-icon.png
90
+ -rw-r--r-- 1 user user 10189 Sep 18 17:23 drawable-xxxhdpi-icon.png
91
+ user@computer:~/drawable_images$
33
92
  ```
34
93
 
35
94
  # Cloning/branching:
@@ -1,4 +1,4 @@
1
1
  module Rubyapple
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.1"
3
3
  end
4
4
 
data/lib/rubyapple.rb CHANGED
@@ -4,20 +4,49 @@ require 'fileutils'
4
4
 
5
5
  class Rubyapple
6
6
  def initialize
7
- if !File.directory?('apple_images/')
8
- puts "apple_images folder does not exist, please create it and run rubyapple again"
9
- puts "----"
10
- puts "rubyapple imagename.png"
11
- return
7
+ args = ARGV[0..-1]
8
+
9
+ unless !args[1]
10
+ image = Magick::Image.read(args[1])[0].strip!
11
+ end
12
+
13
+ case
14
+ when args[0] == 'help'
15
+ puts "initializing.. help"
16
+ puts ""
17
+ puts "rubyapple gen-apple-touch imagename.png"
18
+ puts " -- outputs apple-touch-icon-* files to apple_images/*"
19
+ puts ""
20
+ puts "rubyapple gen-drawables imagename.png"
21
+ puts " -- outputs drawable-* files to drawable_images/*"
22
+ puts ""
23
+ when args[0] == 'gen-apple-touch'
24
+ puts "initializing.. gen-apple-touch"
25
+ generate_apples(image)
26
+ when args[0] == 'gen-drawables'
27
+ puts "initializing.. gen-drawables"
28
+ generate_drawables(image)
29
+ end
30
+
31
+ unless args[0]
32
+ puts "correct syntax:"
33
+ puts " rubyapple type image.png"
34
+ puts "use 'rubyapple help' for more information"
12
35
  end
13
36
 
14
- img = Magick::Image.read(ARGV[0])[0].strip!
37
+ end
15
38
 
39
+ def generate_apples(img)
40
+ if !File.directory?('apple_images/')
41
+ puts "Creating folder apple_images..."
42
+ create_folder('apple_images')
43
+ end
16
44
  # apple-touch-icon-sizes.png
17
45
  sizes = [16, 32, 57, 70, 76, 96, 114, 120, 144, 152, 167, 180, 270, 310]
18
46
 
19
47
  temp = img
20
48
 
49
+ puts "Generating pictures.. apple-touch-icon-types"
21
50
  @numi = 0
22
51
  (0..sizes.length).each do |x|
23
52
  fsizes = "#{sizes[@numi]}x#{sizes[@numi]}"
@@ -30,6 +59,33 @@ class Rubyapple
30
59
  @numi += 1
31
60
  end
32
61
  end
62
+ puts "Done!"
63
+ end
33
64
 
65
+ def generate_drawables(img)
66
+ if !File.directory?('drawable_images/')
67
+ puts "Creating folder drawable_images..."
68
+ create_folder('drawable_images')
69
+ end
70
+
71
+ temp = img
72
+
73
+ path = "drawable_images/"
74
+
75
+ puts "Generating pictures.. drawable-types"
76
+
77
+ temp.resize_to_fill(36,36).write(path + "drawable-ldpi-icon.png")
78
+ temp.resize_to_fill(48,48).write(path + "drawable-mdpi-icon.png")
79
+ temp.resize_to_fill(72,72).write(path + "drawable-hdpi-icon.png")
80
+ temp.resize_to_fill(96,96).write(path + "drawable-xhdpi-icon.png")
81
+ temp.resize_to_fill(144,144).write(path + "drawable-xxhdpi-icon.png")
82
+ temp.resize_to_fill(192,192).write(path + "drawable-xxxhdpi-icon.png")
83
+
84
+ puts "Done!"
85
+ end
86
+
87
+ def create_folder(folname)
88
+ FileUtils.mkdir_p(folname)
34
89
  end
35
90
  end
91
+
data/rubyapple.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = %q{System command to logfile gem}
12
12
  spec.description = %q{A gem to convert argument picture into apple-touch-icon and -precomposed .png files}
13
- spec.homepage = "http://www.github.com/juksefantomet"
13
+ spec.homepage = "https://github.com/Juksefantomet/rubyapple"
14
14
  spec.license = "MIT"
15
15
 
16
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyapple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Grav
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-17 00:00:00.000000000 Z
11
+ date: 2018-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rmagick
@@ -109,7 +109,7 @@ files:
109
109
  - lib/rubyapple.rb
110
110
  - lib/rubyapple/version.rb
111
111
  - rubyapple.gemspec
112
- homepage: http://www.github.com/juksefantomet
112
+ homepage: https://github.com/Juksefantomet/rubyapple
113
113
  licenses:
114
114
  - MIT
115
115
  metadata: {}