spunkmeyer 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - 1.9.2
7
+ - ruby-head
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
data/LICENSE CHANGED
@@ -1,13 +1,22 @@
1
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
- Version 2, December 2004
1
+ Copyright (c) 2013 Tim Miller All Rights Reserved
3
2
 
4
- Copyright (C) 2013 Tim Miller
3
+ MIT License
5
4
 
6
- Everyone is permitted to copy and distribute verbatim or modified
7
- copies of this license document, and changing it is allowed as long
8
- as the name is changed.
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
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
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
- 0. You just DO WHAT THE FUCK YOU WANT TO.
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
@@ -12,3 +12,5 @@ RSpec::Core::RakeTask.new(:spec) do |t|
12
12
  t.pattern = Dir.glob('spec/**/*_spec.rb')
13
13
  t.rspec_opts = '--color'
14
14
  end
15
+
16
+ task :default => [:spec]
@@ -1,4 +1,5 @@
1
1
  require 'spunkmeyer/chrome'
2
+ require 'spunkmeyer/os'
2
3
 
3
4
  module Spunkmeyer
4
5
 
@@ -6,7 +6,14 @@ module Spunkmeyer
6
6
 
7
7
  # currently supports only OSX.
8
8
  def self.cookie_path
9
- "#{Dir.home}/Library/Application Support/Google/Chrome/Default/Cookies"
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
@@ -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
@@ -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
@@ -1,2 +1 @@
1
- $:.push File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'spunkmeyer'))
2
1
  require 'spunkmeyer'
@@ -2,7 +2,7 @@
2
2
  # -*- encoding: utf-8 -*-
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'spunkmeyer'
5
- s.version = '0.0.4'
5
+ s.version = '0.0.5'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = [ 'Tim Miller' ]
8
8
  s.email = [ '' ]
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
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-06-27 00:00:00.000000000 Z
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