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 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 initialize
5
- case Config::CONFIG['host_os']
6
- when /mswin|win32|dos|cygwin|mingw/i
7
- @platform = :win32
8
- begin
9
- require 'splat/win32_clipboard'
10
- @clipboard = Splat::Win32Clipboard.new
11
- rescue Exception
12
- puts 'for clipboard with splat on windows:'
13
- puts ' * gem install win32-clipboard'
14
- end
15
- require 'splat/win32_launcher'
16
- @launcher = Splat::Win32Launcher.new
17
- begin
18
- require 'watir'
19
- @browser_class = Watir::IE
20
- rescue Exception
21
- puts 'for browser automation with splat on windows'
22
- puts ' * gem install watir'
23
- end
24
- when /darwin/i
25
- @platform = :macosx
26
- require 'splat/darwin_clipboard'
27
- @clipboard = Splat::DarwinClipboard.new
28
- require 'splat/darwin_launcher'
29
- @launcher = Splat::DarwinLauncher.new
30
- begin
31
- require 'safariwatir'
32
- @browser_class = Watir::Safari
33
- rescue Exception
34
- puts 'for browser automation with splat on mac os x:'
35
- puts ' * gem install safariwatir'
36
- puts ' * gem install rb-appscript'
37
- end
38
- else
39
- @platform = :unknown
40
- puts "I have no idea how to cope with \"#{Config::CONFIG['host_os']}\""
41
- end
42
- end
43
-
44
- def supported?
45
- @platform != :unknown
46
- end
47
-
48
- def clipboard= content
49
- @clipboard.content = content if @clipboard
50
- end
51
-
52
- def browser
53
- @browser_class.new if @browser_class
54
- end
55
-
56
- def launch content
57
- @launcher.launch content if @launcher
58
- end
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
@@ -1,7 +1,5 @@
1
- require 'win32/clipboard'
2
-
3
- class Splat::Win32Clipboard
4
- def content= text
5
- Win32::Clipboard.set_data(text)
6
- end
7
- end
1
+ class Splat::Win32Clipboard
2
+ def content= text
3
+ Win32::Clipboard.set_data(text)
4
+ end
5
+ end
@@ -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
- version: 0.0.5
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-21 00:00:00 +11:00
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.5
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