tiddlywiki_cp 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +674 -0
- data/History.txt +4 -0
- data/Manifest.txt +68 -0
- data/README.txt +3 -0
- data/Rakefile +123 -0
- data/bin/tiddlywiki_cp +13 -0
- data/lib/tiddlywiki_cp/converters.rb +36 -0
- data/lib/tiddlywiki_cp/file2file.rb +32 -0
- data/lib/tiddlywiki_cp/file2tiddler.rb +42 -0
- data/lib/tiddlywiki_cp/r4tw.rb +763 -0
- data/lib/tiddlywiki_cp/tiddler2directory.rb +27 -0
- data/lib/tiddlywiki_cp/tiddler2file.rb +41 -0
- data/lib/tiddlywiki_cp/tiddler2tiddlywiki.rb +29 -0
- data/lib/tiddlywiki_cp/tiddler_css.rb +39 -0
- data/lib/tiddlywiki_cp/tiddler_html.rb +39 -0
- data/lib/tiddlywiki_cp/tiddler_js.rb +39 -0
- data/lib/tiddlywiki_cp/tiddlywiki2file.rb +29 -0
- data/lib/tiddlywiki_cp/version.rb +24 -0
- data/lib/tiddlywiki_cp.rb +378 -0
- data/scripts/txt2html +67 -0
- data/setup.rb +1585 -0
- data/test/content/a +0 -0
- data/test/content/a.div +0 -0
- data/test/content/b +0 -0
- data/test/content/e +3 -0
- data/test/content/e.div +1 -0
- data/test/content/html_entities.html +6 -0
- data/test/content/test_fetch.html +6 -0
- data/test/content/universe.html +10522 -0
- data/test/r4tw/addtag.rb +93 -0
- data/test/r4tw/all.rb +29 -0
- data/test/r4tw/createfrom.rb +62 -0
- data/test/r4tw/empties/2.1.3.html +7087 -0
- data/test/r4tw/empties/2.2.0.beta5.html +8726 -0
- data/test/r4tw/fromremote.rb +19 -0
- data/test/r4tw/fromurl.rb +28 -0
- data/test/r4tw/shadows.rb +27 -0
- data/test/r4tw/tiddler.rb +70 -0
- data/test/r4tw/tiddlerfromurl.rb +23 -0
- data/test/r4tw/tiddlywiki.rb +66 -0
- data/test/r4tw/utils.rb +55 -0
- data/test/r4tw/withcontent/2.2.0.beta5.html +8739 -0
- data/test/r4tw/withcontent/22b5index.html +13523 -0
- data/test/r4tw/withcontent/empty2.html +7084 -0
- data/test/r4tw/withcontent/nothing.js +1 -0
- data/test/r4tw/write_all_tiddlers_to.rb +62 -0
- data/test/test_all.rb +8 -0
- data/test/test_helper.rb +36 -0
- data/test/test_tiddler_css.rb +55 -0
- data/test/test_tiddler_html.rb +54 -0
- data/test/test_tiddler_js.rb +56 -0
- data/test/test_tiddlywiki_cp.rb +341 -0
- data/website/files/DefaultTiddlers.tiddler +2 -0
- data/website/files/DefaultTiddlers.tiddler.div +1 -0
- data/website/files/Introduction.tiddler +12 -0
- data/website/files/Introduction.tiddler.div +1 -0
- data/website/files/MainMenu.tiddler +1 -0
- data/website/files/MainMenu.tiddler.div +1 -0
- data/website/files/SiteSubtitle.tiddler +1 -0
- data/website/files/SiteSubtitle.tiddler.div +1 -0
- data/website/files/SiteTitle.tiddler +1 -0
- data/website/files/SiteTitle.tiddler.div +1 -0
- data/website/files/Usage.tiddler +55 -0
- data/website/files/Usage.tiddler.div +1 -0
- data/website/files/WebDAVSavingPlugin.js +234 -0
- data/website/files/WebDAVSavingPlugin.js.div +1 -0
- data/website/index.html +9144 -0
- data/website/index.xml +336 -0
- metadata +116 -0
data/Manifest.txt
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
COPYING
|
2
|
+
History.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
bin/tiddlywiki_cp
|
7
|
+
lib/tiddlywiki_cp.rb
|
8
|
+
lib/tiddlywiki_cp/converters.rb
|
9
|
+
lib/tiddlywiki_cp/file2file.rb
|
10
|
+
lib/tiddlywiki_cp/file2tiddler.rb
|
11
|
+
lib/tiddlywiki_cp/r4tw.rb
|
12
|
+
lib/tiddlywiki_cp/tiddler2directory.rb
|
13
|
+
lib/tiddlywiki_cp/tiddler2file.rb
|
14
|
+
lib/tiddlywiki_cp/tiddler2tiddlywiki.rb
|
15
|
+
lib/tiddlywiki_cp/tiddler_css.rb
|
16
|
+
lib/tiddlywiki_cp/tiddler_html.rb
|
17
|
+
lib/tiddlywiki_cp/tiddler_js.rb
|
18
|
+
lib/tiddlywiki_cp/tiddlywiki2file.rb
|
19
|
+
lib/tiddlywiki_cp/version.rb
|
20
|
+
scripts/txt2html
|
21
|
+
setup.rb
|
22
|
+
test/content/a
|
23
|
+
test/content/a.div
|
24
|
+
test/content/b
|
25
|
+
test/content/e
|
26
|
+
test/content/e.div
|
27
|
+
test/content/html_entities.html
|
28
|
+
test/content/test_fetch.html
|
29
|
+
test/content/universe.html
|
30
|
+
test/r4tw/addtag.rb
|
31
|
+
test/r4tw/all.rb
|
32
|
+
test/r4tw/createfrom.rb
|
33
|
+
test/r4tw/empties/2.1.3.html
|
34
|
+
test/r4tw/empties/2.2.0.beta5.html
|
35
|
+
test/r4tw/fromremote.rb
|
36
|
+
test/r4tw/fromurl.rb
|
37
|
+
test/r4tw/shadows.rb
|
38
|
+
test/r4tw/tiddler.rb
|
39
|
+
test/r4tw/tiddlerfromurl.rb
|
40
|
+
test/r4tw/tiddlywiki.rb
|
41
|
+
test/r4tw/utils.rb
|
42
|
+
test/r4tw/withcontent/2.2.0.beta5.html
|
43
|
+
test/r4tw/withcontent/22b5index.html
|
44
|
+
test/r4tw/withcontent/empty2.html
|
45
|
+
test/r4tw/withcontent/nothing.js
|
46
|
+
test/r4tw/write_all_tiddlers_to.rb
|
47
|
+
test/test_all.rb
|
48
|
+
test/test_helper.rb
|
49
|
+
test/test_tiddler_css.rb
|
50
|
+
test/test_tiddler_html.rb
|
51
|
+
test/test_tiddler_js.rb
|
52
|
+
test/test_tiddlywiki_cp.rb
|
53
|
+
website/files/DefaultTiddlers.tiddler
|
54
|
+
website/files/DefaultTiddlers.tiddler.div
|
55
|
+
website/files/Introduction.tiddler
|
56
|
+
website/files/Introduction.tiddler.div
|
57
|
+
website/files/MainMenu.tiddler
|
58
|
+
website/files/MainMenu.tiddler.div
|
59
|
+
website/files/SiteSubtitle.tiddler
|
60
|
+
website/files/SiteSubtitle.tiddler.div
|
61
|
+
website/files/SiteTitle.tiddler
|
62
|
+
website/files/SiteTitle.tiddler.div
|
63
|
+
website/files/Usage.tiddler
|
64
|
+
website/files/Usage.tiddler.div
|
65
|
+
website/files/WebDAVSavingPlugin.js
|
66
|
+
website/files/WebDAVSavingPlugin.js.div
|
67
|
+
website/index.html
|
68
|
+
website/index.xml
|
data/README.txt
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/packagetask'
|
6
|
+
require 'rake/gempackagetask'
|
7
|
+
require 'rake/rdoctask'
|
8
|
+
require 'rake/contrib/rubyforgepublisher'
|
9
|
+
require 'fileutils'
|
10
|
+
require 'hoe'
|
11
|
+
|
12
|
+
include FileUtils
|
13
|
+
require File.join(File.dirname(__FILE__), 'lib', 'tiddlywiki_cp', 'version')
|
14
|
+
|
15
|
+
AUTHOR = 'Loic Dachary' # can also be an array of Authors
|
16
|
+
EMAIL = "loic@dachary.org"
|
17
|
+
DESCRIPTION = "copy tiddlers to files and vice versa"
|
18
|
+
GEM_NAME = 'tiddlywiki_cp' # what ppl will type to install your gem
|
19
|
+
|
20
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
21
|
+
@config = nil
|
22
|
+
def rubyforge_username
|
23
|
+
unless @config
|
24
|
+
begin
|
25
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
26
|
+
rescue
|
27
|
+
puts <<-EOS
|
28
|
+
ERROR: No rubyforge config file found: #{@config_file}"
|
29
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
30
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
31
|
+
EOS
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
end
|
35
|
+
@rubyforge_username ||= @config["username"]
|
36
|
+
end
|
37
|
+
|
38
|
+
RUBYFORGE_PROJECT = 'tiddlywikicp' # The unix name for your project
|
39
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
40
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
41
|
+
|
42
|
+
NAME = "tiddlywiki_cp"
|
43
|
+
REV = nil
|
44
|
+
# UNCOMMENT IF REQUIRED:
|
45
|
+
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
46
|
+
VERS = TiddlywikiCp::VERSION::STRING + (REV ? ".#{REV}" : "")
|
47
|
+
CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
|
48
|
+
RDOC_OPTS = ['--quiet', '--title', 'tiddlywiki_cp documentation',
|
49
|
+
"--opname", "index.html",
|
50
|
+
"--line-numbers",
|
51
|
+
"--main", "README",
|
52
|
+
"--inline-source"]
|
53
|
+
|
54
|
+
class Hoe
|
55
|
+
def extra_deps
|
56
|
+
@extra_deps.reject { |x| Array(x).first == 'hoe' }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Generate all the Rake tasks
|
61
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
62
|
+
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
63
|
+
p.author = AUTHOR
|
64
|
+
p.description = DESCRIPTION
|
65
|
+
p.email = EMAIL
|
66
|
+
p.summary = DESCRIPTION
|
67
|
+
p.url = HOMEPATH
|
68
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
69
|
+
p.test_globs = ["test/**/test_*.rb"]
|
70
|
+
p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
|
71
|
+
|
72
|
+
# == Optional
|
73
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
74
|
+
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
75
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
76
|
+
end
|
77
|
+
|
78
|
+
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
|
79
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
80
|
+
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
81
|
+
|
82
|
+
desc 'Generate website files'
|
83
|
+
task :website_generate do
|
84
|
+
Dir['website/**/*.txt'].each do |txt|
|
85
|
+
sh %{ ( echo '{{{' ; RUBYLIB=lib ruby bin/tiddlywiki_cp --help ; echo '}}}' ) > website/files/Usage }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
desc 'Upload website files to rubyforge'
|
90
|
+
task :website_upload do
|
91
|
+
host = "#{rubyforge_username}@rubyforge.org"
|
92
|
+
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
93
|
+
local_dir = 'website'
|
94
|
+
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
95
|
+
end
|
96
|
+
|
97
|
+
desc 'Generate and upload website files'
|
98
|
+
task :website => [:website_generate, :website_upload, :publish_docs]
|
99
|
+
|
100
|
+
desc 'Release the website and new gem version'
|
101
|
+
task :deploy => [:check_version, :website, :release] do
|
102
|
+
puts "Remember to create SVN tag:"
|
103
|
+
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
104
|
+
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
105
|
+
puts "Suggested comment:"
|
106
|
+
puts "Tagging release #{CHANGES}"
|
107
|
+
end
|
108
|
+
|
109
|
+
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
110
|
+
task :local_deploy => [:website_generate, :install_gem]
|
111
|
+
|
112
|
+
task :check_version do
|
113
|
+
unless ENV['VERSION']
|
114
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
115
|
+
exit
|
116
|
+
end
|
117
|
+
unless ENV['VERSION'] == VERS
|
118
|
+
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
119
|
+
exit
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
|
data/bin/tiddlywiki_cp
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2007 Loic Dachary <loic@dachary.org>
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
#
|
17
|
+
|
18
|
+
#
|
19
|
+
# generic functions
|
20
|
+
#
|
21
|
+
require 'tiddlywiki_cp/file2tiddler'
|
22
|
+
require 'tiddlywiki_cp/file2tiddler'
|
23
|
+
require 'tiddlywiki_cp/file2file'
|
24
|
+
require 'tiddlywiki_cp/tiddler2file'
|
25
|
+
require 'tiddlywiki_cp/tiddler2tiddlywiki'
|
26
|
+
require 'tiddlywiki_cp/tiddler2directory'
|
27
|
+
require 'tiddlywiki_cp/tiddlywiki2file'
|
28
|
+
|
29
|
+
#
|
30
|
+
# per tiddlers type functions
|
31
|
+
#
|
32
|
+
require 'tiddlywiki_cp/tiddler_css'
|
33
|
+
require 'tiddlywiki_cp/tiddler_html'
|
34
|
+
require 'tiddlywiki_cp/tiddler_js'
|
35
|
+
|
36
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2007 Loic Dachary <loic@dachary.org>
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
#
|
17
|
+
require 'fileutils'
|
18
|
+
|
19
|
+
module TiddlywikiCp
|
20
|
+
|
21
|
+
class TiddlyWikiCp
|
22
|
+
|
23
|
+
def file2file(from, to)
|
24
|
+
FileUtils.cp(from, to)
|
25
|
+
if File.exists?("#{from}.div")
|
26
|
+
FileUtils.cp("#{from}.div", "#{to}.div")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2007 Loic Dachary <loic@dachary.org>
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
#
|
17
|
+
module TiddlywikiCp
|
18
|
+
|
19
|
+
class TiddlyWikiCp
|
20
|
+
|
21
|
+
def file2tiddler(from, to)
|
22
|
+
content = read_uri(from)
|
23
|
+
div_from = "#{from}.div"
|
24
|
+
div = File.read(div_from).to_s
|
25
|
+
content = "<div #{div}>\n<pre>#{content}</pre>\n</div>"
|
26
|
+
|
27
|
+
tiddlywiki = uri2tiddlywiki(to)
|
28
|
+
tiddler = Tiddler.new.from_div(content, true)
|
29
|
+
if @options.times
|
30
|
+
tiddler.fields['modified'] = File.mtime(from).convertToYYYYMMDDHHMM
|
31
|
+
end
|
32
|
+
#
|
33
|
+
# add_tiddler implies remove tiddler
|
34
|
+
#
|
35
|
+
tiddlywiki.add_tiddler(tiddler)
|
36
|
+
end
|
37
|
+
|
38
|
+
alias file2tiddlywiki file2tiddler
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|