corundum 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -80,19 +80,40 @@ module Corundum
80
80
  task :dependencies_available do
81
81
  require 'corundum/qa-report'
82
82
  checker = Gem::SpecFetcher.new
83
- report = QA::Report.new("Gem dependencies")
83
+ report = QA::Report.new("Gem dependencies[#{File::basename(gemspec.loaded_from)}]")
84
84
  qa_rejections << report
85
85
  gemspec.runtime_dependencies.each do |dep|
86
86
  fulfilling = checker.find_matching(dep,true,false,false)
87
87
  if fulfilling.empty?
88
- report.add("missing", File::basename(gemspec.loaded_from), nil, dep)
88
+ report.add("status", dep, nil, "missing")
89
89
  report.fail "Dependency unfulfilled remotely"
90
90
  else
91
- report.add("fulfilled", File::basename(gemspec.loaded_from), nil, dep)
91
+ report.add("status", dep, nil, "fulfilled")
92
92
  end
93
93
  end
94
94
  end
95
95
 
96
+ task :pinned_dependencies do
97
+ return unless File::exists?("Gemfile.lock")
98
+ require 'corundum/qa-report'
99
+ require 'bundler/lockfile_parser'
100
+ parser = File::open("Gemfile.lock") do |lockfile|
101
+ Bundler::LockfileParser.new(lockfile.read)
102
+ end
103
+ report = QA::Report.new("Bundler pinned dependencies")
104
+ qa_rejections << report
105
+ runtime_deps = gemspec.runtime_dependencies.map(&:name)
106
+ pinned_dependencies = parser.dependencies.each do |dep|
107
+ next unless runtime_deps.include? dep.name
108
+ next if dep.source.nil?
109
+ next if dep.source.respond_to?(:path) and dep.source.path.to_s == "."
110
+ report.add("source", dep, nil, dep.source)
111
+ report.fail("Pinned runtime dependencies:\n" +
112
+ " Specs depended on by the gemspec are pinned and " +
113
+ "as a result, spec results are suspect\n")
114
+ end
115
+ end
116
+
96
117
  task :is_unpushed do
97
118
  checker = Gem::SpecFetcher.new
98
119
  dep = Gem::Dependency.new(gemspec.name, "= #{gemspec.version}")
@@ -114,6 +135,7 @@ module Corundum
114
135
  task :release => in_namespace(:push)
115
136
  task :preflight => in_namespace(:is_unpushed)
116
137
  task :qa => in_namespace(:dependencies_available)
138
+ task :qa => in_namespace(:pinned_dependencies)
117
139
  end
118
140
  end
119
141
  end
@@ -62,7 +62,7 @@ module Corundum
62
62
  end
63
63
 
64
64
  def out_of_date?(stamp)
65
- @prerequisites.any? { |n| application[n, @scope].timestamp > stamp}
65
+ prerequisites.any? { |n| application[n, @scope].timestamp > stamp}
66
66
  end
67
67
 
68
68
  def needed?
@@ -13,24 +13,25 @@ module Corundum
13
13
  :warning => false,
14
14
  :verbose => true,
15
15
  :ruby_opts => [],
16
- :rspec_path => 'rspec',
16
+ :rspec_program => 'rspec',
17
17
  :rspec_opts => [],
18
18
  :failure_message => "Spec examples failed.",
19
19
  :files_to_run => "spec"
20
20
  )
21
21
 
22
+ setting :rspec_path
23
+
22
24
  required_fields :gemspec_path, :qa_finished_path, :file_lists, :file_dependencies
23
25
 
24
26
  def default_configuration(toolkit)
25
27
  super
26
28
  self.qa_finished_path = toolkit.finished_files.qa
27
29
  self.qa_rejections = toolkit.qa_rejections
30
+ self.file_dependencies = file_lists.code + file_lists.test + file_lists.project
28
31
  end
29
32
 
30
33
  def resolve_configuration
31
- #XXX Que?
32
- self.rspec_path = %x"which #{rspec_path}".chomp
33
- self.file_dependencies = file_lists.code + file_lists.test + file_lists.project
34
+ self.rspec_path ||= %x"which #{rspec_program}".chomp
34
35
  super
35
36
  end
36
37
 
@@ -53,7 +54,7 @@ module Corundum
53
54
  test_task(:all)
54
55
 
55
56
  desc "Generate specifications documentation"
56
- doc_task(:doc) do |t|
57
+ docn = doc_task(:doc => file_dependencies) do |t|
57
58
  t.rspec_opts = %w{-o /dev/null --failure-exit-code 0 -f h -o} + [t.doc_path]
58
59
  end
59
60
  file entry_path => :doc
@@ -64,7 +65,7 @@ module Corundum
64
65
 
65
66
  doc = Nokogiri::parse(File::read(entry_path))
66
67
 
67
- rejections = QA::Report.new("RSpec")
68
+ rejections = QA::Report.new("RSpec[#{entry_path}]")
68
69
  qa_rejections << rejections
69
70
 
70
71
  def class_xpath(name)
@@ -73,7 +74,8 @@ module Corundum
73
74
 
74
75
  fails_path = "//*[" + %w{example failed}.map{|kind| class_xpath(kind)}.join(" and ") + "]"
75
76
  doc.xpath(fails_path).each do |node|
76
- backtrace_line = node.xpath(".//*[#{class_xpath("backtrace")}]").first.content.split("\n").last
77
+ backtrace_line =
78
+ node.xpath(".//*[#{class_xpath("backtrace")}]").first.content.split("\n").first
77
79
  file,line,_ = backtrace_line.split(":")
78
80
  label = "fail"
79
81
  value = node.xpath(".//*[#{class_xpath("message")}]").first.content.gsub(/\s+/m, " ")
@@ -79,7 +79,7 @@ module Corundum
79
79
  end
80
80
 
81
81
  @test_lib.doc_task(:report => [:config_exists] + all_files) do |t|
82
- t.rspec_opts = %w{-r simplecov} + test_options + t.rspec_opts
82
+ t.rspec_opts = %w{-r simplecov -f progress} + test_options + t.rspec_opts
83
83
  end
84
84
  file entry_path => :report
85
85
 
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: corundum
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Judson Lester
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-09 00:00:00.000000000 Z
12
+ date: 2013-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  prerelease: false
@@ -415,7 +415,7 @@ licenses:
415
415
  post_install_message:
416
416
  rdoc_options:
417
417
  - --title
418
- - corundum-0.1.0 RDoc
418
+ - corundum-0.1.2 RDoc
419
419
  require_paths:
420
420
  - lib/
421
421
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -424,7 +424,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
424
424
  - !ruby/object:Gem::Version
425
425
  segments:
426
426
  - 0
427
- hash: -367106271
427
+ hash: 2033551
428
428
  version: '0'
429
429
  none: false
430
430
  required_rubygems_version: !ruby/object:Gem::Requirement