Graphiclious 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/README.txt +1 -0
  2. data/doc/extern.gif +0 -0
  3. data/doc/index.html +42 -9
  4. data/doc/screenshots/original/{cornflower.html → 01-blue-style-1.html} +5 -5
  5. data/doc/screenshots/original/{blue-style-1.jpg → 01-blue-style-1.jpg} +0 -0
  6. data/doc/screenshots/original/{blue-style-1.html → 02-cornflower.html} +5 -5
  7. data/doc/screenshots/original/{cornflower.jpg → 02-cornflower.jpg} +0 -0
  8. data/doc/screenshots/original/{sample-graph.html → 03-sample-graph.html} +5 -5
  9. data/doc/screenshots/original/{sample-graph.jpg → 03-sample-graph.jpg} +0 -0
  10. data/doc/screenshots/original/04-basic-style-js.html +37 -0
  11. data/doc/screenshots/original/04-basic-style-js.jpg +0 -0
  12. data/doc/screenshots/original/05-custom-style.html +37 -0
  13. data/doc/screenshots/original/05-custom-style.jpg +0 -0
  14. data/doc/screenshots/original/06-custom-style-js.html +37 -0
  15. data/doc/screenshots/original/06-custom-style-js.jpg +0 -0
  16. data/doc/screenshots/original/07-user-interface.html +37 -0
  17. data/doc/screenshots/original/07-user-interface.jpg +0 -0
  18. data/doc/screenshots/original/{custom-style.html → 08-ftp-upload.html} +5 -5
  19. data/doc/screenshots/original/08-ftp-upload.jpg +0 -0
  20. data/doc/screenshots/thumb.html +22 -10
  21. data/doc/screenshots/thumb/{t_blue-style-1.jpg → t_01-blue-style-1.jpg} +0 -0
  22. data/doc/screenshots/thumb/{t_cornflower.jpg → t_02-cornflower.jpg} +0 -0
  23. data/doc/screenshots/thumb/{t_sample-graph.jpg → t_03-sample-graph.jpg} +0 -0
  24. data/doc/screenshots/thumb/t_04-basic-style-js.jpg +0 -0
  25. data/doc/screenshots/thumb/t_05-custom-style.jpg +0 -0
  26. data/doc/screenshots/thumb/t_06-custom-style-js.jpg +0 -0
  27. data/doc/screenshots/thumb/t_07-user-interface.jpg +0 -0
  28. data/doc/screenshots/thumb/t_08-ftp-upload.jpg +0 -0
  29. data/doc/style.css +7 -4
  30. data/javascript/cloud.js +236 -0
  31. data/javascript/index.htm +24 -0
  32. data/javascript/link.js +25 -0
  33. data/javascript/style.css +52 -0
  34. data/lib/graphiclious.rb +6 -1
  35. data/lib/graphiclious/delicious2yaml.rb +75 -16
  36. data/lib/graphiclious/environment.rb +14 -1
  37. data/lib/graphiclious/ftp_browser.rb +53 -0
  38. data/lib/graphiclious/gui.rb +78 -24
  39. data/lib/graphiclious/help.rb +1 -0
  40. data/lib/graphiclious/version.rb +1 -1
  41. data/lib/graphiclious/yaml-links2html.rb +79 -64
  42. data/lib/graphiclious/yaml-links2js.rb +159 -0
  43. metadata +36 -19
  44. data/doc/screenshots/original/custom-style.jpg +0 -0
  45. data/doc/screenshots/original/user-interface.html +0 -37
  46. data/doc/screenshots/original/user-interface.jpg +0 -0
  47. data/doc/screenshots/thumb/t_custom-style.jpg +0 -0
  48. data/doc/screenshots/thumb/t_user-interface.jpg +0 -0
@@ -0,0 +1,159 @@
1
+ #!/usr/bin/env ruby
2
+ #$Id: yaml-links2js.rb,v 1.20 2006/03/09 22:57:52 wsdng Exp $
3
+
4
+ require 'yaml'
5
+ require 'ftools'
6
+ require 'graphiclious/environment'
7
+ require 'graphiclious/url_graph'
8
+
9
+ class YamlLinksToJavascript
10
+ attr_accessor(:write_only_diff_tags, :include_private)
11
+
12
+ # differs from working dir in YamlLinksToHtml
13
+ # because we do not need to know the user
14
+ def set_working_dir(new_working_dir)
15
+ @working_dir = new_working_dir
16
+ @input_file = File.join(@working_dir, 'delicious.yaml')
17
+ @diff_file = File.join(@working_dir, 'delicious.diff.yaml')
18
+ @js_output_path = File.join(@working_dir, 'js')
19
+ end
20
+
21
+ def initialize
22
+ @include_private = false
23
+ @write_only_diff_tags = true
24
+ @diff_tags = Set.new
25
+ set_working_dir(Dir.getwd)
26
+ end
27
+
28
+ def set_protocol_block(aProc)
29
+ @protocol_block = aProc
30
+ end
31
+
32
+ def write_line_on_protokol(lineString)
33
+ puts lineString
34
+ unless @protocol_block.nil?
35
+ @protocol_block.call(lineString)
36
+ end
37
+ end
38
+
39
+ # copy graphiclious javascripts to working dir
40
+ def copy_scripts
41
+ ['*.js', '*.htm', '*.css'].each do
42
+ |pattern|
43
+ Dir[File.join(JS_TEMPLATES_FOLDER, pattern)].each do
44
+ |template_file|
45
+ write_line_on_protokol("Copy #{template_file}")
46
+ File.copy(template_file, @js_output_path)
47
+ end
48
+ end
49
+ end
50
+
51
+ # methods for js-generation
52
+
53
+ def write_js_head_on(fp)
54
+ fp.puts '/*---javascript generated by graphiclious/yaml-links2js.rb---*/'
55
+ fp.puts
56
+ fp.puts 'var links = new Array();'
57
+ fp.puts
58
+ end
59
+
60
+ def write_link_on(link, fp, skip_tags = [])
61
+ fp.puts "links.push(new Link("
62
+ fp.puts "\t'#{link['href']}',"
63
+ other_tags = link['tags'].reject { |t| skip_tags.include?(t) }
64
+ fp.puts "\tnew Array(" + other_tags.collect{|t| "'#{t}'"}.join(", ") + "),"
65
+ desc = link['description'].gsub(/'/, "\\'")
66
+ fp.puts "\t'#{desc}'));"
67
+ end
68
+
69
+ def load_links
70
+ if(@write_only_diff_tags)
71
+ @diff_tags = Set.new
72
+ diff = File.open(@diff_file, 'r') { |io| YAML.load(io) }
73
+ diff.keys.each { |k|
74
+ diff[k]['tags'].each {|t| @diff_tags.add(t) }
75
+ }
76
+ end
77
+
78
+ # load yaml-file containing links as a hash
79
+ cache = File.open(@input_file, 'r') { |io|
80
+ YAML.load(io)
81
+ }
82
+ links = cache.values
83
+ unless(@include_private)
84
+ links = links.reject { |l| l['shared'] =~ /no/ }
85
+ end
86
+
87
+ @links_by_tag = Hash.new
88
+ links.each do
89
+ |link|
90
+ tagsOfLink = link['tags'].reject { |t| t =~ /^for:/ }
91
+ link['tags'] = tagsOfLink
92
+ n = tagsOfLink.size - 1
93
+ (0..n).each do
94
+ |i|
95
+ tag = tagsOfLink[i]
96
+ unless @links_by_tag.has_key?(tag)
97
+ @links_by_tag[tag] = Array.new
98
+ end
99
+ @links_by_tag[tag].push(link)
100
+ end
101
+ end
102
+
103
+ @links_by_tag.keys.each { |tag|
104
+ @links_by_tag[tag] = @links_by_tag[tag].sort { |l1, l2|
105
+ l1['description'] <=> l2['description']
106
+ }
107
+ }
108
+ links
109
+ end
110
+
111
+ def fatal(msg)
112
+ write_line_on_protokol(msg)
113
+ exit(1)
114
+ end
115
+
116
+ # Create one Javascript-File for each tag
117
+ def write_single_tag_files
118
+ @links_by_tag.keys.each do
119
+ |tag|
120
+ if !@write_only_diff_tags or @diff_tags.include?(tag)
121
+ File.open(File.join(@js_output_path, "#{UrlGraph.tag2file(tag)}.js"), 'w') do
122
+ |fp|
123
+ write_js_head_on(fp)
124
+ @links_by_tag[tag].each { |link|
125
+ write_link_on(link, fp, [tag])
126
+ }
127
+ end
128
+ end
129
+ end
130
+ write_line_on_protokol "Wrote one js-file for each tag to directory #{@js_output_path}."
131
+ end
132
+
133
+ def write_all_links_file links
134
+ File.open(File.join(@js_output_path, "_all.js"), 'w') do
135
+ |fp|
136
+ write_js_head_on(fp)
137
+ links.each { |link|
138
+ write_link_on(link, fp, [])
139
+ }
140
+ end
141
+ end
142
+
143
+ # run the complete batch
144
+ def run
145
+ unless File.exists?(@input_file)
146
+ raise "Missing input file #{@input_file}"
147
+ end
148
+ Dir.mkdir(@js_output_path) unless File.directory?(@js_output_path)
149
+ copy_scripts
150
+ links = load_links
151
+ write_all_links_file links
152
+ # write_single_tag_files
153
+ write_line_on_protokol "Finished."
154
+ end
155
+ end
156
+
157
+ if $0 == __FILE__
158
+ YamlLinksToJavascript.new.run
159
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: Graphiclious
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2006-04-22 00:00:00 +02:00
6
+ version: 0.1.1
7
+ date: 2006-08-25 00:00:00 +02:00
8
8
  summary: Create an html image map pointing to generated static html pages from your del.icio.us links. Uses Rubilicious and Graphviz. Interface done with FXRuby
9
9
  require_paths:
10
10
  - lib
@@ -39,6 +39,7 @@ files:
39
39
  - wickie
40
40
  - test
41
41
  - Rakefile
42
+ - javascript
42
43
  - styles/cornflower
43
44
  - styles/blue-style-1
44
45
  - styles/cornflower/cornflower.png
@@ -64,31 +65,47 @@ files:
64
65
  - lib/graphiclious/yaml-links2html.rb
65
66
  - lib/graphiclious/gui.rb
66
67
  - lib/graphiclious/environment.rb
68
+ - lib/graphiclious/ftp_browser.rb
69
+ - lib/graphiclious/yaml-links2js.rb
67
70
  - doc/screenshots
68
71
  - doc/index.html
69
72
  - doc/style.css
70
73
  - doc/cloud.jpg
71
- - doc/screenshots/default.css
72
- - doc/screenshots/thumb.html
74
+ - doc/extern.gif
73
75
  - doc/screenshots/original
74
76
  - doc/screenshots/thumb
75
- - doc/screenshots/original/blue-style-1.html
76
- - doc/screenshots/original/blue-style-1.jpg
77
- - doc/screenshots/original/cornflower.html
78
- - doc/screenshots/original/cornflower.jpg
79
- - doc/screenshots/original/custom-style.html
80
- - doc/screenshots/original/custom-style.jpg
81
- - doc/screenshots/original/sample-graph.html
82
- - doc/screenshots/original/sample-graph.jpg
83
- - doc/screenshots/original/user-interface.html
84
- - doc/screenshots/original/user-interface.jpg
85
- - doc/screenshots/thumb/t_blue-style-1.jpg
86
- - doc/screenshots/thumb/t_cornflower.jpg
87
- - doc/screenshots/thumb/t_custom-style.jpg
88
- - doc/screenshots/thumb/t_sample-graph.jpg
89
- - doc/screenshots/thumb/t_user-interface.jpg
77
+ - doc/screenshots/thumb.html
78
+ - doc/screenshots/default.css
79
+ - doc/screenshots/original/01-blue-style-1.jpg
80
+ - doc/screenshots/original/02-cornflower.jpg
81
+ - doc/screenshots/original/03-sample-graph.jpg
82
+ - doc/screenshots/original/04-basic-style-js.jpg
83
+ - doc/screenshots/original/05-custom-style.jpg
84
+ - doc/screenshots/original/06-custom-style-js.jpg
85
+ - doc/screenshots/original/07-user-interface.jpg
86
+ - doc/screenshots/original/08-ftp-upload.jpg
87
+ - doc/screenshots/original/01-blue-style-1.html
88
+ - doc/screenshots/original/02-cornflower.html
89
+ - doc/screenshots/original/03-sample-graph.html
90
+ - doc/screenshots/original/04-basic-style-js.html
91
+ - doc/screenshots/original/05-custom-style.html
92
+ - doc/screenshots/original/06-custom-style-js.html
93
+ - doc/screenshots/original/07-user-interface.html
94
+ - doc/screenshots/original/08-ftp-upload.html
95
+ - doc/screenshots/thumb/t_01-blue-style-1.jpg
96
+ - doc/screenshots/thumb/t_02-cornflower.jpg
97
+ - doc/screenshots/thumb/t_03-sample-graph.jpg
98
+ - doc/screenshots/thumb/t_04-basic-style-js.jpg
99
+ - doc/screenshots/thumb/t_05-custom-style.jpg
100
+ - doc/screenshots/thumb/t_06-custom-style-js.jpg
101
+ - doc/screenshots/thumb/t_07-user-interface.jpg
102
+ - doc/screenshots/thumb/t_08-ftp-upload.jpg
90
103
  - bin/graphiclious
91
104
  - test/test_delicious2yaml.rb
105
+ - javascript/style.css
106
+ - javascript/link.js
107
+ - javascript/cloud.js
108
+ - javascript/index.htm
92
109
  test_files: []
93
110
  rdoc_options: []
94
111
  extra_rdoc_files: []
@@ -1,37 +0,0 @@
1
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
- "http://www.w3.org/TR/html4/strict.dtd">
3
- <html>
4
- <head>
5
- <meta name="GENERATOR" content="XnView">
6
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
7
- <meta http-equiv="Content-Language" content="en-us">
8
- <title>Graphiclious screenshots</title>
9
- <link rel="stylesheet" type="text/css" href="../default.css">
10
- <style type="text/css">
11
- table, td {
12
- border: none;
13
- background-color: #ffffff;
14
- }
15
- </style>
16
- </head>
17
- <body>
18
- <H1>Graphiclious - user-interface.jpg</H1>
19
- <p>
20
- <a href="sample-graph.html">Previous</a> |
21
- <a href="blue-style-1.html">Next</a> |
22
- <a href="../thumb.html">Thumbnails</a>
23
- </p>
24
- <table cellpadding="2" cellspacing="5">
25
- <tr>
26
- <td><img src="user-interface.jpg" alt="user-interface.jpg" width="348" height="427"></td>
27
- </tr>
28
- <tr>
29
- <td>user-interface</td>
30
- </tr>
31
- <tr>
32
- <td><p><i>This page was generated by <a href="http://www.xnview.com">XnView</a></i></p></td>
33
- </tr>
34
- </table>
35
- </body>
36
- </html>
37
-