sdoc_all 1.0.0.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1 +1 @@
1
- [1, 0, 0, 1]
1
+ [1, 0, 1]
data/lib/sdoc_all/task.rb CHANGED
@@ -25,6 +25,18 @@ class SdocAll
25
25
  created_hash = config_hash_path.read rescue nil
26
26
  return true if created_hash != config_hash
27
27
  end
28
+
29
+ def run_if_clobber
30
+ if clobber?
31
+ Base.remove_if_present(Base.docs_path + doc_path)
32
+ yield
33
+ if (Base.docs_path + doc_path).directory?
34
+ config_hash_path.open('w') do |f|
35
+ f.write(config_hash)
36
+ end
37
+ end
38
+ end
39
+ end
28
40
  end
29
41
 
30
42
  class Task < BaseTask
@@ -44,9 +56,7 @@ class SdocAll
44
56
  end
45
57
 
46
58
  def run(options = {})
47
- if clobber?
48
- Base.remove_if_present(Base.docs_path + doc_path)
49
-
59
+ run_if_clobber do
50
60
  cmd = %w(sdoc)
51
61
  cmd << '-o' << Base.docs_path + doc_path
52
62
  cmd << '-t' << title
@@ -68,12 +78,6 @@ class SdocAll
68
78
  else
69
79
  Base.system(*cmd + [src_path])
70
80
  end
71
-
72
- if (Base.docs_path + doc_path).directory?
73
- config_hash_path.open('w') do |f|
74
- f.write(config_hash)
75
- end
76
- end
77
81
  end
78
82
  end
79
83
 
@@ -124,10 +128,8 @@ class SdocAll
124
128
  end
125
129
 
126
130
  def run(options = {})
127
- if clobber?
128
- Base.remove_if_present(Base.docs_path + doc_path)
129
-
130
- tasks.each do |task|
131
+ run_if_clobber do
132
+ tasks.each_with_progress(title) do |task|
131
133
  task.run(options)
132
134
  end
133
135
 
@@ -143,7 +145,7 @@ class SdocAll
143
145
  end
144
146
 
145
147
  def for_hash
146
- [doc_path.to_s, title, tasks.map(&:config_hash).join(' ')]
148
+ [doc_path.to_s, title, tasks.map(&:for_hash)]
147
149
  end
148
150
 
149
151
  def clobber?
data/sdoc_all.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{sdoc_all}
5
- s.version = "1.0.0.1"
5
+ s.version = "1.0.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["toy"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdoc_all
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.1
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - toy