caramelize 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,13 +10,14 @@ Gem::Specification.new do |s|
10
10
  s.authors = ["Daniel Senff"]
11
11
  s.email = ["mail@danielsenff.de"]
12
12
  s.homepage = "http://github.com/Dahie/caramelize"
13
- s.summary = %q{Abstract wiki convert to migrate your data from one wiki software to another}
14
- s.description = %q{By defining the access from the input to the output wiki you can migrate any wiki.}
13
+ s.summary = %q{Flexible and modular wiki conversion tool}
14
+ s.description = %q{By defining the connectors from the input wiki you can migrate any wiki to git-based Gollum wiki repositories.}
15
15
 
16
16
  s.bindir = 'bin'
17
17
 
18
18
  s.add_dependency('mysql2')
19
19
  s.add_dependency('cmdparse')
20
+ s.add_dependency('ruby-progressbar')
20
21
  s.add_dependency('gollum', '>= 1.3.0') # grit dependency implicit through gollum
21
22
 
22
23
  s.rubyforge_project = "caramelize"
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'gollum'
4
4
  require 'grit'
5
+ require 'ruby-progressbar'
5
6
 
6
7
  module Caramelize
7
8
  autoload :Wiki, 'caramelize/wiki/wiki'
@@ -19,30 +20,41 @@ module Caramelize
19
20
 
20
21
  options[:markup] = :markdown if !options[:markup]
21
22
  options[:default_author] = "Caramelize" if !options[:default_author]
22
-
23
+
23
24
  # read page revisions from wiki
24
25
  # store page revisions
25
-
26
26
  original_wiki.read_authors
27
27
  @revisions = original_wiki.read_pages
28
-
29
28
  # initiate new wiki
30
29
  output_wiki = GollumOutput.new('wiki.git') # TODO make wiki_path an option
31
30
 
31
+ # setup progressbar
32
+ progress_revisions = ProgressBar.create(:title => "Revisions", :total => @revisions.count, :format => '%a %B %p%% %t')
33
+
32
34
  # TODO ask if we should replace existing paths
33
35
 
34
36
  # commit page revisions to new wiki
35
- output_wiki.commit_history @revisions, options
36
-
37
+ output_wiki.commit_history(@revisions, options) do |page, index|
38
+ if options[:verbosity] == :verbose
39
+ puts "(#{index+1}/#{@revisions.count}) #{page.time} #{page.title}"
40
+ else
41
+ progress_revisions.increment
42
+ end
43
+ end
44
+
37
45
  # if wiki needs to convert syntax, do so
38
46
  puts "From markup: " + original_wiki.markup.to_s if options[:verbosity] == :verbose
39
47
  puts "To markup: " + options[:markup].to_s if options[:verbosity] == :verbose
40
48
  if original_wiki.convert_markup? options[:markup] # is wiki in target markup
41
49
 
50
+ #setup progress for markup conversion
51
+ progress_markup = ProgressBar.create(:title => "Markup", :total => original_wiki.latest_revisions.count, :format => '%a %B %p%% %t')
52
+
42
53
  puts "Latest revisions:" if options[:verbosity] == :verbose
43
54
  # take each latest revision
44
55
  for rev in original_wiki.latest_revisions
45
56
  puts "Updated syntax: #{rev.title} #{rev.time}" if options[:verbosity] == :verbose
57
+ progress_markup.increment
46
58
 
47
59
  # parse markup & convert to new syntax
48
60
  if options[:markup] == :markdown
@@ -60,7 +72,7 @@ module Caramelize
60
72
  # commit as latest page revision
61
73
  output_wiki.commit_revision rev, options[:markup]
62
74
  end
63
- end
75
+ end
64
76
  end
65
77
  end # end execute
66
78
  end
@@ -43,13 +43,11 @@ module Caramelize
43
43
  end
44
44
 
45
45
  # Commit all revisions of the given history into this gollum-wiki-repository.
46
- def commit_history(revisions, options={})
46
+ def commit_history(revisions, options={}, &block)
47
47
  options[:markup] = :markdown if options[:markup].nil? # target markup
48
48
  revisions.each_with_index do |page, index|
49
- if options[:verbosity] == :normal || options[:verbosity] == :verbose
50
- puts "(#{index+1}/#{revisions.count}) #{page.time} #{page.title}"
51
- end
52
-
49
+ # call debug output from outside
50
+ block.call(page, index) if block_given?
53
51
  commit_revision(page, options[:markup])
54
52
  end
55
53
  end
@@ -1,3 +1,3 @@
1
1
  module Caramelize
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.1
4
+ version: 0.1.2
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-03 00:00:00.000000000 Z
12
+ date: 2013-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mysql2
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: ruby-progressbar
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: gollum
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -59,8 +75,8 @@ dependencies:
59
75
  - - ! '>='
60
76
  - !ruby/object:Gem::Version
61
77
  version: 1.3.0
62
- description: By defining the access from the input to the output wiki you can migrate
63
- any wiki.
78
+ description: By defining the connectors from the input wiki you can migrate any wiki
79
+ to git-based Gollum wiki repositories.
64
80
  email:
65
81
  - mail@danielsenff.de
66
82
  executables:
@@ -118,7 +134,7 @@ rubyforge_project: caramelize
118
134
  rubygems_version: 1.8.21
119
135
  signing_key:
120
136
  specification_version: 3
121
- summary: Abstract wiki convert to migrate your data from one wiki software to another
137
+ summary: Flexible and modular wiki conversion tool
122
138
  test_files:
123
139
  - test/helper.rb
124
140
  - test/test_caramelize.rb