xxx 0.0.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -19,3 +19,4 @@ rdoc
19
19
  pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
+ *.gem
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Jakub Kuźma
1
+ Copyright (c) 2009 Jakub Kuźma, Wojciech Wnętrzak
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -1,9 +1,23 @@
1
- = xxx
1
+ == Usage
2
2
 
3
- Description goes here.
3
+ Install gem:
4
+ gem install xxx
5
+
6
+ From your command line just type:
7
+ xxx
8
+
9
+ You can specify option to choose a channel:
10
+ xxx -c youporn
11
+
12
+ To see all options type:
13
+ xxx -h
14
+
15
+ You can also launch porn from your nasty irb:
16
+ require "xxx"
17
+ Xxx.watch_porn :youporn
4
18
 
5
19
  == Note on Patches/Pull Requests
6
-
20
+
7
21
  * Fork the project.
8
22
  * Make your feature addition or bug fix.
9
23
  * Add tests for it. This is important so I don't break it in a
@@ -14,4 +28,4 @@ Description goes here.
14
28
 
15
29
  == Copyright
16
30
 
17
- Copyright (c) 2010 Jakub Kuźma. See LICENSE for details.
31
+ Copyright (c) 2010 Jakub Kuźma, Wojciech Wnętrzak. See LICENSE for details.
data/Rakefile CHANGED
@@ -8,10 +8,12 @@ begin
8
8
  Jeweler::Tasks.new do |gem|
9
9
  gem.name = "xxx"
10
10
  gem.summary = %Q{Porn of the day}
11
- gem.email = "qoobaa+github@gmail.com"
11
+ gem.description = %{To watch a porn just type from your command line: xxx}
12
+ gem.email = "qoobaa@gmail.com"
12
13
  gem.homepage = "http://github.com/qoobaa/xxx"
13
- gem.authors = ["Jakub Kuźma"]
14
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
+ gem.authors = ["Jakub Kuźma", "Wojciech Wnętrzak"]
15
+ gem.add_dependency "launchy"
16
+ gem.add_dependency "mechanize", ">=1.0"
15
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
18
  end
17
19
  Jeweler::GemcutterTasks.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.2
data/bin/xxx ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Version = "0.1.0"
4
+
5
+ require "optparse"
6
+ require "pp"
7
+
8
+ require "xxx"
9
+
10
+ options = {}
11
+
12
+ optparse = OptionParser.new do|opts|
13
+ opts.banner = "Usage: xxx [options] command"
14
+
15
+ opts.separator ""
16
+ opts.separator "Available commands:"
17
+ opts.separator " latest (default)"
18
+
19
+ opts.separator ""
20
+ opts.separator "Specific options:"
21
+
22
+ opts.on("-c", "--channel [CHANNEL]", [:youporn, :szukajcipki], "Select channel (youporn, szukajcipki)") do |channel|
23
+ options[:channel] = channel
24
+ end
25
+
26
+ opts.on("-h", "--help", "Display this screen") do
27
+ puts opts
28
+ exit
29
+ end
30
+ end
31
+
32
+ optparse.parse!
33
+
34
+ command = ARGV.shift || "latest"
35
+
36
+ begin
37
+ Xxx.watch_porn(options[:channel], command)
38
+ rescue Exception => e
39
+ abort("xxx: #{e.message}")
40
+ end
@@ -0,0 +1,15 @@
1
+ module Xxx
2
+ class SzukajCipki
3
+ HOST = "http://szukajcipki.pl"
4
+
5
+ attr_accessor :doc, :link
6
+
7
+ def agent
8
+ @doc = Nokogiri::HTML(open(HOST))
9
+ end
10
+
11
+ def latest
12
+ @link = HOST + agent.css("ul#movies a").first['href']
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ module Xxx
2
+ class Youporn
3
+ HOST = "youporn.com"
4
+ URI = "http://#{HOST}"
5
+ BROWSE_TIME_PATH = "/browse/time"
6
+ ENTER_WEBSITE = lambda { |page| page.forms.first.click_button }
7
+
8
+ def agent
9
+ @agent ||= Mechanize.new
10
+ end
11
+
12
+ def latest
13
+ agent.get(uri(BROWSE_TIME_PATH), &ENTER_WEBSITE)
14
+ path = agent.page.links_with(:href => /watch/).first.href
15
+ uri(path)
16
+ end
17
+
18
+ def uri(path)
19
+ "#{URI}#{path}"
20
+ end
21
+ end
22
+ end
data/lib/xxx.rb CHANGED
@@ -0,0 +1,35 @@
1
+ require "mechanize"
2
+ require "open-uri"
3
+ require "launchy"
4
+
5
+ require "xxx/youporn"
6
+ require "xxx/szukaj_cipki"
7
+
8
+ module Xxx
9
+ CHANNEL_NAMES = [:youporn, :szukajcipki]
10
+
11
+ class << self
12
+ def watch_porn(channel_name, command = "latest")
13
+ channel_name ||= CHANNEL_NAMES.sort_by { rand }.first
14
+ channel = open_channel(channel_name)
15
+
16
+ if channel.respond_to?(command)
17
+ uri = channel.send(command)
18
+ Launchy.open(uri)
19
+ else
20
+ raise ArgumentError, "unknown command: #{command}"
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def open_channel(channel_name)
27
+ case channel_name
28
+ when :youporn
29
+ Youporn.new
30
+ when :szukajcipki
31
+ SzukajCipki.new
32
+ end
33
+ end
34
+ end
35
+ end
data/xxx.gemspec ADDED
@@ -0,0 +1,62 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{xxx}
8
+ s.version = "0.1.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jakub Kuźma", "Wojciech Wnętrzak"]
12
+ s.date = %q{2010-04-02}
13
+ s.default_executable = %q{xxx}
14
+ s.description = %q{To watch a porn just type from your command line: xxx}
15
+ s.email = %q{qoobaa@gmail.com}
16
+ s.executables = ["xxx"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README.rdoc"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ ".gitignore",
24
+ "LICENSE",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/xxx",
29
+ "lib/xxx.rb",
30
+ "lib/xxx/szukaj_cipki.rb",
31
+ "lib/xxx/youporn.rb",
32
+ "test/helper.rb",
33
+ "test/test_xxx.rb",
34
+ "xxx.gemspec"
35
+ ]
36
+ s.homepage = %q{http://github.com/qoobaa/xxx}
37
+ s.rdoc_options = ["--charset=UTF-8"]
38
+ s.require_paths = ["lib"]
39
+ s.rubygems_version = %q{1.3.6}
40
+ s.summary = %q{Porn of the day}
41
+ s.test_files = [
42
+ "test/test_xxx.rb",
43
+ "test/helper.rb"
44
+ ]
45
+
46
+ if s.respond_to? :specification_version then
47
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
48
+ s.specification_version = 3
49
+
50
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
51
+ s.add_runtime_dependency(%q<launchy>, [">= 0"])
52
+ s.add_runtime_dependency(%q<mechanize>, [">= 1.0"])
53
+ else
54
+ s.add_dependency(%q<launchy>, [">= 0"])
55
+ s.add_dependency(%q<mechanize>, [">= 1.0"])
56
+ end
57
+ else
58
+ s.add_dependency(%q<launchy>, [">= 0"])
59
+ s.add_dependency(%q<mechanize>, [">= 1.0"])
60
+ end
61
+ end
62
+
metadata CHANGED
@@ -1,31 +1,52 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xxx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 2
9
+ version: 0.1.2
5
10
  platform: ruby
6
11
  authors:
7
12
  - "Jakub Ku\xC5\xBAma"
13
+ - "Wojciech Wn\xC4\x99trzak"
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-02-05 00:00:00 +01:00
13
- default_executable:
18
+ date: 2010-04-02 00:00:00 +02:00
19
+ default_executable: xxx
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
- name: thoughtbot-shoulda
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ name: launchy
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
23
30
  version: "0"
24
- version:
25
- description:
26
- email: qoobaa+github@gmail.com
27
- executables: []
28
-
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: mechanize
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 1
42
+ - 0
43
+ version: "1.0"
44
+ type: :runtime
45
+ version_requirements: *id002
46
+ description: "To watch a porn just type from your command line: xxx"
47
+ email: qoobaa@gmail.com
48
+ executables:
49
+ - xxx
29
50
  extensions: []
30
51
 
31
52
  extra_rdoc_files:
@@ -37,9 +58,14 @@ files:
37
58
  - LICENSE
38
59
  - README.rdoc
39
60
  - Rakefile
61
+ - VERSION
62
+ - bin/xxx
40
63
  - lib/xxx.rb
64
+ - lib/xxx/szukaj_cipki.rb
65
+ - lib/xxx/youporn.rb
41
66
  - test/helper.rb
42
67
  - test/test_xxx.rb
68
+ - xxx.gemspec
43
69
  has_rdoc: true
44
70
  homepage: http://github.com/qoobaa/xxx
45
71
  licenses: []
@@ -53,18 +79,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
79
  requirements:
54
80
  - - ">="
55
81
  - !ruby/object:Gem::Version
82
+ segments:
83
+ - 0
56
84
  version: "0"
57
- version:
58
85
  required_rubygems_version: !ruby/object:Gem::Requirement
59
86
  requirements:
60
87
  - - ">="
61
88
  - !ruby/object:Gem::Version
89
+ segments:
90
+ - 0
62
91
  version: "0"
63
- version:
64
92
  requirements: []
65
93
 
66
94
  rubyforge_project:
67
- rubygems_version: 1.3.5
95
+ rubygems_version: 1.3.6
68
96
  signing_key:
69
97
  specification_version: 3
70
98
  summary: Porn of the day