spunkmeyer 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +11 -0
- data/LICENSE +18 -9
- data/README.md +5 -0
- data/Rakefile +2 -0
- data/lib/spunkmeyer.rb +1 -0
- data/lib/spunkmeyer/chrome.rb +8 -1
- data/lib/spunkmeyer/os.rb +18 -0
- data/spec/chrome_spec.rb +15 -8
- data/spec/os_spec.rb +20 -0
- data/spec/spec_helper.rb +0 -1
- data/spunkmeyer.gemspec +1 -1
- metadata +5 -2
data/.travis.yml
ADDED
data/LICENSE
CHANGED
@@ -1,13 +1,22 @@
|
|
1
|
-
|
2
|
-
Version 2, December 2004
|
1
|
+
Copyright (c) 2013 Tim Miller All Rights Reserved
|
3
2
|
|
4
|
-
|
3
|
+
MIT License
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
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:
|
9
12
|
|
10
|
-
|
11
|
-
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
12
15
|
|
13
|
-
|
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
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
# spunkmeyer
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/spunkmeyer.png)][gem]
|
3
|
+
[![Build Status](https://secure.travis-ci.org/echohead/spunkmeyer.png?branch=master)][travis]
|
4
|
+
|
5
|
+
[gem]: https://rubygems.org/gems/spunkmeyer
|
6
|
+
[travis]: http://travis-ci.org/echohead/spunkmeyer
|
2
7
|
|
3
8
|
Grab cookies from your browser from ruby code.
|
4
9
|
|
data/Rakefile
CHANGED
data/lib/spunkmeyer.rb
CHANGED
data/lib/spunkmeyer/chrome.rb
CHANGED
@@ -6,7 +6,14 @@ module Spunkmeyer
|
|
6
6
|
|
7
7
|
# currently supports only OSX.
|
8
8
|
def self.cookie_path
|
9
|
-
|
9
|
+
case Spunkmeyer.os
|
10
|
+
when :osx
|
11
|
+
"#{Dir.home}/Library/Application Support/Google/Chrome/Default/Cookies"
|
12
|
+
when :linux
|
13
|
+
"#{Dir.home}/.config/google-chrome/Default/Cookies"
|
14
|
+
else
|
15
|
+
raise 'Spunkmeyer::Chrome doesn\'t know this operating system.'
|
16
|
+
end
|
10
17
|
end
|
11
18
|
|
12
19
|
def self.cookies(domain)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
module Spunkmeyer
|
4
|
+
def self.os()
|
5
|
+
case RbConfig::CONFIG['host_os']
|
6
|
+
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
7
|
+
:windows
|
8
|
+
when /darwin|mac os/
|
9
|
+
:osx
|
10
|
+
when /linux/
|
11
|
+
:linux
|
12
|
+
when /solaris|bsd/
|
13
|
+
:unix
|
14
|
+
else
|
15
|
+
raise 'unkown operating system'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/chrome_spec.rb
CHANGED
@@ -1,16 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
module Spunkmeyer
|
4
|
-
module Chrome
|
5
|
-
def self.cookie_path
|
6
|
-
"#{File.expand_path File.dirname(__FILE__)}/fixtures/chrome.sqlite"
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
3
|
describe Spunkmeyer::Chrome do
|
12
4
|
|
13
5
|
it 'should grab cookies for a specified domain' do
|
6
|
+
Spunkmeyer::Chrome.stub(:cookie_path).and_return \
|
7
|
+
"#{File.expand_path File.dirname(__FILE__)}/fixtures/chrome.sqlite"
|
8
|
+
|
14
9
|
Spunkmeyer::Chrome.cookies('https://foo.com').should == {
|
15
10
|
"some other name" => {
|
16
11
|
:host_key => ".foo.com",
|
@@ -29,4 +24,16 @@ describe Spunkmeyer::Chrome do
|
|
29
24
|
}
|
30
25
|
end
|
31
26
|
|
27
|
+
it 'knows about osx' do
|
28
|
+
Spunkmeyer.stub(:os).and_return :osx
|
29
|
+
Spunkmeyer::Chrome.cookie_path.should == \
|
30
|
+
"#{Dir.home}/Library/Application Support/Google/Chrome/Default/Cookies"
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'knows about linux' do
|
34
|
+
Spunkmeyer.stub(:os).and_return :linux
|
35
|
+
Spunkmeyer::Chrome.cookie_path.should == \
|
36
|
+
"#{Dir.home}/.config/google-chrome/Default/Cookies"
|
37
|
+
end
|
38
|
+
|
32
39
|
end
|
data/spec/os_spec.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spunkmeyer.os do
|
4
|
+
|
5
|
+
it 'deects osx' do
|
6
|
+
stub_const 'RbConfig::CONFIG', {'host_os' => 'darwin12.0.0' }
|
7
|
+
Spunkmeyer.os.should == :osx
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'deects linux' do
|
11
|
+
stub_const 'RbConfig::CONFIG', {'host_os' => 'linux-gnu' }
|
12
|
+
Spunkmeyer.os.should == :linux
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'blows up on unrecognized os' do
|
16
|
+
stub_const 'RbConfig::CONFIG', {'host_os' => 'snickerdoodle' }
|
17
|
+
lambda { Spunkmeyr.os }.should raise_error
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/spunkmeyer.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spunkmeyer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|
@@ -82,6 +82,7 @@ executables: []
|
|
82
82
|
extensions: []
|
83
83
|
extra_rdoc_files: []
|
84
84
|
files:
|
85
|
+
- .travis.yml
|
85
86
|
- Gemfile
|
86
87
|
- Gemfile.lock
|
87
88
|
- LICENSE
|
@@ -89,8 +90,10 @@ files:
|
|
89
90
|
- Rakefile
|
90
91
|
- lib/spunkmeyer.rb
|
91
92
|
- lib/spunkmeyer/chrome.rb
|
93
|
+
- lib/spunkmeyer/os.rb
|
92
94
|
- spec/chrome_spec.rb
|
93
95
|
- spec/fixtures/chrome.sqlite
|
96
|
+
- spec/os_spec.rb
|
94
97
|
- spec/spec_helper.rb
|
95
98
|
- spunkmeyer.gemspec
|
96
99
|
homepage: https://github.com/echohead/spunkmeyer
|