De.linque.nt 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +148 -0
- data/bin/delinquent +90 -0
- data/doc/classes/Delinquent.html +250 -0
- data/doc/classes/Delinquent.src/M000001.html +18 -0
- data/doc/classes/Delinquent.src/M000002.html +18 -0
- data/doc/classes/Delinquent.src/M000003.html +25 -0
- data/doc/classes/Delinquent.src/M000004.html +29 -0
- data/doc/classes/Delinquent.src/M000005.html +29 -0
- data/doc/classes/Delinquent.src/M000006.html +18 -0
- data/doc/classes/Delinquent.src/M000007.html +18 -0
- data/doc/classes/Delinquent.src/M000008.html +19 -0
- data/doc/classes/Delinquent.src/M000009.html +18 -0
- data/doc/classes/Delinquent.src/M000010.html +19 -0
- data/doc/classes/Delinquent.src/M000011.html +18 -0
- data/doc/classes/Delinquent.src/M000012.html +18 -0
- data/doc/classes/Delinquent.src/M000013.html +18 -0
- data/doc/classes/Delinquent.src/M000014.html +25 -0
- data/doc/classes/Delinquent.src/M000015.html +29 -0
- data/doc/classes/Delinquent.src/M000016.html +29 -0
- data/doc/classes/Delinquent.src/M000017.html +18 -0
- data/doc/classes/Delinquent.src/M000018.html +18 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +298 -0
- data/doc/files/examples/deform_rb.html +101 -0
- data/doc/files/lib/de_linque_nt_rb.html +110 -0
- data/doc/files/pkg/De_linque_nt-0_0_1/examples/deform_rb.html +101 -0
- data/doc/files/pkg/De_linque_nt-0_0_1/lib/de_linque_nt_rb.html +110 -0
- data/doc/fr_class_index.html +27 -0
- data/doc/fr_file_index.html +28 -0
- data/doc/fr_method_index.html +33 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/examples/deform.rb +13 -0
- data/js/bloglines.delinquent.user.js +119 -0
- data/js/delinquent.user.js +117 -0
- data/lib/de.linque.nt.rb +117 -0
- metadata +95 -0
data/lib/de.linque.nt.rb
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'rubilicious'
|
2
|
+
require 'md5'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
# Allows one to create a post on del.icio.us that is itslef the URL ofr
|
6
|
+
# which the postnis tagging. Quite meta.
|
7
|
+
# The initializer must be gigven either :user_name and :password, or
|
8
|
+
# :config_file (the name of a YAML file with user_name and password hash
|
9
|
+
# values). You can also pass in :base_tag, or use the default.
|
10
|
+
class Delinquent
|
11
|
+
|
12
|
+
def deform_title( title_str )
|
13
|
+
title_str
|
14
|
+
end
|
15
|
+
|
16
|
+
def deform_content( content_str )
|
17
|
+
content_str
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize( opts = { } )
|
21
|
+
@user_name = opts[ :user_name ]
|
22
|
+
@password = opts[ :password ]
|
23
|
+
@config_file = opts[ :config_file ]
|
24
|
+
@base_tag = opts[ :base_tag ] || 'De.linque.nt'
|
25
|
+
adjust_params
|
26
|
+
warn "Creating object for '#{@user_name}', '#{@password}'"
|
27
|
+
@r = Rubilicious.new( @user_name, @password )
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# If this file is called directly it invokes +post_from_cli+
|
33
|
+
# It expects there to be some value in ARGV. All the text up to the first
|
34
|
+
# '.' character is the description; the remaining text is the extended
|
35
|
+
# text.
|
36
|
+
# The content is then posted to Del.icio.us
|
37
|
+
def post_from_cli
|
38
|
+
unless ARGV[0]
|
39
|
+
puts 'You must enter some description text, fool!'
|
40
|
+
return
|
41
|
+
end
|
42
|
+
text = ARGV.join( ' ' )
|
43
|
+
ary = text.split( '.' )
|
44
|
+
desc = ary.shift
|
45
|
+
ext = ary.join( '.' )
|
46
|
+
add( desc, ext )
|
47
|
+
recent( count = 10 ).each do |post|
|
48
|
+
puts post.inspect
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
# Adds a new post with the given description and extended text.
|
55
|
+
# You can add your own tags by enclsing thme in [ brackets ]
|
56
|
+
def add( title, content )
|
57
|
+
key_tag = tag
|
58
|
+
tags = ''
|
59
|
+
if content =~ /(\[)(.+)(\])/
|
60
|
+
tags = $2
|
61
|
+
m = $1 + $2 +$3
|
62
|
+
content.gsub!( m, '' )
|
63
|
+
end
|
64
|
+
@r.add( "#{base_url}#{key_tag}",
|
65
|
+
deform_title( title ),
|
66
|
+
deform_content( content ),
|
67
|
+
"#{key_tag} #{@base_tag} #{tags}"
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
def recent( count = 10 )
|
72
|
+
@r.recent( @base_tag, count)
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.where_i_live
|
76
|
+
File.expand_path( __FILE__ )
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
private
|
81
|
+
def tag
|
82
|
+
"#{@base_tag}#{ts}"
|
83
|
+
end
|
84
|
+
|
85
|
+
def base_url
|
86
|
+
"http://del.icio.us/#{@user_name}/"
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
# Creates a time stamp string
|
91
|
+
def ts
|
92
|
+
t = Time.new
|
93
|
+
"#{t.year}#{t.mon}#{t.day}#{t.hour}#{t.min}#{t.sec}"
|
94
|
+
end
|
95
|
+
|
96
|
+
# See what was passed in to create this object and make sure there is
|
97
|
+
# either a name/password set, or the name of a config file.
|
98
|
+
# If no name/password, then grab config from file and assign insance
|
99
|
+
# variables
|
100
|
+
def adjust_params
|
101
|
+
return if ( @user_name and @password )
|
102
|
+
unless @config_file
|
103
|
+
raise "You need to pass in a user name and passord, or the name of configuration file!"
|
104
|
+
end
|
105
|
+
params = YAML.load( IO.read( @config_file ))
|
106
|
+
@user_name = params[ 'user_name' ]
|
107
|
+
@password = params[ 'password' ]
|
108
|
+
@base_tag = params[ 'base_tag' ]if params[ 'base_tag' ]
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
if __FILE__ == $0
|
114
|
+
Delinquent.new( :config_file => "default.yml" ).post_from_cli
|
115
|
+
end
|
116
|
+
|
117
|
+
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.10
|
3
|
+
specification_version: 1
|
4
|
+
name: De.linque.nt
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.0.1
|
7
|
+
date: 2005-06-17
|
8
|
+
summary: Twisted script for ad-hoc Del.icio.us meta-posts.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: jamesgb@neurogami.com
|
12
|
+
homepage: http://de.linque.nt.rubyforge.org
|
13
|
+
rubyforge_project: de.linque.nt
|
14
|
+
description: "De.linque.nt is a tool for making meta-posts to Del.icio.us, the social
|
15
|
+
bookmarking site. The key is that the URL you bookmark is the Del.icio.us URL
|
16
|
+
that is created once you have added the new bookmark. Basically, the new post
|
17
|
+
bookmarks itself."
|
18
|
+
autorequire: de.linque.nt
|
19
|
+
default_executable: delinquent
|
20
|
+
bindir: bin
|
21
|
+
has_rdoc: true
|
22
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
23
|
+
requirements:
|
24
|
+
-
|
25
|
+
- ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.8.2
|
28
|
+
version:
|
29
|
+
platform: ruby
|
30
|
+
authors:
|
31
|
+
- James Britt
|
32
|
+
files:
|
33
|
+
- README
|
34
|
+
- bin/delinquent
|
35
|
+
- lib/de.linque.nt.rb
|
36
|
+
- js/bloglines.delinquent.user.js
|
37
|
+
- js/delinquent.user.js
|
38
|
+
- doc/fr_file_index.html
|
39
|
+
- doc/created.rid
|
40
|
+
- doc/files
|
41
|
+
- doc/classes
|
42
|
+
- doc/fr_class_index.html
|
43
|
+
- doc/fr_method_index.html
|
44
|
+
- doc/index.html
|
45
|
+
- doc/rdoc-style.css
|
46
|
+
- doc/files/lib
|
47
|
+
- doc/files/examples
|
48
|
+
- doc/files/pkg
|
49
|
+
- doc/files/README.html
|
50
|
+
- doc/files/lib/de_linque_nt_rb.html
|
51
|
+
- doc/files/examples/deform_rb.html
|
52
|
+
- doc/files/pkg/De_linque_nt-0_0_1
|
53
|
+
- doc/files/pkg/De_linque_nt-0_0_1/lib
|
54
|
+
- doc/files/pkg/De_linque_nt-0_0_1/examples
|
55
|
+
- doc/files/pkg/De_linque_nt-0_0_1/lib/de_linque_nt_rb.html
|
56
|
+
- doc/files/pkg/De_linque_nt-0_0_1/examples/deform_rb.html
|
57
|
+
- doc/classes/Delinquent.src
|
58
|
+
- doc/classes/Delinquent.html
|
59
|
+
- doc/classes/Delinquent.src/M000018.html
|
60
|
+
- doc/classes/Delinquent.src/M000001.html
|
61
|
+
- doc/classes/Delinquent.src/M000002.html
|
62
|
+
- doc/classes/Delinquent.src/M000003.html
|
63
|
+
- doc/classes/Delinquent.src/M000004.html
|
64
|
+
- doc/classes/Delinquent.src/M000005.html
|
65
|
+
- doc/classes/Delinquent.src/M000006.html
|
66
|
+
- doc/classes/Delinquent.src/M000007.html
|
67
|
+
- doc/classes/Delinquent.src/M000008.html
|
68
|
+
- doc/classes/Delinquent.src/M000009.html
|
69
|
+
- doc/classes/Delinquent.src/M000010.html
|
70
|
+
- doc/classes/Delinquent.src/M000011.html
|
71
|
+
- doc/classes/Delinquent.src/M000012.html
|
72
|
+
- doc/classes/Delinquent.src/M000013.html
|
73
|
+
- doc/classes/Delinquent.src/M000014.html
|
74
|
+
- doc/classes/Delinquent.src/M000015.html
|
75
|
+
- doc/classes/Delinquent.src/M000016.html
|
76
|
+
- doc/classes/Delinquent.src/M000017.html
|
77
|
+
- examples/deform.rb
|
78
|
+
test_files: []
|
79
|
+
rdoc_options: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
executables:
|
82
|
+
- delinquent
|
83
|
+
extensions: []
|
84
|
+
requirements: []
|
85
|
+
dependencies:
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: Rubilicious
|
88
|
+
version_requirement:
|
89
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
90
|
+
requirements:
|
91
|
+
-
|
92
|
+
- ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 0.1.5
|
95
|
+
version:
|