castanaut 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +12 -1
- data/README.txt +41 -18
- data/bin/castanaut +0 -0
- data/cbin/osxautomation +0 -0
- data/lib/castanaut/exceptions.rb +14 -3
- data/lib/castanaut/keys.rb +3 -2
- data/lib/castanaut/main.rb +3 -3
- data/lib/castanaut/movie.rb +305 -175
- data/lib/castanaut/os/mac_os_x.rb +336 -0
- data/lib/castanaut/os/mac_os_x_legacy.rb +223 -0
- data/lib/castanaut/plugin.rb +2 -2
- data/lib/castanaut.rb +53 -57
- data/lib/plugins/ishowuhd.rb +98 -0
- data/lib/plugins/keystack.rb +111 -0
- data/lib/plugins/mousepose.rb +1 -1
- data/lib/plugins/safari.rb +67 -20
- data/lib/plugins/snapz_pro.rb +55 -0
- data/lib/plugins/terminal.rb +55 -0
- data/lib/plugins/textmate.rb +65 -0
- data/test/helper.rb +12 -0
- data/test/main_test.rb +13 -0
- data/test/movie_test.rb +67 -0
- metadata +32 -27
- data/Manifest.txt +0 -31
- data/Rakefile +0 -25
- data/tasks/ann.rake +0 -77
- data/tasks/annotations.rake +0 -22
- data/tasks/doc.rake +0 -49
- data/tasks/gem.rake +0 -110
- data/tasks/manifest.rake +0 -50
- data/tasks/post_load.rake +0 -18
- data/tasks/rubyforge.rake +0 -57
- data/tasks/setup.rb +0 -221
- data/tasks/spec.rake +0 -43
- data/tasks/svn.rake +0 -44
- data/tasks/test.rake +0 -40
- data/test/example_script.screenplay +0 -91
- data/test/googling.screenplay +0 -34
data/tasks/setup.rb
DELETED
@@ -1,221 +0,0 @@
|
|
1
|
-
# $Id$
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'rake'
|
5
|
-
require 'fileutils'
|
6
|
-
require 'ostruct'
|
7
|
-
|
8
|
-
PROJ = OpenStruct.new
|
9
|
-
|
10
|
-
PROJ.name = nil
|
11
|
-
PROJ.summary = nil
|
12
|
-
PROJ.description = nil
|
13
|
-
PROJ.changes = nil
|
14
|
-
PROJ.authors = nil
|
15
|
-
PROJ.email = nil
|
16
|
-
PROJ.url = nil
|
17
|
-
PROJ.version = ENV['VERSION'] || '0.0.0'
|
18
|
-
PROJ.rubyforge_name = nil
|
19
|
-
PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/ announcement.txt)
|
20
|
-
PROJ.release_name = ENV['RELEASE']
|
21
|
-
|
22
|
-
# Rspec
|
23
|
-
PROJ.specs = FileList['spec/**/*_spec.rb']
|
24
|
-
PROJ.spec_opts = []
|
25
|
-
|
26
|
-
# Test::Unit
|
27
|
-
PROJ.tests = FileList['test/**/test_*.rb']
|
28
|
-
PROJ.test_file = 'test/all.rb'
|
29
|
-
PROJ.test_opts = []
|
30
|
-
|
31
|
-
# Rcov
|
32
|
-
PROJ.rcov_opts = ['--sort', 'coverage', '-T']
|
33
|
-
|
34
|
-
# Rdoc
|
35
|
-
PROJ.rdoc_opts = []
|
36
|
-
PROJ.rdoc_include = %w(^lib/ ^bin/ ^ext/ .txt$)
|
37
|
-
PROJ.rdoc_exclude = %w(extconf.rb$ ^Manifest.txt$)
|
38
|
-
PROJ.rdoc_main = 'README.txt'
|
39
|
-
PROJ.rdoc_dir = 'doc'
|
40
|
-
PROJ.rdoc_remote_dir = nil
|
41
|
-
|
42
|
-
# Extensions
|
43
|
-
PROJ.extensions = FileList['ext/**/extconf.rb']
|
44
|
-
PROJ.ruby_opts = %w(-w)
|
45
|
-
PROJ.libs = []
|
46
|
-
%w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
|
47
|
-
|
48
|
-
# Gem Packaging
|
49
|
-
PROJ.files =
|
50
|
-
if test ?f, 'Manifest.txt'
|
51
|
-
files = File.readlines('Manifest.txt').map {|fn| fn.chomp.strip}
|
52
|
-
files.delete ''
|
53
|
-
files
|
54
|
-
else [] end
|
55
|
-
PROJ.executables = PROJ.files.find_all {|fn| fn =~ %r/^bin/}
|
56
|
-
PROJ.dependencies = []
|
57
|
-
PROJ.need_tar = true
|
58
|
-
PROJ.need_zip = false
|
59
|
-
PROJ.post_install_message = nil
|
60
|
-
|
61
|
-
# File Annotations
|
62
|
-
PROJ.annotation_exclude = %w(^tasks/setup.rb$)
|
63
|
-
PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
|
64
|
-
PROJ.annotation_tags = %w(FIXME OPTIMIZE TODO)
|
65
|
-
|
66
|
-
# Subversion Repository
|
67
|
-
PROJ.svn = false
|
68
|
-
PROJ.svn_root = nil
|
69
|
-
PROJ.svn_trunk = 'trunk'
|
70
|
-
PROJ.svn_tags = 'tags'
|
71
|
-
PROJ.svn_branches = 'branches'
|
72
|
-
|
73
|
-
# Announce
|
74
|
-
PROJ.ann_text = nil
|
75
|
-
PROJ.ann_paragraphs = []
|
76
|
-
PROJ.ann_email = {
|
77
|
-
:from => nil,
|
78
|
-
:to => %w(ruby-talk@ruby-lang.org),
|
79
|
-
:server => 'localhost',
|
80
|
-
:port => 25,
|
81
|
-
:domain => ENV['HOSTNAME'],
|
82
|
-
:acct => nil,
|
83
|
-
:passwd => nil,
|
84
|
-
:authtype => :plain
|
85
|
-
}
|
86
|
-
|
87
|
-
# Load the other rake files in the tasks folder
|
88
|
-
rakefiles = Dir.glob('tasks/*.rake').sort
|
89
|
-
rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
|
90
|
-
import(*rakefiles)
|
91
|
-
|
92
|
-
# Setup some constants
|
93
|
-
WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
|
94
|
-
|
95
|
-
DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
|
96
|
-
|
97
|
-
def quiet( &block )
|
98
|
-
io = [STDOUT.dup, STDERR.dup]
|
99
|
-
STDOUT.reopen DEV_NULL
|
100
|
-
STDERR.reopen DEV_NULL
|
101
|
-
block.call
|
102
|
-
ensure
|
103
|
-
STDOUT.reopen io.first
|
104
|
-
STDERR.reopen io.last
|
105
|
-
end
|
106
|
-
|
107
|
-
DIFF = if WIN32 then 'diff.exe'
|
108
|
-
else
|
109
|
-
if quiet {system "gdiff", __FILE__, __FILE__} then 'gdiff'
|
110
|
-
else 'diff' end
|
111
|
-
end unless defined? DIFF
|
112
|
-
|
113
|
-
SUDO = if WIN32 then ''
|
114
|
-
else
|
115
|
-
if quiet {system 'which sudo'} then 'sudo'
|
116
|
-
else '' end
|
117
|
-
end
|
118
|
-
|
119
|
-
RCOV = WIN32 ? 'rcov.bat' : 'rcov'
|
120
|
-
GEM = WIN32 ? 'gem.bat' : 'gem'
|
121
|
-
|
122
|
-
%w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
|
123
|
-
begin
|
124
|
-
require lib
|
125
|
-
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
|
126
|
-
rescue LoadError
|
127
|
-
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
# Reads a file at +path+ and spits out an array of the +paragraphs+
|
132
|
-
# specified.
|
133
|
-
#
|
134
|
-
# changes = paragraphs_of('History.txt', 0..1).join("\n\n")
|
135
|
-
# summary, *description = paragraphs_of('README.txt', 3, 3..8)
|
136
|
-
#
|
137
|
-
def paragraphs_of( path, *paragraphs )
|
138
|
-
title = String === paragraphs.first ? paragraphs.shift : nil
|
139
|
-
ary = File.read(path).delete("\r").split(/\n\n+/)
|
140
|
-
|
141
|
-
result = if title
|
142
|
-
tmp, matching = [], false
|
143
|
-
rgxp = %r/^=+\s*#{Regexp.escape(title)}/i
|
144
|
-
paragraphs << (0..-1) if paragraphs.empty?
|
145
|
-
|
146
|
-
ary.each do |val|
|
147
|
-
if val =~ rgxp
|
148
|
-
break if matching
|
149
|
-
matching = true
|
150
|
-
rgxp = %r/^=+/i
|
151
|
-
elsif matching
|
152
|
-
tmp << val
|
153
|
-
end
|
154
|
-
end
|
155
|
-
tmp
|
156
|
-
else ary end
|
157
|
-
|
158
|
-
result.values_at(*paragraphs)
|
159
|
-
end
|
160
|
-
|
161
|
-
# Adds the given gem _name_ to the current project's dependency list. An
|
162
|
-
# optional gem _version_ can be given. If omitted, the newest gem version
|
163
|
-
# will be used.
|
164
|
-
#
|
165
|
-
def depend_on( name, version = nil )
|
166
|
-
spec = Gem.source_index.find_name(name).last
|
167
|
-
version = spec.version.to_s if version.nil? and !spec.nil?
|
168
|
-
|
169
|
-
PROJ.dependencies << (version.nil? ? [name] : [name, ">= #{version}"])
|
170
|
-
end
|
171
|
-
|
172
|
-
# Adds the given arguments to the include path if they are not already there
|
173
|
-
#
|
174
|
-
def ensure_in_path( *args )
|
175
|
-
args.each do |path|
|
176
|
-
path = File.expand_path(path)
|
177
|
-
$:.unshift(path) if test(?d, path) and not $:.include?(path)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
# Find a rake task using the task name and remove any description text. This
|
182
|
-
# will prevent the task from being displayed in the list of available tasks.
|
183
|
-
#
|
184
|
-
def remove_desc_for_task( names )
|
185
|
-
Array(names).each do |task_name|
|
186
|
-
task = Rake.application.tasks.find {|t| t.name == task_name}
|
187
|
-
next if task.nil?
|
188
|
-
task.instance_variable_set :@comment, nil
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
# Change working directories to _dir_, call the _block_ of code, and then
|
193
|
-
# change back to the original working directory (the current directory when
|
194
|
-
# this method was called).
|
195
|
-
#
|
196
|
-
def in_directory( dir, &block )
|
197
|
-
curdir = pwd
|
198
|
-
begin
|
199
|
-
cd dir
|
200
|
-
return block.call
|
201
|
-
ensure
|
202
|
-
cd curdir
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
# Scans the current working directory and creates a list of files that are
|
207
|
-
# candidates to be in the manifest.
|
208
|
-
#
|
209
|
-
def manifest_files
|
210
|
-
files = []
|
211
|
-
exclude = Regexp.new(PROJ.exclude.join('|'))
|
212
|
-
Find.find '.' do |path|
|
213
|
-
path.sub! %r/^(\.\/|\/)/o, ''
|
214
|
-
next unless test ?f, path
|
215
|
-
next if path =~ exclude
|
216
|
-
files << path
|
217
|
-
end
|
218
|
-
files.sort!
|
219
|
-
end
|
220
|
-
|
221
|
-
# EOF
|
data/tasks/spec.rake
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# $Id$
|
2
|
-
|
3
|
-
if HAVE_SPEC_RAKE_SPECTASK
|
4
|
-
|
5
|
-
namespace :spec do
|
6
|
-
|
7
|
-
desc 'Run all specs with basic output'
|
8
|
-
Spec::Rake::SpecTask.new(:run) do |t|
|
9
|
-
t.spec_opts = PROJ.spec_opts
|
10
|
-
t.spec_files = PROJ.specs
|
11
|
-
t.libs += PROJ.libs
|
12
|
-
end
|
13
|
-
|
14
|
-
desc 'Run all specs with text output'
|
15
|
-
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
16
|
-
t.spec_opts = PROJ.spec_opts + ['--format', 'specdoc']
|
17
|
-
t.spec_files = PROJ.specs
|
18
|
-
t.libs += PROJ.libs
|
19
|
-
end
|
20
|
-
|
21
|
-
if HAVE_RCOV
|
22
|
-
desc 'Run all specs with RCov'
|
23
|
-
Spec::Rake::SpecTask.new(:rcov) do |t|
|
24
|
-
t.spec_opts = PROJ.spec_opts
|
25
|
-
t.spec_files = PROJ.specs
|
26
|
-
t.libs += PROJ.libs
|
27
|
-
t.rcov = true
|
28
|
-
t.rcov_opts = PROJ.rcov_opts + ['--exclude', 'spec']
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end # namespace :spec
|
33
|
-
|
34
|
-
desc 'Alias to spec:run'
|
35
|
-
task :spec => 'spec:run'
|
36
|
-
|
37
|
-
task :clobber => 'spec:clobber_rcov' if HAVE_RCOV
|
38
|
-
|
39
|
-
remove_desc_for_task %w(spec:clobber_rcov)
|
40
|
-
|
41
|
-
end # if HAVE_SPEC_RAKE_SPECTASK
|
42
|
-
|
43
|
-
# EOF
|
data/tasks/svn.rake
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# $Id$
|
2
|
-
|
3
|
-
|
4
|
-
if PROJ.svn and system("svn --version 2>&1 > #{DEV_NULL}")
|
5
|
-
|
6
|
-
unless PROJ.svn_root
|
7
|
-
info = %x/svn info ./
|
8
|
-
m = %r/^Repository Root:\s+(.*)$/.match(info)
|
9
|
-
PROJ.svn_root = (m.nil? ? '' : m[1])
|
10
|
-
end
|
11
|
-
PROJ.svn_root = File.join(PROJ.svn_root, PROJ.svn) if String === PROJ.svn
|
12
|
-
|
13
|
-
namespace :svn do
|
14
|
-
|
15
|
-
desc 'Show tags from the SVN repository'
|
16
|
-
task :show_tags do |t|
|
17
|
-
tags = %x/svn list #{File.join(PROJ.svn_root, PROJ.svn_tags)}/
|
18
|
-
tags.gsub!(%r/\/$/, '')
|
19
|
-
puts tags
|
20
|
-
end
|
21
|
-
|
22
|
-
desc 'Create a new tag in the SVN repository'
|
23
|
-
task :create_tag do |t|
|
24
|
-
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
25
|
-
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
26
|
-
|
27
|
-
trunk = File.join(PROJ.svn_root, PROJ.svn_trunk)
|
28
|
-
tag = "%s-%s" % [PROJ.name, PROJ.version]
|
29
|
-
tag = File.join(PROJ.svn_root, PROJ.svn_tags, tag)
|
30
|
-
msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
|
31
|
-
|
32
|
-
puts "Creating SVN tag '#{tag}'"
|
33
|
-
unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
|
34
|
-
abort "Tag creation failed"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end # namespace :svn
|
39
|
-
|
40
|
-
task 'gem:release' => 'svn:create_tag'
|
41
|
-
|
42
|
-
end # if PROJ.svn
|
43
|
-
|
44
|
-
# EOF
|
data/tasks/test.rake
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# $Id$
|
2
|
-
|
3
|
-
require 'rake/testtask'
|
4
|
-
|
5
|
-
namespace :test do
|
6
|
-
|
7
|
-
Rake::TestTask.new(:run) do |t|
|
8
|
-
t.libs = PROJ.libs
|
9
|
-
t.test_files = if test ?f, PROJ.test_file then [PROJ.test_file]
|
10
|
-
else PROJ.tests end
|
11
|
-
t.ruby_opts += PROJ.ruby_opts
|
12
|
-
t.ruby_opts += PROJ.test_opts
|
13
|
-
end
|
14
|
-
|
15
|
-
if HAVE_RCOV
|
16
|
-
desc 'Run rcov on the unit tests'
|
17
|
-
task :rcov => :clobber_rcov do
|
18
|
-
opts = PROJ.rcov_opts.join(' ')
|
19
|
-
files = if test ?f, PROJ.test_file then [PROJ.test_file]
|
20
|
-
else PROJ.tests end
|
21
|
-
files = files.join(' ')
|
22
|
-
sh "#{RCOV} #{files} #{opts}"
|
23
|
-
end
|
24
|
-
|
25
|
-
desc 'Remove rcov products'
|
26
|
-
task :clobber_rcov do
|
27
|
-
rm_r 'coverage' rescue nil
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end # namespace :test
|
32
|
-
|
33
|
-
desc 'Alias to test:run'
|
34
|
-
task :test => 'test:run'
|
35
|
-
|
36
|
-
task :clobber => 'test:clobber_rcov' if HAVE_RCOV
|
37
|
-
|
38
|
-
remove_desc_for_task %w(test:clobber_rcov)
|
39
|
-
|
40
|
-
# EOF
|
@@ -1,91 +0,0 @@
|
|
1
|
-
PageLoadTime = 2
|
2
|
-
|
3
|
-
plugin 'safari'
|
4
|
-
plugin 'mousepose'
|
5
|
-
plugin 'ishowu'
|
6
|
-
|
7
|
-
pause 0.5
|
8
|
-
launch "Mousepose"
|
9
|
-
launch "Safari", at(32, 64, 800, 600)
|
10
|
-
url "http://dockyard.localhost/admin/structure"
|
11
|
-
|
12
|
-
pause PageLoadTime
|
13
|
-
|
14
|
-
ishowu_set_region at(32, 64, 800, 600)
|
15
|
-
move to_element('input')
|
16
|
-
ishowu_start_recording
|
17
|
-
click
|
18
|
-
|
19
|
-
while_saying "Welcome to Blueprint. Here's how you sign in." do
|
20
|
-
pause 0.5
|
21
|
-
type "screencast"
|
22
|
-
hit Tab
|
23
|
-
type "password"
|
24
|
-
move to_element('.mainAction')
|
25
|
-
click
|
26
|
-
end
|
27
|
-
|
28
|
-
pause PageLoadTime
|
29
|
-
|
30
|
-
say "This is the structure tab. Let's create a page!"
|
31
|
-
highlight do
|
32
|
-
move to_element("#page_title", :area => :left)
|
33
|
-
click
|
34
|
-
end
|
35
|
-
type "Welcome"
|
36
|
-
move to_element(".sidebarButton")
|
37
|
-
click
|
38
|
-
move to_element("#structureTree li:last-child a")
|
39
|
-
say "The page has been created."
|
40
|
-
|
41
|
-
while_saying "We should add a few more, to create a simple site structure." do
|
42
|
-
move to_element("#page_title", :area => :left)
|
43
|
-
click
|
44
|
-
type "About"
|
45
|
-
move to_element(".sidebarButton")
|
46
|
-
click
|
47
|
-
|
48
|
-
move to_element("#page_title", :area => :left)
|
49
|
-
click
|
50
|
-
type "Contact us"
|
51
|
-
move to_element(".sidebarButton")
|
52
|
-
click
|
53
|
-
end
|
54
|
-
|
55
|
-
while_saying "A page hierarchy is established by dragging and dropping." do
|
56
|
-
move to_element("#structureTree li:last-child img")
|
57
|
-
highlight do
|
58
|
-
drag by(25, -42)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
pause 2
|
63
|
-
|
64
|
-
while_saying "Blueprint has many types of pages." do
|
65
|
-
move to_element("#page_blueprint_id")
|
66
|
-
highlight do
|
67
|
-
mousedown
|
68
|
-
pause 2
|
69
|
-
drag by(0, 26)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
move to_element("#page_title")
|
74
|
-
click
|
75
|
-
type "Chronicle"
|
76
|
-
move to_element(".sidebarButton") and pause 0.1
|
77
|
-
click
|
78
|
-
|
79
|
-
while_saying "See how this page has a different icon? This means it has " +
|
80
|
-
"special functionality. In this case, it's a blog." do
|
81
|
-
move to_element('li[blueprint="blg"] img')
|
82
|
-
end
|
83
|
-
|
84
|
-
while_saying "One last thing: don't forget to save your site structure!" do
|
85
|
-
pause 1.5
|
86
|
-
move to_element(".mainAction")
|
87
|
-
# click
|
88
|
-
pause PageLoadTime
|
89
|
-
end
|
90
|
-
|
91
|
-
pause 3
|
data/test/googling.screenplay
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/usr/bin/env castanaut
|
2
|
-
|
3
|
-
PageLoadTime = 2.5
|
4
|
-
|
5
|
-
plugin 'safari'
|
6
|
-
|
7
|
-
pause 0.5
|
8
|
-
launch "safari", at(64, 64, 1024, 768)
|
9
|
-
url "about:blank"
|
10
|
-
|
11
|
-
|
12
|
-
while_saying "Let's go vanity-searching!" do
|
13
|
-
url "http://www.google.com"
|
14
|
-
pause PageLoadTime
|
15
|
-
end
|
16
|
-
|
17
|
-
move to_element('input[name="q"]')
|
18
|
-
click
|
19
|
-
type "Castanaut"
|
20
|
-
hit Enter
|
21
|
-
pause PageLoadTime
|
22
|
-
|
23
|
-
say "Oh. I was hoping for more results."
|
24
|
-
|
25
|
-
move to(340, 100)
|
26
|
-
tripleclick
|
27
|
-
pause 0.5
|
28
|
-
type "http://inventivelabs.com.au"
|
29
|
-
hit Enter
|
30
|
-
|
31
|
-
pause 6
|
32
|
-
|
33
|
-
move to_element("#switch")
|
34
|
-
click
|