motion-rubberstamp 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: a6463d3da785ed64e7ec4a0b167045ed429793cc
4
+ data.tar.gz: 02ae312158fcb47f975c6c9f79c4aa2d84ab4662
5
+ SHA512:
6
+ metadata.gz: 29dbe15bc3dbba71c7dd96905b75a5538390c797ad643f012ae683aebe5508d4733988800e26e938aa64f43474dfdc3b33210d9886f9eb1c1bf99b8ced906b75
7
+ data.tar.gz: ec78f993d75ea585ae43fb8b4f4ed67c91e398f498780bba99ca0f154fbfeef89bdfaebed4f914d39ee7188e59bbb804e17933237805d434589e12aa624735db
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 motion-rubberstamp.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Matt Garrison
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/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # Motion-Rubberstamp
2
+
3
+ This is aimed at being a development tool, it will create an
4
+ overlay for your iOS app icon that includes your version, commit
5
+ and branch information so you can know exactly what version of
6
+ your app is running on your device, or so that beta testers can
7
+ easily report which version they are running.
8
+
9
+ Here's what it does:
10
+
11
+ Before:
12
+ ![Before motion-rubberstamp](https://s3.amazonaws.com/iconoclastweb/github/icon_before.png "Before motion-rubberstamp")
13
+ After:
14
+ ![After motion-rubberstamp](https://s3.amazonaws.com/iconoclastweb/github/icon_after.png "After motion-rubberstamp")
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ gem 'motion-rubberstamp'
21
+
22
+ And then execute:
23
+
24
+ $ bundle
25
+
26
+ Or install it yourself as:
27
+
28
+ $ gem install motion-rubberstamp
29
+
30
+ This gem relies on imagemagick and ghostscript, which
31
+ can easily be installed via [Homebrew](http://mxcl.github.io/homebrew/):
32
+
33
+ $ brew install imagemagick
34
+
35
+ $ brew install ghostscript
36
+
37
+ ## Usage
38
+
39
+ First use the provided rake task to rename your Icon files (where * is @2x, -568h etc.) to Icon_base, e.g.
40
+ Icon@2x_base.png. This rake task automates it for you if your icons already exist:
41
+
42
+ $ rake rubberstamp:install
43
+
44
+ Then run the rake task to apply the overlay to your icons:
45
+
46
+ $ rake rubberstamp:run
47
+
48
+ Now when you next build your project, build information will be overlayed
49
+ as part of your icon.
50
+
51
+ Unfortunately it doesn't appear that there's a build hook system available for
52
+ RubyMotion so this will have to be ran manually before each build, or
53
+ you'll need to write a custom rake task to Rubberstamp your icons and
54
+ then invoke the build sequentially.
55
+
56
+ ## Contributing
57
+
58
+ I've probably made the file management more difficult and rigid than it needs to be, and I have no
59
+ clue how to write tests for this. But I'll gladly accept any help that's offered.
60
+
61
+ 1. Fork it
62
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
63
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
64
+ 4. Push to the branch (`git push origin my-new-feature`)
65
+ 5. Create new Pull Request
66
+
67
+ ## Thanks
68
+
69
+ Many thanks to Krzysztof Zabłocki and Evan Doll for the idea and
70
+ implementation
71
+ [details](http://www.merowing.info/2013/03/overlaying-application-version-on-top-of-your-icon/).
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,56 @@
1
+ require 'pathname'
2
+ require 'fileutils'
3
+
4
+ # Motion::Project::App.setup do |app|
5
+ # app.development do
6
+ # app.vendor_project File.join(File.dirname(__FILE__),"..",'..','framework'), :static
7
+ # end
8
+ # end
9
+
10
+ namespace :rubberstamp do
11
+ desc "Stamp iOS app icons with version and git information"
12
+ def process_icon(icon_name, caption)
13
+ # There's probably a better way to get this info, I'm not terribly familiar with Ruby's filesystem libs
14
+
15
+ # Resolve icon's full path
16
+ pwd = Pathname.pwd
17
+ filename = "#{pwd.realdirpath.to_s}/#{icon_name}"
18
+
19
+ if File.exist? filename
20
+ width= `identify -format '%w' #{filename}`.to_i
21
+ new_filename = filename.gsub('_base', '')
22
+ status = `convert -background '#0008' -fill white -gravity center -size #{width}x40\
23
+ caption:"#{caption}"\
24
+ #{filename} +swap -gravity south -composite #{new_filename}`
25
+ else
26
+ puts "File does not exist, you broke it."
27
+ end
28
+ end
29
+
30
+ task :run do
31
+ # piggyback on RubyMotion's own app config tool
32
+ project_config_vars = Motion::Project::App.config.variables
33
+ app_version = project_config_vars['version']
34
+ # execute shell commands to get git info
35
+ git_commit = `git rev-parse --short HEAD`
36
+ git_branch = `git rev-parse --abbrev-ref HEAD`
37
+
38
+ caption = "v#{app_version} #{git_commit} #{git_branch}"
39
+ # process_icon("Icon_base.png", caption)
40
+ # process_icon("Icon@2x_base.png", caption)
41
+ # process_icon("Icon-72_base.png", caption)
42
+ # process_icon("Icon-72@2x_base.png", caption)
43
+ Dir.glob('resources/*_base.png').each do |icon|
44
+ process_icon(icon, caption)
45
+ end
46
+ end
47
+
48
+ desc "Copy your current app icons to `_base` equivalent backups."
49
+ task :install do
50
+ icons = Dir.glob('resources/Icon*')
51
+ icons.each do |icon|
52
+ FileUtils.cp(icon, icon.gsub('.png', '_base.png'), :verbose => true)
53
+ end
54
+ end
55
+
56
+ end
@@ -0,0 +1,2 @@
1
+ require 'motion/project/rubberstamp'
2
+ require 'rubberstamp/version'
@@ -0,0 +1,4 @@
1
+ module Rubberstamp
2
+ VERSION = "0.0.1"
3
+ end
4
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rubberstamp/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "motion-rubberstamp"
8
+ spec.version = Rubberstamp::VERSION
9
+ spec.authors = ["Matt Garrison"]
10
+ spec.email = ["mattsgarrison@iconoclastlabs.com"]
11
+ spec.description = %q{Adds version and git information overlays to your iOS app icon}
12
+ spec.summary = %q{Adds version and git information overlays to your iOS app icon}
13
+ spec.homepage = "http://github.com/mattsgarrison/motion-rubberstamp"
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_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-rubberstamp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Matt Garrison
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Adds version and git information overlays to your iOS app icon
42
+ email:
43
+ - mattsgarrison@iconoclastlabs.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/motion-rubberstamp.rb
54
+ - lib/motion/project/rubberstamp.rb
55
+ - lib/rubberstamp/version.rb
56
+ - motion-rubberstamp.gemspec
57
+ homepage: http://github.com/mattsgarrison/motion-rubberstamp
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.0.0
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Adds version and git information overlays to your iOS app icon
81
+ test_files: []