gifme 0.0.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.
- data/README.md +56 -0
- data/Rakefile +105 -0
- data/bin/gifme +77 -0
- data/gifme.gemspec +67 -0
- metadata +70 -0
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# gifme
|
2
|
+
|
3
|
+

|
4
|
+
|
5
|
+
## Fucking animations. You need them.
|
6
|
+
|
7
|
+
gifme is a simple command line tool to generate animated GIFs.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Install gifme:
|
12
|
+
|
13
|
+
gem install gifme
|
14
|
+
|
15
|
+
You'll also need to install ImageMagick. On OS X, this is easy using Homebrew:
|
16
|
+
|
17
|
+
brew install imagemagick
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
gifme ~/Desktop/1.png ~/Desktop/2.png
|
22
|
+
You now have a handsome animation at ~/Desktop/animated.gif
|
23
|
+
|
24
|
+
You can also glob, of course:
|
25
|
+
|
26
|
+
gifme ~/Desktop/*.jpg
|
27
|
+
You now have a handsome animation at ~/Desktop/animated.gif
|
28
|
+
|
29
|
+
## CloudApp
|
30
|
+
|
31
|
+
Once your animation is finished up, we'll try to upload it to
|
32
|
+
[CloudApp](http://www.getcloudapp.com). If you have my
|
33
|
+
[`cloudapp`](https://github.com/holman/dotfiles/blob/master/bin/cloudapp)
|
34
|
+
script installed, we'll use that, otherwise we'll just skip this whole step.
|
35
|
+
|
36
|
+
## Super Advanced Usage
|
37
|
+
|
38
|
+
There's a few options you have available to you to let you tweak how your gif
|
39
|
+
is created. Just run:
|
40
|
+
|
41
|
+
gifme -h
|
42
|
+
|
43
|
+
## History
|
44
|
+
|
45
|
+
If you're curious, gifme was initially a few-line shell script in [my
|
46
|
+
dotfiles](https://github.com/holman/dotfiles). Eventually it became clear that
|
47
|
+
animation is a fundamental part of our society, and I split it out into its own
|
48
|
+
tiny project.
|
49
|
+
|
50
|
+
If you're curious, I featured the older gifme version [in a
|
51
|
+
screencast](http://zachholman.com/2011/01/automating-inefficiencies/) I made
|
52
|
+
that describes how animated gifs are an integral part of working at GitHub.
|
53
|
+
|
54
|
+
## Much Love
|
55
|
+
|
56
|
+
From [@holman](https://twitter.com/holman). I love you.
|
data/Rakefile
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
#############################################################################
|
6
|
+
#
|
7
|
+
# Helper functions
|
8
|
+
#
|
9
|
+
#############################################################################
|
10
|
+
|
11
|
+
def name
|
12
|
+
@name ||= Dir['*.gemspec'].first.split('.').first
|
13
|
+
end
|
14
|
+
|
15
|
+
def version
|
16
|
+
"0.0.1"
|
17
|
+
end
|
18
|
+
|
19
|
+
def date
|
20
|
+
Date.today.to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
def rubyforge_project
|
24
|
+
name
|
25
|
+
end
|
26
|
+
|
27
|
+
def gemspec_file
|
28
|
+
"#{name}.gemspec"
|
29
|
+
end
|
30
|
+
|
31
|
+
def gem_file
|
32
|
+
"#{name}-#{version}.gem"
|
33
|
+
end
|
34
|
+
|
35
|
+
def replace_header(head, header_name)
|
36
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
37
|
+
end
|
38
|
+
|
39
|
+
#############################################################################
|
40
|
+
#
|
41
|
+
# Packaging tasks
|
42
|
+
#
|
43
|
+
#############################################################################
|
44
|
+
|
45
|
+
desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
|
46
|
+
task :release => :build do
|
47
|
+
unless `git branch` =~ /^\* master$/
|
48
|
+
puts "You must be on the master branch to release!"
|
49
|
+
exit!
|
50
|
+
end
|
51
|
+
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
52
|
+
sh "git tag v#{version}"
|
53
|
+
sh "git push origin master"
|
54
|
+
sh "git push origin v#{version}"
|
55
|
+
sh "gem push pkg/#{name}-#{version}.gem"
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "Build #{gem_file} into the pkg directory"
|
59
|
+
task :build => :gemspec do
|
60
|
+
sh "mkdir -p pkg"
|
61
|
+
sh "gem build #{gemspec_file}"
|
62
|
+
sh "mv #{gem_file} pkg"
|
63
|
+
end
|
64
|
+
|
65
|
+
desc "Generate #{gemspec_file}"
|
66
|
+
task :gemspec => :validate do
|
67
|
+
# read spec file and split out manifest section
|
68
|
+
spec = File.read(gemspec_file)
|
69
|
+
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
70
|
+
|
71
|
+
# replace name version and date
|
72
|
+
replace_header(head, :name)
|
73
|
+
replace_header(head, :version)
|
74
|
+
replace_header(head, :date)
|
75
|
+
#comment this out if your rubyforge_project has a different name
|
76
|
+
replace_header(head, :rubyforge_project)
|
77
|
+
|
78
|
+
# determine file list from git ls-files
|
79
|
+
files = `git ls-files`.
|
80
|
+
split("\n").
|
81
|
+
sort.
|
82
|
+
reject { |file| file =~ /^\./ }.
|
83
|
+
reject { |file| file =~ /^(rdoc|pkg)/ }.
|
84
|
+
map { |file| " #{file}" }.
|
85
|
+
join("\n")
|
86
|
+
|
87
|
+
# piece file back together and write
|
88
|
+
manifest = " s.files = %w[\n#{files}\n ]\n"
|
89
|
+
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
90
|
+
File.open(gemspec_file, 'w') { |io| io.write(spec) }
|
91
|
+
puts "Updated #{gemspec_file}"
|
92
|
+
end
|
93
|
+
|
94
|
+
desc "Validate #{gemspec_file}"
|
95
|
+
task :validate do
|
96
|
+
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
|
97
|
+
unless libfiles.empty?
|
98
|
+
puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
|
99
|
+
exit!
|
100
|
+
end
|
101
|
+
unless Dir['VERSION*'].empty?
|
102
|
+
puts "A `VERSION` file at root level violates Gem best practices."
|
103
|
+
exit!
|
104
|
+
end
|
105
|
+
end
|
data/bin/gifme
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
options = {
|
6
|
+
:output => "#{ENV['HOME']}/Desktop/animated.gif",
|
7
|
+
:reverse => false,
|
8
|
+
:resize => true,
|
9
|
+
:delay => 20,
|
10
|
+
:cloudapp => system("which cloudapp 2>&1 > /dev/null")
|
11
|
+
}
|
12
|
+
|
13
|
+
parser = OptionParser.new do |opts|
|
14
|
+
opts.banner = "Usage: gifme [options] FILES"
|
15
|
+
|
16
|
+
opts.separator ""
|
17
|
+
opts.separator " FILES can be listed out, like `file1.jpg file2.jpg`, or it"
|
18
|
+
opts.separator " can be a normal shell glob, like `*.jpg`."
|
19
|
+
|
20
|
+
opts.separator ""
|
21
|
+
opts.separator "Options:"
|
22
|
+
|
23
|
+
opts.on("-r", "--reverse", "Reverse the GIF to make it loopable") do |reverse|
|
24
|
+
options[:reverse] = true
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on("-o", "--output /path/to/output", "Set the animation's output directory") do |out|
|
28
|
+
options[:output] = out
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on("-d", "--delay DELAY", "Set the delay between frames (default: 20)") do |delay|
|
32
|
+
options[:delay] = delay
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on("--noresize", "Don't resize the final animation (set to 500px wide") do |nrs|
|
36
|
+
options[:resize] = false
|
37
|
+
end
|
38
|
+
|
39
|
+
opts.on("-h", "--help", "Show this message") do
|
40
|
+
puts opts
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
parser.parse!
|
46
|
+
args = *ARGV.join(" ")
|
47
|
+
|
48
|
+
unless system("which convert 2>&1 > /dev/null")
|
49
|
+
puts "You need to install ImageMagick first.\n\n"
|
50
|
+
puts "If you're on a Mac, this should be as easy as:"
|
51
|
+
puts " brew install imagemagick"
|
52
|
+
exit(1)
|
53
|
+
end
|
54
|
+
|
55
|
+
unless args
|
56
|
+
puts parser.help
|
57
|
+
exit(1)
|
58
|
+
end
|
59
|
+
|
60
|
+
cmd = "convert"
|
61
|
+
cmd += " -delay #{options[:delay]}"
|
62
|
+
cmd += " -loop 0"
|
63
|
+
cmd += " -resize 500" if options[:resize]
|
64
|
+
cmd += " -layers OptimizeTransparency"
|
65
|
+
cmd += " #{args}"
|
66
|
+
cmd += " #{options[:output]}"
|
67
|
+
|
68
|
+
if system(cmd)
|
69
|
+
puts "You now have a handsome animation at #{options[:output]}"
|
70
|
+
else
|
71
|
+
puts "Something broke when we were animating your gif. Shit."
|
72
|
+
end
|
73
|
+
|
74
|
+
if options[:cloudapp]
|
75
|
+
puts "Now we're uploading it to CloudApp"
|
76
|
+
system "cloudapp #{options[:output]}"
|
77
|
+
end
|
data/gifme.gemspec
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
## This is the rakegem gemspec template. Make sure you read and understand
|
2
|
+
## all of the comments. Some sections require modification, and others can
|
3
|
+
## be deleted if you don't need them. Once you understand the contents of
|
4
|
+
## this file, feel free to delete any comments that begin with two hash marks.
|
5
|
+
## You can find comprehensive Gem::Specification documentation, at
|
6
|
+
## http://docs.rubygems.org/read/chapter/20
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
9
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
|
+
s.rubygems_version = '1.3.5'
|
11
|
+
|
12
|
+
## Leave these as is they will be modified for you by the rake gemspec task.
|
13
|
+
## If your rubyforge_project name is different, then edit it and comment out
|
14
|
+
## the sub! line in the Rakefile
|
15
|
+
s.name = 'gifme'
|
16
|
+
s.version = '0.0.1'
|
17
|
+
s.date = '2011-05-23'
|
18
|
+
s.rubyforge_project = 'gifme'
|
19
|
+
|
20
|
+
## Make sure your summary is short. The description may be as long
|
21
|
+
## as you like.
|
22
|
+
s.summary = "Fucking animations. You need them."
|
23
|
+
s.description = "A command-line way to generate really fucking cool gifs."
|
24
|
+
|
25
|
+
## List the primary authors. If there are a bunch of authors, it's probably
|
26
|
+
## better to set the email to an email list or something. If you don't have
|
27
|
+
## a custom homepage, consider using your GitHub URL or the like.
|
28
|
+
s.authors = ["Zach Holman"]
|
29
|
+
s.email = 'hello@zachholman.com'
|
30
|
+
s.homepage = 'https://github.com/holman/gifme'
|
31
|
+
|
32
|
+
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
33
|
+
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
34
|
+
#s.require_paths = %w[lib]
|
35
|
+
|
36
|
+
## If your gem includes any executables, list them here.
|
37
|
+
s.executables = ["gifme"]
|
38
|
+
|
39
|
+
## Specify any RDoc options here. You'll want to add your README and
|
40
|
+
## LICENSE files to the extra_rdoc_files list.
|
41
|
+
#s.rdoc_options = ["--charset=UTF-8"]
|
42
|
+
#s.extra_rdoc_files = %w[README LICENSE]
|
43
|
+
|
44
|
+
## List your runtime dependencies here. Runtime dependencies are those
|
45
|
+
## that are needed for an end user to actually USE your code.
|
46
|
+
#s.add_dependency('DEPNAME', [">= 1.1.0", "< 2.0.0"])
|
47
|
+
|
48
|
+
## List your development dependencies here. Development dependencies are
|
49
|
+
## those that are only needed during development
|
50
|
+
#s.add_development_dependency('DEVDEPNAME', [">= 1.1.0", "< 2.0.0"])
|
51
|
+
|
52
|
+
## Leave this section as-is. It will be automatically generated from the
|
53
|
+
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
54
|
+
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
55
|
+
# = MANIFEST =
|
56
|
+
s.files = %w[
|
57
|
+
README.md
|
58
|
+
Rakefile
|
59
|
+
bin/gifme
|
60
|
+
gifme.gemspec
|
61
|
+
]
|
62
|
+
# = MANIFEST =
|
63
|
+
|
64
|
+
## Test files will be grabbed from the file list. Make sure the path glob
|
65
|
+
## matches what you actually use.
|
66
|
+
#s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gifme
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Zach Holman
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-05-23 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: A command-line way to generate really fucking cool gifs.
|
23
|
+
email: hello@zachholman.com
|
24
|
+
executables:
|
25
|
+
- gifme
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- README.md
|
32
|
+
- Rakefile
|
33
|
+
- bin/gifme
|
34
|
+
- gifme.gemspec
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: https://github.com/holman/gifme
|
37
|
+
licenses: []
|
38
|
+
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
hash: 3
|
50
|
+
segments:
|
51
|
+
- 0
|
52
|
+
version: "0"
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project: gifme
|
65
|
+
rubygems_version: 1.6.2
|
66
|
+
signing_key:
|
67
|
+
specification_version: 2
|
68
|
+
summary: Fucking animations. You need them.
|
69
|
+
test_files: []
|
70
|
+
|