splat 0.0.5 → 0.0.6
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 -59
- data/lib/splat/darwin_clipboard.rb +5 -5
- data/lib/splat/darwin_launcher.rb +5 -5
- data/lib/splat/win32_clipboard.rb +5 -7
- data/lib/splat/win32_launcher.rb +5 -5
- metadata +12 -5
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,59 +1,68 @@
|
|
1
|
-
class Splat
|
2
|
-
attr_reader :platform
|
3
|
-
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
require 'splat/
|
27
|
-
@
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
@
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
1
|
+
class Splat
|
2
|
+
attr_reader :platform
|
3
|
+
|
4
|
+
def try_load feature, *gems
|
5
|
+
begin
|
6
|
+
gems.each {|gem| require gem }
|
7
|
+
yield
|
8
|
+
rescue Exception
|
9
|
+
puts "for #{feature} support with splat on #{@platform}:"
|
10
|
+
gems.each {|gem| 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' 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' 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', '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
|
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,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Mark Ryall
|
@@ -9,7 +14,7 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-02-
|
17
|
+
date: 2010-02-28 00:00:00 +11:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
@@ -47,18 +52,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
47
52
|
requirements:
|
48
53
|
- - ">="
|
49
54
|
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
50
57
|
version: "0"
|
51
|
-
version:
|
52
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
59
|
requirements:
|
54
60
|
- - ">="
|
55
61
|
- !ruby/object:Gem::Version
|
62
|
+
segments:
|
63
|
+
- 0
|
56
64
|
version: "0"
|
57
|
-
version:
|
58
65
|
requirements: []
|
59
66
|
|
60
67
|
rubyforge_project:
|
61
|
-
rubygems_version: 1.3.
|
68
|
+
rubygems_version: 1.3.6
|
62
69
|
signing_key:
|
63
70
|
specification_version: 3
|
64
71
|
summary: cross platform adapter for various os specific features
|