calavicci 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.
data/README.md CHANGED
@@ -1,24 +1,26 @@
1
1
  # Calavicci
2
2
 
3
- TODO: Write a gem description
3
+ Wrapper to execute a drawable converter to convert high resolution Android resources to lower resolution resources.
4
4
 
5
- ## Installation
5
+ ## Prerequisites
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Must have [ImageMagick](http://www.imagemagick.org/script/index.php) installed on the machine on which you wish to use this gem. If you're on a Mac, make it easy on yourself and install it via [Homebrew](http://brew.sh):
8
8
 
9
- gem 'calavicci'
9
+ brew install imagemagick
10
10
 
11
- And then execute:
11
+ ## Installation
12
12
 
13
- $ bundle
13
+ gem install calavicci
14
14
 
15
- Or install it yourself as:
15
+ ## Usage
16
16
 
17
- $ gem install calavicci
17
+ Give calavicci the largest resolution resources you have. If you do not specify any output directories (`-d` flags), then it will automatically scale to mdpi and hdpi, based on the input directory you give it.
18
18
 
19
- ## Usage
19
+ calavicci ~/workspace/hello-world-android/res/drawable-xhdpi
20
+
21
+ Or, specify the output directories:
20
22
 
21
- TODO: Write usage instructions here
23
+ calavicci -d ~/workspace/hello-world-android/res/drawable-mhdpi -d ~/workspace/hello-world-android/res/drawable-hhdpi ~/workspace/hello-world-android/res/drawable-xhdpi
22
24
 
23
25
  ## Contributing
24
26
 
@@ -27,3 +29,7 @@ TODO: Write usage instructions here
27
29
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
30
  4. Push to the branch (`git push origin my-new-feature`)
29
31
  5. Create new Pull Request
32
+
33
+ ## Acknowledgement
34
+
35
+ The `drawable_convert.py` script has been adapted from the original script found at this GitHub Gist: https://gist.github.com/kmansoft/2771791
@@ -30,7 +30,7 @@ class Converter:
30
30
  print u'Dst list: {0}'.format(dstList)
31
31
  self.mDstList = dstList
32
32
 
33
- def convert(self, src):
33
+ def convertsrc(self, src):
34
34
  for dstpath in self.mDstList:
35
35
  (srcpath, srcname) = os.path.split(src)
36
36
  dst = os.path.join(dstpath, srcname)
@@ -49,7 +49,7 @@ class Converter:
49
49
  else:
50
50
  factor = dstDpi*100/srcDpi
51
51
  print u'Converting from {0}dpi to {1}dpi, {2}%'.format(srcDpi, dstDpi, factor)
52
- cmd = u'./bin/convert -verbose "{0}" -scale "{2}%" "{1}"'.format(src, dst, factor)
52
+ cmd = u'convert -verbose "{0}" -scale "{2}%" "{1}"'.format(src, dst, factor)
53
53
  out = subprocess.Popen(['sh', '-c', cmd])
54
54
  output,error = out.communicate()
55
55
 
@@ -81,4 +81,4 @@ if __name__ == "__main__":
81
81
  if src.endswith(suffix):
82
82
  print u'Skipping 9-patch: {0}'.format(src)
83
83
  else:
84
- cv.convert(src)
84
+ cv.convertsrc(src)
data/calavicci.gemspec CHANGED
@@ -8,13 +8,13 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Calavicci::VERSION
9
9
  spec.authors = ["Todd Grooms"]
10
10
  spec.email = ["todd.grooms@gmail.com"]
11
- spec.description = "The gist for the drawable_convert.py script can be found here: https://gist.github.com/kmansoft/2771791"
12
- spec.summary = "Wrapper to execute a drawable converter to convert xhdpi Android resources to lower resolution resources."
11
+ spec.description = "Wrapper to execute a drawable converter to convert high resolution Android resources to lower resolution resources."
12
+ spec.summary = "Wrapper to execute a drawable converter to convert high resolution Android resources to lower resolution resources."
13
13
  spec.homepage = "http://github.com/metova/calavicci"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
- spec.executables = ["calavicci", "convert", "drawable_convert.py"]
17
+ spec.executables = ["calavicci", "drawable_convert.py"]
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
data/lib/calavicci.rb CHANGED
@@ -2,7 +2,17 @@ require "calavicci/version"
2
2
  require 'optparse'
3
3
 
4
4
  module Calavicci
5
+
5
6
  class DrawableConverter
7
+
8
+ def root
9
+ File.expand_path '../..', __FILE__
10
+ end
11
+
12
+ def bin
13
+ File.join root, 'bin'
14
+ end
15
+
6
16
  def scale
7
17
  puts 'Scaling...'
8
18
 
@@ -32,8 +42,10 @@ module Calavicci
32
42
  end
33
43
  end
34
44
 
45
+ drawable_convert_python_script = "#{bin}/drawable_convert.py"
46
+ puts drawable_convert_python_script
35
47
  input_directory += "/*.png"
36
- python_command = "python bin/drawable_convert.py #{arguments}#{input_directory}"
48
+ python_command = "python #{drawable_convert_python_script} #{arguments}#{input_directory}"
37
49
 
38
50
  puts "Executing #{python_command}"
39
51
  result = exec(python_command)
@@ -1,3 +1,3 @@
1
1
  module Calavicci
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calavicci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,12 +43,12 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- description: ! 'The gist for the drawable_convert.py script can be found here: https://gist.github.com/kmansoft/2771791'
46
+ description: Wrapper to execute a drawable converter to convert high resolution Android
47
+ resources to lower resolution resources.
47
48
  email:
48
49
  - todd.grooms@gmail.com
49
50
  executables:
50
51
  - calavicci
51
- - convert
52
52
  - drawable_convert.py
53
53
  extensions: []
54
54
  extra_rdoc_files: []
@@ -58,12 +58,11 @@ files:
58
58
  - LICENSE.txt
59
59
  - README.md
60
60
  - Rakefile
61
+ - bin/calavicci
62
+ - bin/drawable_convert.py
61
63
  - calavicci.gemspec
62
64
  - lib/calavicci.rb
63
65
  - lib/calavicci/version.rb
64
- - bin/calavicci
65
- - bin/convert
66
- - bin/drawable_convert.py
67
66
  homepage: http://github.com/metova/calavicci
68
67
  licenses:
69
68
  - MIT
@@ -88,6 +87,6 @@ rubyforge_project:
88
87
  rubygems_version: 1.8.25
89
88
  signing_key:
90
89
  specification_version: 3
91
- summary: Wrapper to execute a drawable converter to convert xhdpi Android resources
92
- to lower resolution resources.
90
+ summary: Wrapper to execute a drawable converter to convert high resolution Android
91
+ resources to lower resolution resources.
93
92
  test_files: []
data/bin/convert DELETED
Binary file