pix_scale 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cb50894f1af47cd67e9443fd3480faf5cb7fafa8
4
+ data.tar.gz: 2d468a6b9889dff7e5b72534b0ee28009074fcbf
5
+ SHA512:
6
+ metadata.gz: 313940b2db000059ea3d756091f896cf5585348c9b2c48bfc9b27f9f2cf1b97a8816bf09809b96f98e8f94562014ef77205136679c818d0e423f6e3cdde1cdc9
7
+ data.tar.gz: ca656d6a33bc8dc425819fda854378b96a87e9ccdc9cdf7efeae395ecd7b44b24271d1afd5a946e8d39dc33a71da55dcdaceff11c6618fe1015df6d96c8d51b7
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pix_scale.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Masafumi Yokoyama
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/NEWS.md ADDED
@@ -0,0 +1,5 @@
1
+ # NEWS
2
+
3
+ ## 0.0.1: 2013-06-27
4
+
5
+ Initial release!
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # PixScale
2
+
3
+ A command line tool for scale of pix.
4
+
5
+ ## Requirements
6
+
7
+ * Ruby/GdkPixbuf2 in
8
+ [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/)
9
+
10
+ ## Installation
11
+
12
+ gem install pix_scale
13
+
14
+ ## Usage
15
+
16
+ % ls -l
17
+ -rw-rw-r-- 1 you you 46643 6 27 20:00 foo.png
18
+ -rw-rw-r-- 1 you you 31438 6 27 20:00 bar.png
19
+
20
+ % pix_scale *.png 0.5
21
+
22
+ % ls -l
23
+ -rw-rw-r-- 1 you you 46643 6 27 20:00 foo.png
24
+ -rw-rw-r-- 1 you you 18539 6 27 20:01 foo-0.5.png
25
+ -rw-rw-r-- 1 you you 31438 6 27 20:00 bar.png
26
+ -rw-rw-r-- 1 you you 16462 6 27 20:01 bar-0.5.png
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork it
31
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
32
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
33
+ 4. Push to the branch (`git push origin my-new-feature`)
34
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/pix_scale ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "pix_scale/command"
4
+
5
+ PixScale::Command.run(*ARGV)
data/lib/pix_scale.rb ADDED
@@ -0,0 +1 @@
1
+ require "pix_scale/version"
@@ -0,0 +1,34 @@
1
+ require "gdk_pixbuf2"
2
+ require "pix_scale/version"
3
+
4
+ module PixScale
5
+ class Command
6
+ def self.run(*arguments)
7
+ if /\A(-h|--help)\z/ =~ arguments[0]
8
+ puts <<-EOM
9
+ Usage: pix_scale FILE... SCALE
10
+ Example: pix_scale foo.png 0.5
11
+ EOM
12
+ exit(true)
13
+ elsif /\A(-v|--version)\z/ =~ arguments[0]
14
+ puts PixScale::VERSION
15
+ exit(true)
16
+ end
17
+
18
+ scale = arguments.pop.to_f
19
+
20
+ arguments.each do |pic_path|
21
+ dirname = File.dirname(pic_path)
22
+ basename = File.basename(pic_path, ".*")
23
+ extname = File.extname(pic_path).sub(/^\./, "")
24
+
25
+ pic = Gdk::Pixbuf.new(pic_path)
26
+ scaled_pic = pic.scale(pic.width * scale, pic.height * scale)
27
+
28
+ output_path = "#{dirname}/#{basename}-#{scale.to_s}#{extname}"
29
+ type = (/\Ajpg\z/ =~ extname) ? "jpeg" : extname
30
+ scaled_pic.save(output_path, type)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ module PixScale
2
+ VERSION = "0.0.1"
3
+ end
data/pix_scale.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pix_scale/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pix_scale"
8
+ spec.version = PixScale::VERSION
9
+ spec.authors = ["Masafumi Yokoyama"]
10
+ spec.email = ["myokoym@gmail.com"]
11
+ spec.description = %q{A command line tool for scale of pix.}
12
+ spec.summary = %q{A command line tool for scale of pix.}
13
+ spec.homepage = "https://github.com/myokoym/pix_scale"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency("gdk_pixbuf2")
22
+
23
+ spec.add_development_dependency("bundler", "~> 1.3")
24
+ spec.add_development_dependency("rake")
25
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pix_scale
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Masafumi Yokoyama
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gdk_pixbuf2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A command line tool for scale of pix.
56
+ email:
57
+ - myokoym@gmail.com
58
+ executables:
59
+ - pix_scale
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - NEWS.md
67
+ - README.md
68
+ - Rakefile
69
+ - bin/pix_scale
70
+ - lib/pix_scale.rb
71
+ - lib/pix_scale/command.rb
72
+ - lib/pix_scale/version.rb
73
+ - pix_scale.gemspec
74
+ homepage: https://github.com/myokoym/pix_scale
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.0.3
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: A command line tool for scale of pix.
98
+ test_files: []
99
+ has_rdoc: