caramelize 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,41 +1,26 @@
1
1
  # caramelize
2
2
 
3
- Caramelize is a compact and flexible wiki converter. It is intended for easily creating export of otherwise rare supported legacy wikis. With caramelize you can create your own export configurations and transfer your data into a git-based gollum-wiki retaing all your history.
3
+ Caramelize is a compact and flexible wiki content migration tool. It is intended for easily transfering content from otherwise rare supported legacy wikis. With caramelize you can create your own export configurations and migrate your data into a git-based [gollum](gollum)-wiki retaining all your history and gaining the most flexible access to your wiki content.
4
4
 
5
- In the future more target wiki system may be added. For the moment export is supported for WikkaWiki and Redmine-Wiki.
5
+ In the future more target wikis may be added. For the moment migration is supported for [WikkaWiki](wikka) and [Redmine](redmine)-Wiki.
6
6
 
7
7
  ## Usage
8
8
 
9
- ### Building
10
-
11
- To try it you require bundler to build it.
12
-
13
- $ gem bundler install
14
-
15
- Clone this repository and start building.
9
+ ### Installation
16
10
 
17
- $ git clone git@github.com:Dahie/caramelize.git
18
- $ gem build caramelize.gemspec
11
+ $ gem install caramelize
19
12
 
20
- Now to build the gem do
21
-
22
- $ rake build
23
-
24
- or
25
-
26
- $ rake install
27
-
28
- to install the new gem right to the system.
13
+ Install the latest release of caramelize using RubyGems.
29
14
 
30
15
  ### Use
31
16
 
32
17
  $ caramelize create
33
18
 
34
- Creates a template configuration file "caramel.rb". This includes documentation on how to use the preset Wiki-connectors and how to write addition customized connectors.
19
+ Creates a template configuration file "caramel.rb". This includes documentation on how to use the preset Wiki-connectors and how to write addition customized connectors. More about this below.
35
20
 
36
21
  $ caramelize run
37
22
 
38
- Will execute a wiki migration based on a found configuration file. These are found in predefined paths.
23
+ Will start the wiki migration based on the configuration file. These are either found in predefined paths (./caramel.rb, ./config.rb, …), or passed as argument, as below.
39
24
 
40
25
  $ caramelize help
41
26
 
@@ -47,14 +32,112 @@ Returns version and release information.
47
32
 
48
33
  ### Options
49
34
 
50
- $ caramelize create --config my_caramel_configuration.rb
35
+ $ caramelize create --config my_caramel_configuration.rb
51
36
 
52
- Creates an example config with the given name.
37
+ Creates an example configuration by the given name.
53
38
 
54
- $ caramelize run --config my_caramel_configuration.rb
39
+ $ caramelize run --config my_caramel_configuration.rb
55
40
 
56
41
  Executes the given configuration.
57
42
 
43
+ $ caramelize --verbose [command]
44
+ $ caramelize -v [command]
45
+
46
+ Displays more verbose output to the command line.
47
+
48
+ ## Content migration
49
+
50
+ ### Wiki support
51
+
52
+ Caramelize comes with direct support for [WikkaWiki](wikka) and [Redmine](redmine)-Wiki.
53
+ More custom wikis can be supported by creating a suitable configuration file.
54
+
55
+ Any imported wiki exports into a [gollum](gollum) git-repository. This is a wiki based around a git-repository. This gives you the flexibility of having all wiki pages exported as physical files, while keeping the history and having an easy and wide-supported way of access by using the wiki server gollum features.
56
+
57
+ Since wiki software may have special features, that are not common among other wikis, content migration may always have a loss of style or information. Caramelize tries to support the most common features.
58
+
59
+ * Page meta data
60
+ * title
61
+ * content body
62
+ * author name
63
+ * author email address
64
+ * date
65
+ * revisions
66
+ * Markup conversion to markdown
67
+ * limited to "simple" formatting, excluding complex formats such as tables
68
+ * conversion using regular expressions -> somewhat easy to learn and extend
69
+
70
+ ### Configuration recipes
71
+
72
+ The `caramel.rb` configuration contains the settings on how to import the data of the existing wiki and how to convert it into the format required by caramelize to export to gollum.
73
+ You also find the predefined definitions for importing from WikkaWiki and Redmine and and example for a custom import.
74
+
75
+ Custom import allows you to import data from wikis that are not natively supported by caramelize. Defining your own wiki import requires a bit of knowledge on Ruby and MySQL as you setup the access to your wiki database and need to define how the data is to be transformed. Depending on the database model of the wiki this can be one simple call for all revisions in the database, or it can get more complicated with multiple mysql-calls as the database becomes more complex.
76
+
77
+ For a custom wiki you need to create a `wiki` instance object, that receives the necessary database creditials.
78
+
79
+ wiki = Caramelize::Wiki.new({:host => "localhost",
80
+ :username => "user",
81
+ :database => "database_name",
82
+ :password => 'monkey',
83
+ :markup => :wikka})
84
+
85
+ This example ignores custom markup conversion and assumes WikkaWiki-markup.
86
+
87
+ Once the object is established we need to hook in a method that defines how revisions are read from the database and how they are processed.
88
+
89
+ wiki.instance_eval do
90
+ def read_pages
91
+ sql = "SELECT id, tag, body, time, latest, user, note FROM wikka_pages ORDER BY time;"
92
+ @revisions, @titles = [], []
93
+ results = database.query(sql)
94
+ results.each do |row|
95
+ @titles << row["tag"]
96
+ author = @authors[row["user"]]
97
+ page = Page.new({:id => row["id"],
98
+ :title => row["tag"],
99
+ :body => row["body"],
100
+ :markup => 'wikka',
101
+ :latest => row["latest"] == "Y",
102
+ :time => row["time"],
103
+ :message => row["note"],
104
+ :author => author,
105
+ :author_name => row["user"]})
106
+ @revisions << page
107
+ end
108
+ # titles is the list of all unique page titles contained in the wiki
109
+ @titles.uniq!
110
+ # revisions is the list of all revisions ordered by date
111
+ @revisions
112
+ end
113
+
114
+ In the end the `wiki` instance needs the `@titles` and `@revisions` filled.
115
+
116
+ Some wikis don't have all necessary metadata saved in the revision. In this case additional database queries are necessary. **The configuration recipe is pure ruby code, that is included on execution. This gives you alot of freedom in writing your configuration, but also a lot of power to break things for yourself. Be advised.**
117
+
118
+ I'm happy to give support on your recipes and I'd also like to extend caramelize with more wiki modules, if you send in your configurations (minus database credentials of course).
119
+
120
+ ### Building
121
+
122
+ This is how you can build caramelize, in case you'd like to develop it further. To get startered you'll need Bundler.
123
+
124
+ $ gem install bundler
125
+
126
+ Clone or fork this repository and start building.
127
+
128
+ $ git clone git@github.com:Dahie/caramelize.git
129
+ $ gem build caramelize.gemspec
130
+
131
+ Now to build and package the gem do
132
+
133
+ $ rake build
134
+
135
+ or
136
+
137
+ $ rake install
138
+
139
+ to install the new gem right to your system.
140
+
58
141
  ## Contributing to caramelize
59
142
 
60
143
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
@@ -62,10 +145,13 @@ Executes the given configuration.
62
145
  * Fork the project
63
146
  * Start a feature/bugfix branch
64
147
  * Commit and push until you are happy with your contribution
65
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
66
148
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
67
149
 
150
+
68
151
  ## Copyright
69
152
 
70
- Copyright (c) 2011 Daniel Senff. See LICENSE.md for further details.
153
+ Copyright (c) 2011-2013 Daniel Senff. See LICENSE.md for further details.
71
154
 
155
+ [wikka]: http://wikkawiki.org/
156
+ [gollum]: https://github.com/github/gollum
157
+ [redmine]: http://www.redmine.org/
@@ -50,11 +50,6 @@ module Caramelize
50
50
  else
51
51
  body_new = original_wiki.to_textile rev.body
52
52
  end
53
-
54
- if body_new.start_with?('Einige interessante')
55
- puts rev.body
56
- puts body_new
57
- end
58
53
 
59
54
  unless body_new.eql? rev.body
60
55
  rev.body = body_new
@@ -1,3 +1,3 @@
1
1
  module Caramelize
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -13,10 +13,16 @@ module Caramelize
13
13
  body.gsub!(/(\/\/)(.*?)(\/\/)/) {|s| '_' + $2 + '_' } #italic
14
14
  #str.gsub!(/(===)(.*?)(===)/) {|s| '`' + $2 + '`'} #code
15
15
  body.gsub!(/(__)(.*?)(__)/) {|s| '<u>' + $2 + '</u>'} #underline
16
+ body.gsub!(/(---)/, ' ') #forced linebreak
16
17
 
17
- body.gsub!(/(.*?)(\n\t-)(.*?)/) {|s| $1 + '\n' + $3 } #list
18
+ #body.gsub!(/(.*?)(\n\t-)(.*?)/) {|s| $1 + $3 } #list
18
19
 
19
- body.gsub!(/(\t-)(.*?)/) {|s| '*' + $2 } #list
20
+ body.gsub!(/(\t-)(.*)/, '*\2') # unordered list
21
+ body.gsub!(/(~-)(.*)/, '*\2') # unordered list
22
+ # TODO ordered lists
23
+
24
+ # TODO images: ({{image)(url\=?)?(.*)(}})
25
+
20
26
  #str.gsub!(/(----)/) {|s| '~~~~'} #seperator
21
27
 
22
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caramelize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-02 00:00:00.000000000 Z
12
+ date: 2013-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mysql2