double_doc 1.3.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require 'pathname'
2
2
  require 'double_doc/doc_extractor'
3
+ require 'bundler'
3
4
 
4
5
  module DoubleDoc
5
6
  class ImportHandler
@@ -10,13 +11,12 @@ module DoubleDoc
10
11
  @load_paths = [@root]
11
12
 
12
13
  if options[:gemfile]
13
- gemfile = @root + "Gemfile"
14
-
15
- unless gemfile.exist?
16
- raise LoadError, "missing Gemfile inside #{@root}"
14
+ begin
15
+ @load_paths.concat(load_paths_from_gemfile(Bundler.root))
16
+ rescue => e
17
+ puts "Could not load paths from Gemfile; please make sure you've run bundle install with the correct gemset."
18
+ raise e
17
19
  end
18
-
19
- @load_paths.concat(load_paths_from_gemfile(gemfile))
20
20
  end
21
21
 
22
22
  @docs = {}
@@ -37,11 +37,17 @@ module DoubleDoc
37
37
 
38
38
  protected
39
39
 
40
- def load_paths_from_gemfile(gemfile)
40
+ def load_paths_from_gemfile(root)
41
+ gemfile = root + "Gemfile"
42
+
43
+ unless gemfile.exist?
44
+ raise LoadError, "missing Gemfile inside #{root}"
45
+ end
46
+
41
47
  with_gemfile(gemfile) do
42
48
  puts "Loading paths from #{gemfile}"
43
49
 
44
- defn = Bundler::Definition.build(gemfile, @root + "Gemfile.lock", nil)
50
+ defn = Bundler::Definition.build(gemfile, root + "Gemfile.lock", nil)
45
51
  defn.validate_ruby!
46
52
  defn.resolve_with_cache!
47
53
 
@@ -1,4 +1,4 @@
1
- ## ## DoubleDoc 1.3
1
+ ## ## DoubleDoc 2.0
2
2
  module DoubleDoc
3
- VERSION = "1.3.0"
3
+ VERSION = "2.0.0"
4
4
  end
@@ -13,16 +13,6 @@ describe "import handler" do
13
13
  let(:root) { Bundler.root }
14
14
  let(:options) {{ :gemfile => true }}
15
15
 
16
- describe "when root has no tmpfile" do
17
- let(:root) { Bundler.root + "lib" }
18
-
19
- describe "initialization" do
20
- it "should raise" do
21
- lambda { subject }.must_raise LoadError
22
- end
23
- end
24
- end
25
-
26
16
  describe "rubygems" do
27
17
  describe "load_paths" do
28
18
  it "should add Gemfile load paths" do
@@ -44,17 +34,13 @@ describe "import handler" do
44
34
  end
45
35
  end
46
36
 
47
- describe "path, git" do
48
- let(:root) { File.join(File.expand_path(File.dirname(__FILE__)), "fixtures") }
49
-
50
- describe "find_file" do
51
- it "should resolve files from path" do
52
- subject.send(:find_file, "double_doc.rb").must_be_instance_of File
53
- end
37
+ describe "find_file" do
38
+ it "should resolve files from path" do
39
+ subject.send(:find_file, "double_doc.rb").must_be_instance_of File
40
+ end
54
41
 
55
- it "should resolve file from git" do
56
- subject.send(:find_file, "mime-types.rb").must_be_instance_of File
57
- end
42
+ it "should resolve file from git" do
43
+ subject.send(:find_file, "mime-types.rb").must_be_instance_of File
58
44
  end
59
45
  end
60
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: double_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.0
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-05-09 00:00:00.000000000 Z
12
+ date: 2013-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
@@ -128,14 +128,6 @@ files:
128
128
  - templates/screen.css
129
129
  - readme.md
130
130
  - test/doc_extractor_test.rb
131
- - test/fixtures/Gemfile
132
- - test/fixtures/Gemfile.lock
133
- - test/fixtures/vendor/cache/erubis-2.7.0.gem
134
- - test/fixtures/vendor/cache/posix-spawn-0.3.6.gem
135
- - test/fixtures/vendor/cache/pygments.rb-0.5.0.gem
136
- - test/fixtures/vendor/cache/rake-10.0.4.gem
137
- - test/fixtures/vendor/cache/redcarpet-2.2.2.gem
138
- - test/fixtures/vendor/cache/yajl-ruby-1.1.0.gem
139
131
  - test/html_generator_test.rb
140
132
  - test/import_handler_test.rb
141
133
  - test/test_helper.rb
@@ -153,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
145
  version: '0'
154
146
  segments:
155
147
  - 0
156
- hash: -1537526380922081734
148
+ hash: -1964755725115919551
157
149
  required_rubygems_version: !ruby/object:Gem::Requirement
158
150
  none: false
159
151
  requirements:
@@ -162,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
154
  version: '0'
163
155
  segments:
164
156
  - 0
165
- hash: -1537526380922081734
157
+ hash: -1964755725115919551
166
158
  requirements: []
167
159
  rubyforge_project:
168
160
  rubygems_version: 1.8.25
@@ -171,14 +163,6 @@ specification_version: 3
171
163
  summary: Documentation right where you want it
172
164
  test_files:
173
165
  - test/doc_extractor_test.rb
174
- - test/fixtures/Gemfile
175
- - test/fixtures/Gemfile.lock
176
- - test/fixtures/vendor/cache/erubis-2.7.0.gem
177
- - test/fixtures/vendor/cache/posix-spawn-0.3.6.gem
178
- - test/fixtures/vendor/cache/pygments.rb-0.5.0.gem
179
- - test/fixtures/vendor/cache/rake-10.0.4.gem
180
- - test/fixtures/vendor/cache/redcarpet-2.2.2.gem
181
- - test/fixtures/vendor/cache/yajl-ruby-1.1.0.gem
182
166
  - test/html_generator_test.rb
183
167
  - test/import_handler_test.rb
184
168
  - test/test_helper.rb
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "double_doc", :path => File.join(File.expand_path(File.dirname(__FILE__)), "..", "..")
4
- gem "mime-types", :git => "https://github.com/halostatue/mime-types.git", :ref => "v1.22"
@@ -1,34 +0,0 @@
1
- GIT
2
- remote: https://github.com/halostatue/mime-types.git
3
- revision: b8d2208cc34e9b9ca6456182742dcb3bfc47daf6
4
- ref: v1.22
5
- specs:
6
- mime-types (1.20.1)
7
-
8
- PATH
9
- remote: /Users/staugaard/code/double_doc
10
- specs:
11
- double_doc (1.3.0)
12
- erubis
13
- pygments.rb (~> 0.2)
14
- rake
15
- redcarpet (~> 2.1)
16
-
17
- GEM
18
- remote: https://rubygems.org/
19
- specs:
20
- erubis (2.7.0)
21
- posix-spawn (0.3.6)
22
- pygments.rb (0.5.0)
23
- posix-spawn (~> 0.3.6)
24
- yajl-ruby (~> 1.1.0)
25
- rake (10.0.4)
26
- redcarpet (2.2.2)
27
- yajl-ruby (1.1.0)
28
-
29
- PLATFORMS
30
- ruby
31
-
32
- DEPENDENCIES
33
- double_doc!
34
- mime-types!