captured 0.1.0
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/LICENSE +20 -0
- data/README.markdown +16 -0
- data/bin/captured +106 -0
- data/etc/captured.yml-example +50 -0
- data/etc/launchd.plist.erb +21 -0
- data/spec/captured_spec.rb +7 -0
- data/spec/spec_helper.rb +9 -0
- metadata +60 -0
data/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2009 Christopher Sexton
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
captured
|
|
2
|
+
========
|
|
3
|
+
|
|
4
|
+
Quick screen capture and sharing application for Mac OS X.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Icon
|
|
8
|
+
====
|
|
9
|
+
|
|
10
|
+
Icons from the [Crystal Clear](http://www.everaldo.com/crystal/) icon set by [Everaldo Coelho](http://en.wikipedia.org/wiki/Everaldo_Coelho). – The icons are [licensed](http://www.everaldo.com/crystal/?action=license) under the [GNU Lesser General Public License (LGPL)](http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License).
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Copyright
|
|
14
|
+
=========
|
|
15
|
+
|
|
16
|
+
Copyright (c) 2009 Christopher Sexton. See LICENSE for details.
|
data/bin/captured
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'optparse'
|
|
4
|
+
|
|
5
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
|
6
|
+
require 'captured'
|
|
7
|
+
|
|
8
|
+
options = {:config_file => "#{ENV['HOME']}/.captured.yml",
|
|
9
|
+
:watch_path => "#{ENV['HOME']}/Desktop/",
|
|
10
|
+
:watch_pattern => "Screenshot**.png",
|
|
11
|
+
:growl_path => "/usr/local/bin/growlnotify" }
|
|
12
|
+
|
|
13
|
+
OptionParser.new do |opts|
|
|
14
|
+
opts.summary_width = 25
|
|
15
|
+
|
|
16
|
+
opts.banner = "captured: Quick screen capture and sharing on OS X"
|
|
17
|
+
opts.banner = " <filename> Quick upload"
|
|
18
|
+
|
|
19
|
+
opts.on('--help', "Print this message") do
|
|
20
|
+
puts "#{opts}\n"
|
|
21
|
+
exit
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
opts.on('--config-file=FILE', "Config file (Default: #{options[:config_file]})") do |file|
|
|
25
|
+
options[:config_file] = file
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
opts.on('--watch-path=PATH', "Path to watch (Default: #{options[:watch_path]})") do |path|
|
|
29
|
+
options[:watch_path] = path
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
opts.on('--watch-pattern=PATTERN', "Pattern to match (Default: #{options[:watch_pattern]})") do |path|
|
|
33
|
+
options[:watch_path] = path
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
opts.on('--growlnotify=PATH', "Path to growlnotify (Default: #{options[:growl_path]})") do |file|
|
|
37
|
+
options[:growl_path] = file
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
opts.on('--install', "Run at startup") do
|
|
41
|
+
options[:install] = true
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
opts.on('--remove', "Remove captured from launchd") do
|
|
45
|
+
puts "Uninstalling captured"
|
|
46
|
+
File.delete "#{ENV['HOME']}/Library/LaunchAgents/com.github.csexton.captured"
|
|
47
|
+
system "launchctl remove com.github.csexton.captured"
|
|
48
|
+
exit
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
opts.on('--launchd', "Indicate that this was invoked via launchd") do
|
|
52
|
+
options[:launchd] = true
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
opts.on('--watch', "Create a run loop that will watch for screenshots") do
|
|
56
|
+
options[:launchd] = true
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
opts.on('--config', "Install a config file to #{Captured.config_file}") do
|
|
60
|
+
puts "install config file!"
|
|
61
|
+
if (!File.exists? Captured.config_file)
|
|
62
|
+
FileUtils.copy("#{File.dirname(__FILE__)}/../etc/captured.yml-example", Captured.config_file)
|
|
63
|
+
end
|
|
64
|
+
exit
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end.parse!
|
|
68
|
+
|
|
69
|
+
if options[:install] == true
|
|
70
|
+
puts "Installing captured"
|
|
71
|
+
require 'erb'
|
|
72
|
+
require 'pathname'
|
|
73
|
+
if (File.exists? options[:config_file])
|
|
74
|
+
puts "Found existing config file at #{options[:config_file]}"
|
|
75
|
+
else
|
|
76
|
+
FileUtils.copy("#{File.dirname(__FILE__)}/../etc/captured.yml-example", options[:config_file])
|
|
77
|
+
puts "Copied example config file to #{options[:config_file]}"
|
|
78
|
+
end
|
|
79
|
+
program_path = Pathname.new($0).realpath
|
|
80
|
+
watch_path = options[:watch_path]
|
|
81
|
+
plist_path = "#{ENV['HOME']}/Library/LaunchAgents/"
|
|
82
|
+
template = ERB.new(File.open("#{File.dirname(__FILE__)}/../etc/launchd.plist.erb", 'r').read)
|
|
83
|
+
FileUtils.mkdir_p plist_path
|
|
84
|
+
File.open("#{plist_path}/com.github.csexton.captured", 'w') do |f|
|
|
85
|
+
f.write(template.result(binding))
|
|
86
|
+
end
|
|
87
|
+
system "launchctl load ~/Library/LaunchAgents"
|
|
88
|
+
exit
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if options[:launchd] == true
|
|
92
|
+
Captured::run_once! options
|
|
93
|
+
exit
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
if options[:watch] == true
|
|
97
|
+
Captured::run_and_watch! options
|
|
98
|
+
exit
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if ARGV[0] && File.exists?(ARGV[0])
|
|
102
|
+
FileUploader.upload(ARGV[0], options)
|
|
103
|
+
exit
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
puts "Invalid option, run `captured --help` for usage"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Example captured configuration file
|
|
2
|
+
#
|
|
3
|
+
# Eval
|
|
4
|
+
# ====
|
|
5
|
+
#
|
|
6
|
+
# Complete control for the complete nerd. This allows you to execute arbtrary
|
|
7
|
+
# ruby code when a matching file is found. Normally this would be used to
|
|
8
|
+
# invoke a command line upload (such as scp, curl, etc).
|
|
9
|
+
#
|
|
10
|
+
# One advantage with calling scp this way is it will be aware of all the custom
|
|
11
|
+
# settings made in ~/.ssh/config.
|
|
12
|
+
#
|
|
13
|
+
# You have access to two local varibles:
|
|
14
|
+
# * file - the local file to upload
|
|
15
|
+
# * remote_name - the hashed name to use on the server
|
|
16
|
+
#
|
|
17
|
+
# Simple scp via eval command
|
|
18
|
+
|
|
19
|
+
#upload:
|
|
20
|
+
# type: eval
|
|
21
|
+
# command: system "scp '#{file}' 'user@example.com:example.com/captured/#{remote_name}'"
|
|
22
|
+
# url: "http://example.com/captured/"
|
|
23
|
+
|
|
24
|
+
# Curl post to twitpic.com
|
|
25
|
+
|
|
26
|
+
#upload:
|
|
27
|
+
# type: eval
|
|
28
|
+
# url: "http://twitter.com/user/"
|
|
29
|
+
# command: |
|
|
30
|
+
# remote_path="http://twitter.com/user"
|
|
31
|
+
# system "curl -F media='@#{file}' -F username=user -F password=secret -F message=Captured http://twitpic.com/api/uploadAndPost"
|
|
32
|
+
#
|
|
33
|
+
# scp
|
|
34
|
+
# ===
|
|
35
|
+
#
|
|
36
|
+
# Standard scp, using the ruby net/ssh library.
|
|
37
|
+
#
|
|
38
|
+
# * user - optinal if your remote user is the same as your local user
|
|
39
|
+
# * password - optional if you have setup key pair authentication
|
|
40
|
+
# * host - the remote host name
|
|
41
|
+
# * url - the public url to the remote host+path
|
|
42
|
+
# * path - the remote path to upload to
|
|
43
|
+
|
|
44
|
+
#upload:
|
|
45
|
+
# type: scp
|
|
46
|
+
# user: user
|
|
47
|
+
# host: example.com
|
|
48
|
+
# path: example.com/captured/
|
|
49
|
+
# url: "http://example.com/captured/"
|
|
50
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>Label</key>
|
|
6
|
+
<string>com.github.csexton.captured</string>
|
|
7
|
+
<key>LowPriorityIO</key>
|
|
8
|
+
<true/>
|
|
9
|
+
<key>Program</key>
|
|
10
|
+
<string><%= program_path %></string>
|
|
11
|
+
<key>ProgramArguments</key>
|
|
12
|
+
<array>
|
|
13
|
+
<string>captured</string>
|
|
14
|
+
<string>--launchd</string>
|
|
15
|
+
</array>
|
|
16
|
+
<key>WatchPaths</key>
|
|
17
|
+
<array>
|
|
18
|
+
<string><%= watch_path %></string>
|
|
19
|
+
</array>
|
|
20
|
+
</dict>
|
|
21
|
+
</plist>
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: captured
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Christopher Sexton
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-06-25 00:00:00 -04:00
|
|
13
|
+
default_executable: captured
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
description:
|
|
17
|
+
email: csexton@gmail.com
|
|
18
|
+
executables:
|
|
19
|
+
- captured
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files:
|
|
23
|
+
- LICENSE
|
|
24
|
+
- README.markdown
|
|
25
|
+
files:
|
|
26
|
+
- etc/captured.yml-example
|
|
27
|
+
- etc/launchd.plist.erb
|
|
28
|
+
- LICENSE
|
|
29
|
+
- README.markdown
|
|
30
|
+
has_rdoc: true
|
|
31
|
+
homepage: http://github.com/csexton/captured
|
|
32
|
+
licenses: []
|
|
33
|
+
|
|
34
|
+
post_install_message:
|
|
35
|
+
rdoc_options:
|
|
36
|
+
- --charset=UTF-8
|
|
37
|
+
require_paths:
|
|
38
|
+
- lib
|
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: "0"
|
|
44
|
+
version:
|
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: "0"
|
|
50
|
+
version:
|
|
51
|
+
requirements: []
|
|
52
|
+
|
|
53
|
+
rubyforge_project: captured
|
|
54
|
+
rubygems_version: 1.3.4
|
|
55
|
+
signing_key:
|
|
56
|
+
specification_version: 3
|
|
57
|
+
summary: Quick screenshot sharing for OS X
|
|
58
|
+
test_files:
|
|
59
|
+
- spec/captured_spec.rb
|
|
60
|
+
- spec/spec_helper.rb
|