sdoc_all 0.2.0.6 → 0.2.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'echoe'
7
7
 
8
8
  version = YAML.load_file(File.join(File.dirname(__FILE__), 'VERSION.yml')).join('.') rescue nil
9
9
 
10
- Echoe.new('sdoc_all', version) do |p|
10
+ echoe = Echoe.new('sdoc_all', version) do |p|
11
11
  p.author = "toy"
12
12
  p.summary = "documentation for everything"
13
13
  p.description = "Command line tool to get documentation for ruby, rails, gems and plugins in one place"
@@ -19,3 +19,28 @@ Echoe.new('sdoc_all', version) do |p|
19
19
  # TODO: sdoc or voloko-sdoc
20
20
  p.project = 'toytoy'
21
21
  end
22
+
23
+ desc "Replace system gem with symlink to this folder"
24
+ task 'ghost' do
25
+ path = Gem.searcher.find(echoe.name).full_gem_path
26
+ system 'sudo', 'rm', '-r', path
27
+ symlink File.expand_path('.'), path
28
+ end
29
+
30
+ begin
31
+ require 'spec/rake/spectask'
32
+
33
+ task :default => :spec
34
+ task :test
35
+
36
+ desc "Run the specs"
37
+ Spec::Rake::SpecTask.new do |t|
38
+ t.spec_opts = ['--options', "spec/spec.opts"]
39
+ t.spec_files = FileList['spec/**/*_spec.rb']
40
+ end
41
+ rescue LoadError
42
+ puts <<-EOS
43
+ To use rspec for testing you must install rspec gem:
44
+ gem install rspec
45
+ EOS
46
+ end
data/VERSION.yml CHANGED
@@ -1 +1 @@
1
- [0, 2, 0, 6]
1
+ [0, 2, 0, 7]
data/lib/sdoc_all/base.rb CHANGED
@@ -59,11 +59,12 @@ class SdocAll
59
59
  end
60
60
  end
61
61
 
62
+ def used_sources
63
+ @used_sources ||= []
64
+ end
65
+
62
66
  def inherited(subclass)
63
- name = subclass.short_name
64
- [name, name.singularize, name.pluralize].uniq.each do |name_form|
65
- subclasses[name_form] = subclass
66
- end
67
+ subclasses[subclass.short_name] = subclass
67
68
  end
68
69
 
69
70
  def entries
@@ -77,8 +78,9 @@ class SdocAll
77
78
  def to_document(type, config)
78
79
  type = type.to_s
79
80
  config.symbolize_keys! if config.is_a?(Hash)
80
- if subclasses[type]
81
- entries << subclasses[type].new(config)
81
+ subclass = subclasses[type] || subclasses[type.singularize] || subclasses[type.pluralize]
82
+ if subclass
83
+ entries << subclass.new(config)
82
84
  else
83
85
  raise ConfigError.new("don't know how to build \"#{type}\" => #{config.inspect}")
84
86
  end
@@ -89,6 +91,18 @@ class SdocAll
89
91
  entries.each do |entry|
90
92
  entry.add_tasks(options)
91
93
  end
94
+ subclasses.values.each do |subclass|
95
+ unless subclass.used_sources.empty?
96
+ paths = Rake::FileList.new
97
+ paths.include(subclass.sources_path + '*')
98
+ subclass.used_sources.each do |path|
99
+ paths.exclude(path)
100
+ end
101
+ paths.resolve.each do |path|
102
+ remove_if_present(path)
103
+ end
104
+ end
105
+ end
92
106
  @@tasks
93
107
  end
94
108
 
@@ -26,12 +26,13 @@ class SdocAll
26
26
  path = sources_path + version
27
27
 
28
28
  unless path.directory?
29
- Base.remove_if_present(sources_path)
29
+ Base.remove_if_present(path)
30
30
  sources_path
31
31
  Base.with_env 'VERSION', version do
32
32
  Base.system('rails', path, '--freeze')
33
33
  end
34
34
  end
35
+ self.class.used_sources << path
35
36
 
36
37
  paths = Rake::FileList.new
37
38
  Dir.chdir(path) do
data/lib/sdoc_all/ruby.rb CHANGED
@@ -26,7 +26,7 @@ class SdocAll
26
26
  path = sources_path + version
27
27
 
28
28
  unless path.directory?
29
- Base.remove_if_present(sources_path)
29
+ Base.remove_if_present(path)
30
30
  case archive.extension
31
31
  when 'tar.bz2'
32
32
  Base.system('tar', '-xjf', archive.path, '-C', sources_path)
@@ -37,6 +37,7 @@ class SdocAll
37
37
  end
38
38
  File.rename(sources_path + "ruby-#{version}", path)
39
39
  end
40
+ self.class.used_sources << path
40
41
 
41
42
  Base.add_task(
42
43
  :src_path => path,
data/sdoc_all.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{sdoc_all}
5
- s.version = "0.2.0.6"
5
+ s.version = "0.2.0.7"
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"]
9
- s.date = %q{2009-05-02}
9
+ s.date = %q{2009-05-11}
10
10
  s.default_executable = %q{sdoc-all}
11
11
  s.description = %q{Command line tool to get documentation for ruby, rails, gems and plugins in one place}
12
12
  s.email = %q{ivan@workisfun.ru}
@@ -41,7 +41,7 @@ class SdocAll
41
41
 
42
42
  it "should create rails app" do
43
43
  FileTest.should_receive(:directory?).with("sources/rails/1.3.5").and_return(false)
44
- Base.should_receive(:remove_if_present).with(Pathname.new("sources/rails"))
44
+ Base.should_receive(:remove_if_present).with(Pathname.new("sources/rails/1.3.5"))
45
45
  Base.should_receive(:system).with("rails", Pathname.new("sources/rails/1.3.5"), "--freeze")
46
46
  Rails.new('1.3.5').add_tasks
47
47
  end
@@ -177,7 +177,7 @@ class SdocAll
177
177
 
178
178
  it "should extract archive if matching directory does not exist" do
179
179
  @path.stub!(:directory?).and_return(false)
180
- Base.should_receive(:remove_if_present).with(@sources_path)
180
+ Base.should_receive(:remove_if_present).with(@path)
181
181
  Base.should_receive(:system).with("tar", "-xjf", "sources/ruby-1.2.3-p666.tar.bz2", "-C", @sources_path)
182
182
  @path2 = mock(:path2)
183
183
  @sources_path.should_receive(:+).with('ruby-1.2.3-p666').and_return(@path2)
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: 0.2.0.6
4
+ version: 0.2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - toy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-02 00:00:00 +04:00
12
+ date: 2009-05-11 00:00:00 +04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency