skypecall 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ad0d4eedf610965ed9d4508276c5cada19e8e4bb
4
+ data.tar.gz: 70553cb392bda41d0149102fbf3346b74e40e25c
5
+ SHA512:
6
+ metadata.gz: 0ae8e0cbe396222fa37420367d54e01c5349cda8c70f2c26679f8443f09418f13fa373143adcf3665208412f108bd050b9cea90c7ea4e8349c13e3af6562e6df
7
+ data.tar.gz: 09bc805d16213125bee089bdb5d28048c0c8861d67692e058de96bc3edcd83d5886770d8d4332534ae1f584f79792ad6f012a81d1698aa41097d0ff664b0d132
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ ruby_skype
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p247
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in skype.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Aziz Light
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Skype
2
+
3
+ Make Skype calls from the command line on OS X!
4
+
5
+ ## Installation
6
+
7
+ $ gem install skype
8
+
9
+ # Setup
10
+
11
+ 1. Quit Skype
12
+ 2. Run `exsc <your-skype-name>`
13
+ 3. Launch Skype again
14
+
15
+ ## Usage
16
+
17
+ ```sh
18
+ % skype call <friend>
19
+ ```
20
+
21
+ ## Contributing
22
+
23
+ 1. Fork it
24
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
25
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
26
+ 4. Push to the branch (`git push origin my-new-feature`)
27
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/exsc ADDED
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+
3
+ sqlite3 -batch "$HOME/Library/Application Support/Skype/$1/main.db" <<EOF
4
+ .mode csv
5
+ .output $HOME/.skyperc
6
+ select skypename,displayname from Contacts;
7
+ .output stdout
8
+ .exit
9
+ EOF
data/bin/skype ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rainbow'
4
+ require 'csv'
5
+
6
+ home = Dir.home
7
+ rc = '.skyperc'
8
+ rc_full = File.join(home, rc)
9
+
10
+ unless File.exists?(rc_full)
11
+ puts 'You need to export your contact list:'.color(:red)
12
+ puts '1. Quit Skype'
13
+ puts '2. Run `exsc <your-skype-name>`'
14
+ exit(0)
15
+ end
16
+
17
+ def help
18
+ h = <<-HELP.gsub(/^\s+/, '')
19
+ Usage: skype call <friend>
20
+ HELP
21
+
22
+ print h.color(:red)
23
+ end
24
+
25
+ if ARGV[0] != 'call'
26
+ puts 'Unknown command'.color(:red)
27
+ help
28
+ exit(0)
29
+ end
30
+
31
+ if ARGV[1].nil? || ARGV[1].empty?
32
+ puts 'Missing friend'.color(:red)
33
+ help
34
+ exit(0)
35
+ end
36
+
37
+ contacts = []
38
+ CSV.foreach(rc_full) do |row|
39
+ contacts << { skypename: row.fetch(0), displayname: row.fetch(1) }
40
+ end
41
+
42
+ matches = contacts.select { |contact| (contact.fetch(:displayname) =~ /#{ARGV.fetch(1)}/i).is_a?(Fixnum) }
43
+
44
+ if matches.count > 1
45
+ puts 'More than on contact was found:'
46
+ matches.each { |match| puts "%-40s %-40s" % ["#{"Skype name".color(:green)}: #{match.fetch(:skypename)}", "#{"Display name".color(:green)}: #{match.fetch(:displayname)}"] }
47
+ puts 'Please use the exact Skype name.'
48
+ exit(0)
49
+ elsif matches.count == 0
50
+ puts 'Cannot find this contact...'.color(:red)
51
+ exit(0)
52
+ else
53
+
54
+ applescript = <<-AS.gsub(/^\s+/, '')
55
+ tell application "Skype"
56
+ activate
57
+ delay 2
58
+ tell application "System Events" to keystroke return
59
+ get URL "skype:#{matches.first.fetch(:skypename)}?call"
60
+ end tell
61
+ AS
62
+
63
+ success = system("osascript -e '#{applescript}'")
64
+ if success.nil? || !success
65
+ puts 'Unknown error'.color(:red)
66
+ exit(0)
67
+ else
68
+ puts 'Calling...'.color(:green)
69
+ end
70
+ end
@@ -0,0 +1,3 @@
1
+ module Skype
2
+ VERSION = "0.0.1"
3
+ end
data/lib/skype.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "skype/version"
2
+
3
+ module Skype
4
+ # Your code goes here...
5
+ end
data/skype.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'skype/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "skypecall"
8
+ spec.version = Skype::VERSION
9
+ spec.authors = ["Aziz Light"]
10
+ spec.email = ["aziz@azizlight.me"]
11
+ spec.description = %q{Make Skype calls from the command line}
12
+ spec.summary = %q{Only works on OS X}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency 'rainbow'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: skypecall
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Aziz Light
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rainbow
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Make Skype calls from the command line
56
+ email:
57
+ - aziz@azizlight.me
58
+ executables:
59
+ - exsc
60
+ - skype
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - .gitignore
65
+ - .ruby-gemset
66
+ - .ruby-version
67
+ - Gemfile
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/exsc
72
+ - bin/skype
73
+ - lib/skype.rb
74
+ - lib/skype/version.rb
75
+ - skype.gemspec
76
+ homepage: ''
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.0.3
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Only works on OS X
100
+ test_files: []