edango 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/Copying.txt +679 -0
  2. data/History.txt +6 -0
  3. data/Manifest.txt +46 -0
  4. data/PostInstall.txt +6 -0
  5. data/README.rdoc +117 -0
  6. data/Rakefile +21 -0
  7. data/bin/edango +34 -0
  8. data/lib/edango.rb +42 -0
  9. data/lib/edango/context.rb +23 -0
  10. data/lib/edango/context/directories.rb +67 -0
  11. data/lib/edango/context/files.rb +37 -0
  12. data/lib/edango/context/language.rb +101 -0
  13. data/lib/edango/context/parameters.rb +44 -0
  14. data/lib/edango/context/services.rb +147 -0
  15. data/lib/edango/di/container.rb +160 -0
  16. data/lib/edango/di/helpers.rb +41 -0
  17. data/lib/edango/di/proxy.rb +54 -0
  18. data/lib/edango/di/service.rb +60 -0
  19. data/lib/edango/di/service_factory.rb +40 -0
  20. data/lib/edango/environment.rb +77 -0
  21. data/lib/edango/executor.rb +64 -0
  22. data/lib/edango/helpers/hash.rb +30 -0
  23. data/lib/edango/helpers/kernel.rb +41 -0
  24. data/lib/edango/helpers/object.rb +65 -0
  25. data/lib/edango/helpers/string.rb +29 -0
  26. data/lib/edango/helpers/symbol.rb +39 -0
  27. data/lib/edango/logic/ticket_extractor.rb +258 -0
  28. data/lib/edango/site/core.rb +182 -0
  29. data/lib/edango/site/public/favicon.ico +0 -0
  30. data/lib/edango/site/public/images/btn-back-help.png +0 -0
  31. data/lib/edango/site/public/images/bullet.png +0 -0
  32. data/lib/edango/site/public/images/ctrl-back.gif +0 -0
  33. data/lib/edango/site/public/images/frm-back-err.png +0 -0
  34. data/lib/edango/site/public/images/frm-back-help.png +0 -0
  35. data/lib/edango/site/public/images/frm-back.png +0 -0
  36. data/lib/edango/site/public/images/logo.png +0 -0
  37. data/lib/edango/site/public/scripts/jquery.js +4376 -0
  38. data/lib/edango/site/public/scripts/jquery.min.js +19 -0
  39. data/lib/edango/site/public/scripts/logic.js +6 -0
  40. data/lib/edango/site/public/styles/layout.css +270 -0
  41. data/lib/edango/site/views/errors.haml +12 -0
  42. data/lib/edango/site/views/help.haml +10 -0
  43. data/lib/edango/site/views/index.haml +27 -0
  44. data/lib/edango/site/views/layout.haml +15 -0
  45. data/lib/edango/site/views/result.haml +10 -0
  46. data/lib/edango/starter.rb +141 -0
  47. metadata +162 -0
data/History.txt ADDED
@@ -0,0 +1,6 @@
1
+ === 0.5.1 / 2010-01-10
2
+
3
+ * 1 major enhancement
4
+
5
+ * Initial release
6
+
data/Manifest.txt ADDED
@@ -0,0 +1,46 @@
1
+ Copying.txt
2
+ History.txt
3
+ Manifest.txt
4
+ PostInstall.txt
5
+ README.rdoc
6
+ Rakefile
7
+ bin/edango
8
+ lib/edango.rb
9
+ lib/edango/context.rb
10
+ lib/edango/context/directories.rb
11
+ lib/edango/context/files.rb
12
+ lib/edango/context/language.rb
13
+ lib/edango/context/parameters.rb
14
+ lib/edango/context/services.rb
15
+ lib/edango/di/container.rb
16
+ lib/edango/di/helpers.rb
17
+ lib/edango/di/proxy.rb
18
+ lib/edango/di/service.rb
19
+ lib/edango/di/service_factory.rb
20
+ lib/edango/environment.rb
21
+ lib/edango/executor.rb
22
+ lib/edango/helpers/hash.rb
23
+ lib/edango/helpers/kernel.rb
24
+ lib/edango/helpers/object.rb
25
+ lib/edango/helpers/string.rb
26
+ lib/edango/helpers/symbol.rb
27
+ lib/edango/logic/ticket_extractor.rb
28
+ lib/edango/site/core.rb
29
+ lib/edango/site/public/favicon.ico
30
+ lib/edango/site/public/images/btn-back-help.png
31
+ lib/edango/site/public/images/bullet.png
32
+ lib/edango/site/public/images/ctrl-back.gif
33
+ lib/edango/site/public/images/frm-back-err.png
34
+ lib/edango/site/public/images/frm-back-help.png
35
+ lib/edango/site/public/images/frm-back.png
36
+ lib/edango/site/public/images/logo.png
37
+ lib/edango/site/public/scripts/jquery.js
38
+ lib/edango/site/public/scripts/jquery.min.js
39
+ lib/edango/site/public/scripts/logic.js
40
+ lib/edango/site/public/styles/layout.css
41
+ lib/edango/site/views/errors.haml
42
+ lib/edango/site/views/help.haml
43
+ lib/edango/site/views/index.haml
44
+ lib/edango/site/views/layout.haml
45
+ lib/edango/site/views/result.haml
46
+ lib/edango/starter.rb
data/PostInstall.txt ADDED
@@ -0,0 +1,6 @@
1
+ Thank you for installing the Evil Dango application
2
+
3
+ Please be sure to read README.rdoc and History.txt
4
+ for useful information about this release.
5
+
6
+ For more info, visit http://github.com/toksaitov/edango
data/README.rdoc ADDED
@@ -0,0 +1,117 @@
1
+ = Evil Dango
2
+
3
+ == Description
4
+
5
+ Evil Dango is a small Ruby application that can extract torrent tickets from 'torrentpier'-enabled sites.
6
+ It fetches a ticket with a predefined account and replaces the initial passkey with the new defined one.
7
+
8
+ == Requirements
9
+
10
+ * Ruby 1.8.6 or later
11
+
12
+ === Dependencies
13
+
14
+ * sinatra (version 0.9.4 or later)
15
+ * mechanize (version 0.9.3 or later)
16
+
17
+ === Extra Development Dependencies
18
+
19
+ * hoe (version 2.5.0 or later)
20
+
21
+ == Installation
22
+
23
+ === Gem Installation
24
+
25
+ The preferred method of installation is through the _Gem_ file. For this you will need to have *RubyGems* installed.
26
+ You can install the application and all its dependencies with the following command:
27
+
28
+ gem install edango
29
+
30
+ Now you need to add at least one account specifications to the application configuration file.
31
+ This can be done with the -s or --site flags passed with the specs to the application starter script.
32
+
33
+ edango --site "URL_REGEX, TICKET_LINK_REGEX, PASSKEY[, LOGIN:PASSWORD[, LOGIN_URL]]"
34
+
35
+ === Other Installation Methods
36
+
37
+ You can clone, download or whatever else to get the application package from the *github*.
38
+ In this case you need to use +edango+ script directly from the +bin+ directory and you
39
+ need to resolve all application dependencies manually.
40
+
41
+ == Application Usage
42
+
43
+ 1. Start EDango with the following command:
44
+
45
+ edango
46
+
47
+ You will see something similar to this:
48
+
49
+ EDango has started
50
+ == Sinatra/0.9.4 has taken the stage on 6666 for production with backup from WEBrick
51
+
52
+ 2. Now point you browser to http://127.0.0.1:6666.
53
+ Do not forget to specify the correct port provided to you by the program on the first step.
54
+
55
+ 3. Proceed with the instructions in your browser.
56
+
57
+ The server can be stopped with a <em>Ctrl-C</em> keyboard combination.
58
+
59
+ == Command Line Usage
60
+
61
+ The list of command line options can be obtained from the EDango executable by one of the following calls:
62
+
63
+ edango -h
64
+ edango --help
65
+
66
+ == Application Directory
67
+
68
+ <em>.edango</em> is a default application directory that can be usually found under
69
+ a path specified either in the +EDANGO_USER_BASE+ or in the +HOME+ environmental variable.
70
+
71
+ === Application Directory Structure
72
+
73
+ .edango
74
+ |-logs
75
+ |-tickets
76
+
77
+ <em>.edango</em> - contains all configuration files
78
+
79
+ +logs+ - contains application and server log files
80
+
81
+ +tickets+ - contains all extracted tickets
82
+
83
+ == Development
84
+
85
+ === Source Repositories
86
+
87
+ EDango is currently hosted at RubyForge and GitHub.
88
+
89
+ The RubyForge page
90
+ * http://rubyforge.org/projects/edango
91
+
92
+ The github web page
93
+ * http://github.com/toksaitov/edango
94
+
95
+ The public git clone URL
96
+ * http://github.com/toksaitov/edango.git
97
+
98
+ == Contact Information
99
+
100
+ Author:: Toksaitov Dmitrii Alexandrovich <toksaitov.d@gmail.com>
101
+
102
+ == License
103
+
104
+ (The GNU General Public License)
105
+
106
+ EDango - torrent ticket extractor.
107
+ Copyright (C) 2010 Toksaitov Dmitrii Alexandrovich
108
+
109
+ This program is free software: you can redistribute it and/or modify
110
+ it under the terms of the GNU General Public License as published by
111
+ the Free Software Foundation, either version 3 of the License, or
112
+ (at your option) any later version.
113
+
114
+ This program is distributed in the hope that it will be useful,
115
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
116
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117
+ GNU General Public License for more details.
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ EDANGO_ROOT = File.expand_path(File.dirname(__FILE__))
7
+ require File.expand_path(File.join(EDANGO_ROOT, 'lib', 'edango'))
8
+
9
+ Hoe.spec EDango::UNIX_NAME do
10
+ self.version = EDango::VERSION
11
+ self.developer EDango::AUTHOR, EDango::EMAIL
12
+ self.url = EDango::URL
13
+
14
+ self.readme_file = 'README.rdoc'
15
+ self.post_install_message = File.read(File.expand_path(File.join(EDANGO_ROOT, 'PostInstall.txt'))) rescue ''
16
+
17
+ self.extra_deps = [['sinatra', '>= 0.9.4'],
18
+ ['mechanize', '>= 0.9.3']]
19
+ end
20
+
21
+ # vim: syntax=ruby
data/bin/edango ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- ruby -*-
3
+ #
4
+ # EDango - torrent ticket extractor.
5
+ # Copyright (C) 2010 Dmitrii Toksaitov
6
+ #
7
+ # This file is part of EDango.
8
+ #
9
+ # EDango is free software: you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation, either version 3 of the License, or
12
+ # (at your option) any later version.
13
+ #
14
+ # EDango is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # GNU General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU General Public License
20
+ # along with EDango. If not, see <http://www.gnu.org/licenses/>.
21
+
22
+ require 'rubygems'
23
+
24
+ begin
25
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'edango'))
26
+
27
+ status = EDango::SERVICES[:starter].run()
28
+ rescue Exception => e
29
+ status = 1; puts("Fatal error: #{e.message}", e.backtrace)
30
+ end
31
+
32
+ exit!(status)
33
+
34
+ # vim: syntax=ruby
data/lib/edango.rb ADDED
@@ -0,0 +1,42 @@
1
+ # EDango - torrent ticket extractor.
2
+ # Copyright (C) 2010 Dmitrii Toksaitov
3
+ #
4
+ # This file is part of EDango.
5
+ #
6
+ # EDango is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # EDango is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with EDango. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ current_dir = File.dirname(__FILE__)
20
+ current_abs_path = File.expand_path(current_dir)
21
+
22
+ $LOAD_PATH.unshift(current_dir) unless $LOAD_PATH.include?(current_dir) or
23
+ $LOAD_PATH.include?(current_abs_path)
24
+
25
+ module EDango
26
+ FULL_NAME = 'EDango'
27
+ UNIX_NAME = 'edango'
28
+ VERSION = '0.5.1'
29
+
30
+ AUTHOR = 'Toksaitov Dmitrii Alexandrovich'
31
+
32
+ EMAIL = "toksaitov.d@gmail.com"
33
+ URL = "http://github.com/toksaitov/#{UNIX_NAME}/"
34
+
35
+ COPYRIGHT = "Copyright (C) 2010 #{AUTHOR}"
36
+
37
+ USER_BASE_DIRECTORY = ENV["#{UNIX_NAME.upcase()}_USER_BASE"] || File.join('~', ".#{UNIX_NAME}")
38
+
39
+ GLOBALS = {}
40
+ end
41
+
42
+ require 'edango/context'
@@ -0,0 +1,23 @@
1
+ # EDango - torrent ticket extractor.
2
+ # Copyright (C) 2010 Dmitrii Toksaitov
3
+ #
4
+ # This file is part of EDango.
5
+ #
6
+ # EDango is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # EDango is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with EDango. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'edango/context/language'
20
+ require 'edango/context/directories'
21
+ require 'edango/context/files'
22
+ require 'edango/context/services'
23
+ require 'edango/context/parameters'
@@ -0,0 +1,67 @@
1
+ # EDango - torrent ticket extractor.
2
+ # Copyright (C) 2010 Dmitrii Toksaitov
3
+ #
4
+ # This file is part of EDango.
5
+ #
6
+ # EDango is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # EDango is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with EDango. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'edango/di/container'
20
+
21
+ module EDango
22
+
23
+ DIRECTORIES = DI::Container.new do
24
+ asset :base do
25
+ File.prepare_directory(File.join('~', ".#{UNIX_NAME}"))
26
+ end
27
+
28
+ asset :helpers do
29
+ File.expand_path(File.join(File.dirname(__FILE__), '..', 'helpers'))
30
+ end
31
+
32
+ asset :site do
33
+ File.expand_path(File.join(File.dirname(__FILE__), '..', 'site'))
34
+ end
35
+
36
+ asset :views do
37
+ File.join(DIRECTORIES[:site], 'views')
38
+ end
39
+
40
+ asset :public do
41
+ File.join(DIRECTORIES[:site], 'public')
42
+ end
43
+
44
+ asset :styles do
45
+ File.join(DIRECTORIES[:public], 'styles')
46
+ end
47
+
48
+ asset :scripts do
49
+ File.join(DIRECTORIES[:public], 'scripts')
50
+ end
51
+
52
+ asset :images do
53
+ File.join(DIRECTORIES[:public], 'images')
54
+ end
55
+
56
+ asset :tickets do
57
+ File.prepare_directory(File.join(DIRECTORIES[:base], 'tickets'))
58
+ end
59
+
60
+ asset :log do
61
+ File.prepare_directory(File.join(DIRECTORIES[:base], 'logs'))
62
+ end
63
+ end
64
+
65
+ DIRS = DIRECTORIES
66
+
67
+ end
@@ -0,0 +1,37 @@
1
+ # EDango - torrent ticket extractor.
2
+ # Copyright (C) 2010 Dmitrii Toksaitov
3
+ #
4
+ # This file is part of EDango.
5
+ #
6
+ # EDango is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # EDango is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with EDango. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'edango/di/container'
20
+
21
+ module EDango
22
+
23
+ FILES = DI::Container.new do
24
+ asset :log do
25
+ File.join(DIRECTORIES[:log], 'application.log')
26
+ end
27
+
28
+ asset :options do
29
+ File.join(DIRECTORIES[:base], 'options.yml')
30
+ end
31
+
32
+ asset :helpers do
33
+ Dir[File.join(DIRECTORIES[:helpers], '**', '*.rb')]
34
+ end
35
+ end
36
+
37
+ end
@@ -0,0 +1,101 @@
1
+ # EDango - torrent ticket extractor.
2
+ # Copyright (C) 2010 Dmitrii Toksaitov
3
+ #
4
+ # This file is part of EDango.
5
+ #
6
+ # EDango is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # EDango is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with EDango. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'edango/di/container'
20
+
21
+ module EDango
22
+ module Language
23
+
24
+ UN_US = DI::Container.new do
25
+ asset :agent_title => 'Evil Dango - Ticket Extractor'
26
+
27
+ asset :description => 'torrent ticket extractor'
28
+
29
+ asset :url_label => 'link:'
30
+ asset :url_hint => 'A page link where the desired ticket can be downloaded'
31
+
32
+ asset :passkey_label => 'passkey:'
33
+ asset :passkey_hint => 'A passkey that will be used in the extracted ticket'
34
+
35
+ asset :process_hint => 'Extract a ticket'
36
+
37
+ asset :result_form_title => 'Result:'
38
+ asset :ticket_link_title => 'Extracted ticket'
39
+
40
+ asset :more_hint => 'Extract more tickets'
41
+
42
+ asset :help_hint => 'Show/Hide help'
43
+
44
+ asset :synopsys_title => 'Synopsys:'
45
+
46
+ asset :synopsys_text => "Evil Dango can help you to extract torrent tickets from 'torrentpier'-enabled "\
47
+ "sites. It fetches a ticket with a predefined account and replaces the initial "\
48
+ "passkey with a new defined one."
49
+
50
+ asset :notes_title => 'Notes:'
51
+
52
+ asset :passkey_note => "The passkey can usually be found on the 'profile' page of the site."
53
+
54
+ asset :link_note => "The URL in the 'link' field should point to the page "\
55
+ "where a download link for the ticket can be found."
56
+
57
+ asset :all_specs => 'all specifications'
58
+ asset :no_specs_for_url => 'Specifications were not found for the link.'
59
+
60
+ asset :error_form_title => 'The following problems occurred:'
61
+ asset :error_list_title => 'Problems with'
62
+
63
+ asset :specified_file => 'the specified file'
64
+ asset :file_not_found => 'File was not found'
65
+
66
+ asset :operation_timed_out => 'The process did not finish in the specified time limit.'
67
+
68
+ asset :empty_url => 'The link field should not be empty.'
69
+ asset :empty_passkey => 'The passkey field should not be empty.'
70
+
71
+ asset :empty_source_passkey => 'A passkey used to find replacement places in the ticket was not specified.'
72
+ asset :empty_ticket_link_regex => 'A regular expression used to search for a ticket download link was not set.'
73
+
74
+ asset :empty_login => 'A login name for the account used in the ticket extraction process was not set.'
75
+ asset :empty_password => 'A password for the account used in the ticket extraction process was not specified.'
76
+
77
+ asset :empty_login_url => 'A login url for the account used in the ticket extraction process was not set.'
78
+
79
+ asset :login_process_failed => 'Failed to log in.'
80
+
81
+ asset :ticket_page_loading_failed => 'Failed to load the page with a ticket link.'
82
+ asset :ticket_link_not_found => 'A link for the ticket was not found on the specified page.'
83
+
84
+ asset :raw_ticket_not_saved => 'Failed to download and save the ticket.'
85
+
86
+ asset :raw_ticket_not_opened => 'Failed to read saved ticket in order to replace its passkey.'
87
+ asset :passkey_not_found => 'The extracted ticket does not have an initial passkey to change.'
88
+ asset :processed_ticket_not_saved => 'Failed to save processed ticket.'
89
+ end
90
+
91
+ end
92
+
93
+ LANGUAGE = LANG = Language::UN_US
94
+ end
95
+
96
+ module Kernel
97
+ def translate(key)
98
+ EDango::LANGUAGE[key] || key.to_s()
99
+ end
100
+ alias t translate
101
+ end