veracode 1.0.0.alpha → 1.0.0.alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/veracode +8 -1
- data/lib/veracode.rb +82 -2
- data/lib/veracode/version.rb +1 -1
- metadata +4 -4
data/bin/veracode
CHANGED
@@ -13,6 +13,7 @@ APP_NAME = File.basename(Dir.pwd)
|
|
13
13
|
COMMAND = "#{$0} #{ARGV.join(' ')}"
|
14
14
|
|
15
15
|
require 'veracode'
|
16
|
+
require 'veracode/version'
|
16
17
|
|
17
18
|
$options = {
|
18
19
|
:phase1 => false,
|
@@ -58,12 +59,18 @@ case subcommand
|
|
58
59
|
|
59
60
|
Veracode.prepare
|
60
61
|
|
62
|
+
when "version", "--version", "-v"
|
63
|
+
puts File.basename($0, '.*') + " " + Veracode::VERSION
|
64
|
+
|
61
65
|
when "help", nil
|
62
66
|
ARGV.clear
|
63
67
|
ARGV.unshift "--help"
|
64
68
|
|
65
69
|
OptionParser.new do |opts|
|
66
|
-
opts.banner = "
|
70
|
+
opts.banner = "#{opts.program_name} #{Veracode::VERSION}\n" +
|
71
|
+
"Usage: #{opts.program_name} prepare [options]\n" +
|
72
|
+
" #{opts.program_name} version\n" +
|
73
|
+
" #{opts.program_name} help"
|
67
74
|
end.parse!
|
68
75
|
|
69
76
|
else
|
data/lib/veracode.rb
CHANGED
@@ -101,6 +101,8 @@ module Veracode
|
|
101
101
|
@manifest |= Dir[File.join("**","*.rb")]
|
102
102
|
# Add any other erb files not already added
|
103
103
|
@manifest |= Dir[File.join("**","*.erb")]
|
104
|
+
# Add any other builder files not already added
|
105
|
+
@manifest |= Dir[File.join("**","*.builder")]
|
104
106
|
# Add any other haml files not already added
|
105
107
|
@manifest |= Dir[File.join("**","*.haml")]
|
106
108
|
end
|
@@ -491,6 +493,80 @@ module Veracode
|
|
491
493
|
end
|
492
494
|
|
493
495
|
|
496
|
+
def self.archive_schema
|
497
|
+
puts "Archiving schema information" if $options[:verbose]
|
498
|
+
schema_file = File.join("db", "schema.rb")
|
499
|
+
begin
|
500
|
+
add_to_archive %Q|module "Veracode::Schema"\n| +
|
501
|
+
%Q|singleton_method "main" []\n| +
|
502
|
+
RubyVM::InstructionSequence.compile_file(schema_file).disasm +
|
503
|
+
%Q|== end disasm\n| +
|
504
|
+
%Q|endmodule\n\n|
|
505
|
+
rescue Exception => e
|
506
|
+
puts "Unable to retrieve schema information from 'db/schema.rb'. Are your migrations up to date?"
|
507
|
+
log_error "Unable to archive 'db/schema.rb' (#{e.message})"
|
508
|
+
end
|
509
|
+
end
|
510
|
+
|
511
|
+
|
512
|
+
def self.compile_templates
|
513
|
+
|
514
|
+
begin
|
515
|
+
require 'action_view' unless defined? ActionView
|
516
|
+
require 'action_controller' unless defined? ActionController
|
517
|
+
rescue Exception => e
|
518
|
+
log_error "Unable to satisfy haml dependencies (#{e.message})"
|
519
|
+
return
|
520
|
+
end
|
521
|
+
|
522
|
+
types = %w{ erb builder haml }
|
523
|
+
|
524
|
+
view_paths = []
|
525
|
+
view_paths += ActionController::Base.view_paths.to_a.map(&:to_s)
|
526
|
+
view_paths |= [File.expand_path("app/views")]
|
527
|
+
|
528
|
+
puts "Looking for templates in #{view_paths.join(", ")}" if $options[:verbose]
|
529
|
+
|
530
|
+
templates = view_paths.map { |vp|
|
531
|
+
Dir[File.join(vp, "**", "*.erb")] +
|
532
|
+
Dir[File.join(vp, "**", "*.builder")] +
|
533
|
+
Dir[File.join(vp, "**", "*.haml")]
|
534
|
+
}.flatten
|
535
|
+
|
536
|
+
return unless templates.count > 0
|
537
|
+
|
538
|
+
puts "Found #{templates.count} templates" if $options[:verbose]
|
539
|
+
|
540
|
+
haml_templates = templates.grep(/\.haml$/)
|
541
|
+
if haml_templates.any?
|
542
|
+
begin
|
543
|
+
require 'haml' unless defined? Haml
|
544
|
+
require 'haml/template/plugin' unless defined? Haml::Plugin
|
545
|
+
rescue Exception => e
|
546
|
+
puts "Unable to satisfy haml dependencies"
|
547
|
+
log_error "Unable to satisfy haml dependencies (#{e.message})"
|
548
|
+
templates -= haml_templates
|
549
|
+
puts " #{templates.count} templates" if $options[:verbose]
|
550
|
+
end
|
551
|
+
end
|
552
|
+
|
553
|
+
assigns = {}
|
554
|
+
view = ActionView::Base.new(view_paths, assigns)
|
555
|
+
controller_view = ApplicationController.new.view_context
|
556
|
+
|
557
|
+
templates.each { |template|
|
558
|
+
puts "Compiling template #{template}" if $options[:verbose]
|
559
|
+
|
560
|
+
begin
|
561
|
+
view.render(:file => template)
|
562
|
+
rescue Exception => e
|
563
|
+
log_error "Compiled template #{template} #{e.message}"
|
564
|
+
end
|
565
|
+
}
|
566
|
+
|
567
|
+
puts "Compiled #{ActionView::CompiledTemplates.instance_methods.count.to_s} templates " if $options[:verbose]
|
568
|
+
end
|
569
|
+
|
494
570
|
def self.compile_erb_templates
|
495
571
|
|
496
572
|
# Rails 3 has wrapped Erubis to handle block helpers in ERB templates
|
@@ -654,6 +730,9 @@ module Veracode
|
|
654
730
|
puts "Phase 2 - Load Rails" if $options[:verbose]
|
655
731
|
begin
|
656
732
|
require "rails"
|
733
|
+
require 'action_controller'
|
734
|
+
require 'action_view'
|
735
|
+
require 'active_record'
|
657
736
|
rescue Exception => e
|
658
737
|
puts "Unable to require rails: #{e.message}"
|
659
738
|
log_error "Unable to require rails: #{e.message}"
|
@@ -714,8 +793,7 @@ module Veracode
|
|
714
793
|
glob_require "app/controllers/application_controller.rb"
|
715
794
|
glob_require "app/controllers/**/*.rb"
|
716
795
|
|
717
|
-
|
718
|
-
compile_haml_templates
|
796
|
+
compile_templates
|
719
797
|
|
720
798
|
self.update
|
721
799
|
self.stats if $options[:verbose]
|
@@ -726,6 +804,8 @@ module Veracode
|
|
726
804
|
archive(@modules - @baseline_modules, true)
|
727
805
|
end
|
728
806
|
|
807
|
+
archive_schema
|
808
|
+
|
729
809
|
## /phase 3 - require app
|
730
810
|
################################################################
|
731
811
|
|
data/lib/veracode/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: veracode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.alpha2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubyzip
|
16
|
-
requirement: &
|
16
|
+
requirement: &70309839816480 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70309839816480
|
25
25
|
description: Prepares your Ruby on Rails app for submission to Veracode.
|
26
26
|
email: devcontact@veracode.com
|
27
27
|
executables:
|