splat 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -20
- data/README.rdoc +31 -31
- data/lib/splat.rb +68 -68
- data/lib/splat/darwin_clipboard.rb +5 -5
- data/lib/splat/darwin_launcher.rb +5 -5
- data/lib/splat/win32_clipboard.rb +5 -5
- data/lib/splat/win32_launcher.rb +5 -5
- metadata +4 -11
data/MIT-LICENSE
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright (c) 2010 Mark Ryall
|
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.
|
1
|
+
Copyright (c) 2010 Mark Ryall
|
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.rdoc
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
= splat
|
2
|
-
|
3
|
-
small gem to provide an adapter for various platform specific features
|
4
|
-
|
5
|
-
== installation
|
6
|
-
|
7
|
-
gem install splat
|
8
|
-
|
9
|
-
== instantiate
|
10
|
-
|
11
|
-
splat = Splat.new
|
12
|
-
|
13
|
-
== platform
|
14
|
-
|
15
|
-
puts spat.platform
|
16
|
-
puts splat.supported? ? 'supported' : 'not supported'
|
17
|
-
|
18
|
-
== clipboard
|
19
|
-
|
20
|
-
splat.clipboard = "some new content"
|
21
|
-
|
22
|
-
this will do nothing if the platform is not supported (win32 and macosx for the moment)
|
23
|
-
|
24
|
-
== launcher
|
25
|
-
|
26
|
-
splat.launch 'http://google.com'
|
27
|
-
|
28
|
-
== Future plans for world domination
|
29
|
-
|
30
|
-
* detect remaining platforms
|
31
|
-
* determine 1.9 compatibility
|
1
|
+
= splat
|
2
|
+
|
3
|
+
small gem to provide an adapter for various platform specific features
|
4
|
+
|
5
|
+
== installation
|
6
|
+
|
7
|
+
gem install splat
|
8
|
+
|
9
|
+
== instantiate
|
10
|
+
|
11
|
+
splat = Splat.new
|
12
|
+
|
13
|
+
== platform
|
14
|
+
|
15
|
+
puts spat.platform
|
16
|
+
puts splat.supported? ? 'supported' : 'not supported'
|
17
|
+
|
18
|
+
== clipboard
|
19
|
+
|
20
|
+
splat.clipboard = "some new content"
|
21
|
+
|
22
|
+
this will do nothing if the platform is not supported (win32 and macosx for the moment)
|
23
|
+
|
24
|
+
== launcher
|
25
|
+
|
26
|
+
splat.launch 'http://google.com'
|
27
|
+
|
28
|
+
== Future plans for world domination
|
29
|
+
|
30
|
+
* detect remaining platforms
|
31
|
+
* determine 1.9 compatibility
|
data/lib/splat.rb
CHANGED
@@ -1,68 +1,68 @@
|
|
1
|
-
class Splat
|
2
|
-
attr_reader :platform
|
3
|
-
|
4
|
-
def try_load feature, params
|
5
|
-
begin
|
6
|
-
params.each {|gem, req| require req }
|
7
|
-
yield
|
8
|
-
rescue Exception
|
9
|
-
puts "for #{feature} support with splat on #{@platform}:"
|
10
|
-
params.each {|gem, req| puts " * gem install #{gem}" }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
@path_cleaner = Object.new
|
16
|
-
def @path_cleaner.clean path
|
17
|
-
path
|
18
|
-
end
|
19
|
-
case Config::CONFIG['host_os']
|
20
|
-
when /mswin|win32|dos|cygwin|mingw/i
|
21
|
-
@platform = :win32
|
22
|
-
try_load 'clipboard', 'win32-clipboard' => 'win32/clipboard' do
|
23
|
-
require 'splat/win32_clipboard'
|
24
|
-
@clipboard = Splat::Win32Clipboard.new
|
25
|
-
end
|
26
|
-
require 'splat/win32_launcher'
|
27
|
-
@launcher = Splat::Win32Launcher.new
|
28
|
-
try_load 'browser automation', 'watir' => 'watir' do
|
29
|
-
@browser_class = Watir::IE
|
30
|
-
end
|
31
|
-
def @path_cleaner.clean path
|
32
|
-
path.to_s.gsub('/','\\')
|
33
|
-
end
|
34
|
-
when /darwin/i
|
35
|
-
@platform = :macosx
|
36
|
-
require 'splat/darwin_clipboard'
|
37
|
-
@clipboard = Splat::DarwinClipboard.new
|
38
|
-
require 'splat/darwin_launcher'
|
39
|
-
@launcher = Splat::DarwinLauncher.new
|
40
|
-
try_load 'browser automation', 'rb-appscript' => '
|
41
|
-
@browser_class = Watir::Safari
|
42
|
-
end
|
43
|
-
else
|
44
|
-
@platform = :unknown
|
45
|
-
puts "I have no idea how to cope with \"#{Config::CONFIG['host_os']}\""
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def supported?
|
50
|
-
@platform != :unknown
|
51
|
-
end
|
52
|
-
|
53
|
-
def clipboard= content
|
54
|
-
@clipboard.content = content if @clipboard
|
55
|
-
end
|
56
|
-
|
57
|
-
def browser
|
58
|
-
@browser_class.new if @browser_class
|
59
|
-
end
|
60
|
-
|
61
|
-
def launch content
|
62
|
-
@launcher.launch content if @launcher
|
63
|
-
end
|
64
|
-
|
65
|
-
def clean_path path
|
66
|
-
@path_cleaner.clean path
|
67
|
-
end
|
68
|
-
end
|
1
|
+
class Splat
|
2
|
+
attr_reader :platform
|
3
|
+
|
4
|
+
def try_load feature, params
|
5
|
+
begin
|
6
|
+
params.each {|gem, req| require req }
|
7
|
+
yield
|
8
|
+
rescue Exception
|
9
|
+
puts "for #{feature} support with splat on #{@platform}:"
|
10
|
+
params.each {|gem, req| puts " * gem install #{gem}" }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@path_cleaner = Object.new
|
16
|
+
def @path_cleaner.clean path
|
17
|
+
path
|
18
|
+
end
|
19
|
+
case Config::CONFIG['host_os']
|
20
|
+
when /mswin|win32|dos|cygwin|mingw/i
|
21
|
+
@platform = :win32
|
22
|
+
try_load 'clipboard', 'win32-clipboard' => 'win32/clipboard' do
|
23
|
+
require 'splat/win32_clipboard'
|
24
|
+
@clipboard = Splat::Win32Clipboard.new
|
25
|
+
end
|
26
|
+
require 'splat/win32_launcher'
|
27
|
+
@launcher = Splat::Win32Launcher.new
|
28
|
+
try_load 'browser automation', 'watir' => 'watir' do
|
29
|
+
@browser_class = Watir::IE
|
30
|
+
end
|
31
|
+
def @path_cleaner.clean path
|
32
|
+
path.to_s.gsub('/','\\')
|
33
|
+
end
|
34
|
+
when /darwin/i
|
35
|
+
@platform = :macosx
|
36
|
+
require 'splat/darwin_clipboard'
|
37
|
+
@clipboard = Splat::DarwinClipboard.new
|
38
|
+
require 'splat/darwin_launcher'
|
39
|
+
@launcher = Splat::DarwinLauncher.new
|
40
|
+
try_load 'browser automation', 'rb-appscript' => 'appscript', 'safariwatir' => 'safariwatir' do
|
41
|
+
@browser_class = Watir::Safari
|
42
|
+
end
|
43
|
+
else
|
44
|
+
@platform = :unknown
|
45
|
+
puts "I have no idea how to cope with \"#{Config::CONFIG['host_os']}\""
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def supported?
|
50
|
+
@platform != :unknown
|
51
|
+
end
|
52
|
+
|
53
|
+
def clipboard= content
|
54
|
+
@clipboard.content = content if @clipboard
|
55
|
+
end
|
56
|
+
|
57
|
+
def browser
|
58
|
+
@browser_class.new if @browser_class
|
59
|
+
end
|
60
|
+
|
61
|
+
def launch content
|
62
|
+
@launcher.launch content if @launcher
|
63
|
+
end
|
64
|
+
|
65
|
+
def clean_path path
|
66
|
+
@path_cleaner.clean path
|
67
|
+
end
|
68
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class Splat::DarwinClipboard
|
2
|
-
def content= text
|
3
|
-
`echo "#{text}" | pbcopy`
|
4
|
-
end
|
5
|
-
end
|
1
|
+
class Splat::DarwinClipboard
|
2
|
+
def content= text
|
3
|
+
`echo "#{text}" | pbcopy`
|
4
|
+
end
|
5
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class Splat::DarwinLauncher
|
2
|
-
def launch text
|
3
|
-
`open #{text}`
|
4
|
-
end
|
5
|
-
end
|
1
|
+
class Splat::DarwinLauncher
|
2
|
+
def launch text
|
3
|
+
`open #{text}`
|
4
|
+
end
|
5
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class Splat::Win32Clipboard
|
2
|
-
def content= text
|
3
|
-
Win32::Clipboard.set_data(text)
|
4
|
-
end
|
5
|
-
end
|
1
|
+
class Splat::Win32Clipboard
|
2
|
+
def content= text
|
3
|
+
Win32::Clipboard.set_data(text)
|
4
|
+
end
|
5
|
+
end
|
data/lib/splat/win32_launcher.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
class Splat::Win32Launcher
|
2
|
-
def launch text
|
3
|
-
`start #{text}`
|
4
|
-
end
|
5
|
-
end
|
1
|
+
class Splat::Win32Launcher
|
2
|
+
def launch text
|
3
|
+
`start #{text}`
|
4
|
+
end
|
5
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
version: 0.0.7
|
4
|
+
version: 0.0.8
|
10
5
|
platform: ruby
|
11
6
|
authors:
|
12
7
|
- Mark Ryall
|
@@ -52,20 +47,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
47
|
requirements:
|
53
48
|
- - ">="
|
54
49
|
- !ruby/object:Gem::Version
|
55
|
-
segments:
|
56
|
-
- 0
|
57
50
|
version: "0"
|
51
|
+
version:
|
58
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
53
|
requirements:
|
60
54
|
- - ">="
|
61
55
|
- !ruby/object:Gem::Version
|
62
|
-
segments:
|
63
|
-
- 0
|
64
56
|
version: "0"
|
57
|
+
version:
|
65
58
|
requirements: []
|
66
59
|
|
67
60
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.3.
|
61
|
+
rubygems_version: 1.3.5
|
69
62
|
signing_key:
|
70
63
|
specification_version: 3
|
71
64
|
summary: cross platform adapter for various os specific features
|