risu 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.ci +1 -3
- data/NEWS.markdown +17 -3
- data/README.markdown +24 -30
- data/Rakefile +17 -13
- data/bin/risu +4 -4
- data/lib/risu.rb +5 -5
- data/lib/risu/base.rb +3 -4
- data/lib/risu/base/schema.rb +4 -4
- data/lib/risu/base/template_base.rb +3 -3
- data/lib/risu/base/template_manager.rb +7 -7
- data/lib/risu/base/templater.rb +5 -4
- data/lib/risu/cli.rb +3 -3
- data/lib/risu/cli/application.rb +14 -8
- data/lib/risu/cli/banner.rb +4 -4
- data/lib/risu/exceptions.rb +3 -3
- data/lib/risu/exceptions/invaliddocument.rb +3 -3
- data/lib/risu/models.rb +3 -3
- data/lib/risu/models/familyselection.rb +3 -3
- data/lib/risu/models/host.rb +16 -16
- data/lib/risu/models/individualpluginselection.rb +3 -3
- data/lib/risu/models/item.rb +14 -5
- data/lib/risu/models/patch.rb +4 -4
- data/lib/risu/models/plugin.rb +5 -4
- data/lib/risu/models/pluginspreference.rb +3 -3
- data/lib/risu/models/policy.rb +3 -3
- data/lib/risu/models/reference.rb +15 -3
- data/lib/risu/models/report.rb +5 -5
- data/lib/risu/models/serverpreference.rb +3 -3
- data/lib/risu/models/servicedescription.rb +4 -4
- data/lib/risu/models/version.rb +4 -4
- data/lib/risu/parsers.rb +3 -3
- data/lib/risu/parsers/nessus/nessus_document.rb +7 -11
- data/lib/risu/parsers/nessus/nessus_sax_listener.rb +11 -12
- data/lib/risu/parsers/nexpose/nexpose_document.rb +3 -3
- data/lib/risu/parsers/nexpose/simple_nexpose.rb +6 -6
- data/lib/risu/renderers.rb +3 -3
- data/lib/risu/renderers/nilrenderer.rb +6 -6
- data/lib/risu/templates/assets.rb +4 -5
- data/lib/risu/templates/cover_sheet.rb +3 -3
- data/lib/risu/templates/exec_summary.rb +3 -3
- data/lib/risu/templates/executive_summary.rb +5 -8
- data/lib/risu/templates/finding_statistics.rb +3 -3
- data/lib/risu/templates/findings_summary.rb +3 -3
- data/lib/risu/templates/findings_summary_with_pluginid.rb +3 -4
- data/lib/risu/templates/graphs.rb +3 -3
- data/lib/risu/templates/host_summary.rb +3 -3
- data/lib/risu/templates/ms_patch_summary.rb +4 -6
- data/lib/risu/templates/ms_update_summary.rb +5 -5
- data/lib/risu/templates/ms_wsus_findings.rb +3 -3
- data/lib/risu/templates/notable.rb +5 -5
- data/lib/risu/templates/notable_detailed.rb +3 -3
- data/lib/risu/templates/pci_compliance.rb +5 -5
- data/lib/risu/templates/stig_findings_summary.rb +7 -7
- data/lib/risu/templates/technical_findings.rb +3 -3
- data/lib/risu/templates/template.rb +3 -3
- data/risu.gemspec +2 -2
- metadata +49 -54
- data/KNOWNISSUES.markdown +0 -51
- data/TODO.markdown +0 -194
- data/lib/risu/base/prawn_templater.rb +0 -65
data/Gemfile.ci
CHANGED
data/NEWS.markdown
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
-
#1.5.
|
3
|
+
#1.5.2 (July 30, 2012)
|
4
|
+
- New Parsed Tags
|
5
|
+
- vmsa
|
6
|
+
- cert-vu
|
7
|
+
- Model Changes
|
8
|
+
- Reference Model
|
9
|
+
- Added vmsa() method
|
10
|
+
- Added cert_vu() method
|
11
|
+
- Switched from the 'mysql' gem to the 'mysql2' gem for better rails3 support with mysql databases
|
12
|
+
- Note: **This means you need to specify mysql2 as the database adapter**
|
13
|
+
- Fixed Ticket #57, which had a sqlite specific query, breaking the query on MySql. Reported by Drew Brunson
|
14
|
+
- A few typos and spelling errors corrected
|
15
|
+
- Added some PRAGMA's that might speed up SQLite3 usage. If it is still to slow (on insert) It is recommended to use MySQL.
|
16
|
+
|
17
|
+
#1.5.1 (July 10, 2012)
|
4
18
|
- Host Model
|
5
19
|
- top_n_vulnerable(n)
|
6
20
|
- risks_by_host(n); updated the query critical instead of high
|
@@ -24,7 +38,7 @@
|
|
24
38
|
- cisco-sa as a reference
|
25
39
|
- cisco-bug-id as a reference
|
26
40
|
- ics-alert as a reference
|
27
|
-
- cisco
|
41
|
+
- cisco-sr as a reference
|
28
42
|
- always_run added to the Item Model (Related to a Registry Svc Check)
|
29
43
|
- Spell-checked all of the templates and fixed some spelling issues
|
30
44
|
- Added a template for the WSUS Patch Management Report Nessus Plugin ID: 58133
|
@@ -148,7 +162,7 @@ You can access it via `Host.first.patches` or `Patch.all`
|
|
148
162
|
- Fixed small bug in Windows/Other OS graphs
|
149
163
|
- Increased the verboseness of Error messages Ticket #29
|
150
164
|
- Added named scopes off the Plugin class Ticket #34
|
151
|
-
- Added new PCI related HostProperties
|
165
|
+
- Added new PCI related HostProperties Ticket #35
|
152
166
|
- New HostProperties attribute: pci-dss-compliance:
|
153
167
|
- New HostProperties attribute: pcidss:compliance:failed
|
154
168
|
- New HostProperties attribute: pcidss:compliance:passed
|
data/README.markdown
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Risu is [Nessus](http://www.nessus.org) parser, that converts the generated reports into a [ActiveRecord](http://api.rubyonrails.org/classes/ActiveRecord/Base.html) database, this allows for easy report generation and vulnerability verification.
|
4
4
|
|
5
|
-
Version **1.5.
|
5
|
+
Version **1.5.2** is the current release.
|
6
6
|
|
7
7
|
## Requirements
|
8
8
|
|
@@ -19,13 +19,13 @@ Risu relies heavily on [RubyGems](http://rubygems.org/) to install other depende
|
|
19
19
|
- rmagick
|
20
20
|
- gruff
|
21
21
|
- prawn
|
22
|
-
-
|
22
|
+
- mysql2
|
23
23
|
|
24
24
|
## Developmental Requirements
|
25
25
|
|
26
26
|
These are all available through [RubyGems](http://rubygems.org/). The should be installed automatically when you install risu, If not this command will install them all:
|
27
27
|
|
28
|
-
% gem install rmagick gruff prawn yard
|
28
|
+
% gem install rmagick gruff prawn yard mysql2 libxml-ruby rails sqlite3 logger yaml
|
29
29
|
|
30
30
|
**You my need sudo/root access depending on your system setup**
|
31
31
|
|
@@ -74,7 +74,7 @@ Using the risu Console is just like using Rails. You can access all of the Activ
|
|
74
74
|
|_| |_|___/\__,_|
|
75
75
|
|
76
76
|
|
77
|
-
risu Console v1.5.
|
77
|
+
risu Console v1.5.2
|
78
78
|
>> Host.first
|
79
79
|
=> #<Risu::Models::Host id: 1, report_id: 1, name: "10.69.69.74", os: "Linux Kernel 2.6 on Debian 4.0 (etch)", mac: "XX:XX:XX:XX:XX:XX", start: "2011-04-20 16:29:37", end: "2011-04-20 16:32:14", ip: "10.69.69.74", fqdn: "redada.hammackj.net", netbios: "REDADA", local_checks_proto: nil, smb_login_used: nil, ssh_auth_meth: nil, ssh_login_used: nil, pci_dss_compliance: nil, notes: nil>
|
80
80
|
|
@@ -82,26 +82,26 @@ Using the risu Console is just like using Rails. You can access all of the Activ
|
|
82
82
|
Several templates are included:
|
83
83
|
|
84
84
|
$ risu -l
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
85
|
+
Available Templates
|
86
|
+
stig_findings_summary - DISA Stig findings summary report
|
87
|
+
pci_compliance - Generates a PCI Compliance Overview Report
|
88
|
+
technical_findings - Generates a Technical Findings Report
|
89
|
+
ms_patch_summary - Generates a Microsoft Patch Summary Report
|
90
|
+
findings_summary_with_pluginid - Generates a Findings Summary with Nessus Plugin ID
|
91
|
+
findings_host - Generates a findings report by host
|
92
|
+
exec_summary - Generates a simple executive summary.
|
93
|
+
finding_statistics - Generates report finding statistics
|
94
|
+
graphs - Generates a report with all the graphs in it
|
95
|
+
findings_summary - Generates a findings summary report
|
96
|
+
assets - Generates a Assets Summary Report
|
97
|
+
cover_sheet - Generates a coversheet with a logo (Example Template)
|
98
|
+
notable_detailed - Notable Vulnerabilities Detailed
|
99
|
+
ms_update_summary - Generates a Microsoft Update Summary Report
|
100
|
+
template - template
|
101
|
+
notable - Notable Vulnerabilities
|
102
|
+
ms_wsus_findings - Generates a report based on the findings of the Patch Management: WSUS Report plugin
|
103
|
+
exec_summary_detailed - Generates a detailed executive summary report
|
104
|
+
host_summary - Generates a Host Summary Report
|
105
105
|
$
|
106
106
|
|
107
107
|
The templates are written in ruby using [prawn](http://prawn.majesticseacreature.com/), they are fairly easy to make. I will add any templates as requested. See the 'template' example for creating your own template.
|
@@ -112,13 +112,7 @@ If you would like to contribute templates/bug fixes/etc to risu. The easiest way
|
|
112
112
|
# Issues
|
113
113
|
If you have any problems, bugs or feature requests please use the [github issue tracker](http://github.com/hammackj/risu/issues).
|
114
114
|
|
115
|
-
#Donations
|
116
|
-
I have received several requests for a method to donate to the project. You can use the following Paypal donation link; if you are interested in donating to the Risu Project. Your donations are welcome and help the development of Risu.
|
117
|
-
|
118
|
-
<a href='http://www.pledgie.com/campaigns/16810'><img alt='Click here to lend your support to: Risu and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/16810.png?skin_name=chrome' border='0' /></a>
|
119
|
-
|
120
115
|
# Contact
|
121
116
|
You can reach me at jacob[dot]hammack[at]hammackj[dot]com.
|
122
117
|
|
123
118
|
You can also contact me on IRC as hammackj on irc.freenode.net, #risu
|
124
|
-
|
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2010-2012 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
|
-
|
3
|
+
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
6
|
-
|
6
|
+
#
|
7
7
|
# * Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# * Redistributions in binary form must reproduce the above copyright
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
13
13
|
# may be used to endorse or promote products derived from this software
|
14
14
|
# without specific prior written permission.
|
15
|
-
|
15
|
+
#
|
16
16
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
17
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
18
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
@@ -37,7 +37,7 @@ end
|
|
37
37
|
|
38
38
|
task :release => :build do
|
39
39
|
system "gem push #{Risu::APP_NAME}-#{Risu::VERSION}.gem"
|
40
|
-
puts "Just released #{Risu::APP_NAME} v#{Risu::VERSION}. #{Risu::APP_NAME} is
|
40
|
+
puts "Just released #{Risu::APP_NAME} v#{Risu::VERSION}. #{Risu::APP_NAME} is an Nessus XML parser/database. More information at http://hammackj.com/projects/risu/"
|
41
41
|
end
|
42
42
|
|
43
43
|
task :clean do
|
@@ -48,16 +48,20 @@ task :clean do
|
|
48
48
|
system "rm -rf coverage"
|
49
49
|
end
|
50
50
|
|
51
|
-
task :default => [:
|
51
|
+
task :default => [:test_sqlite]
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
task :test_sqlite do
|
54
|
+
ENV['RISU_TEST_ENV'] = "sqlite"
|
55
|
+
Rake::Task['run_tests'].invoke
|
56
|
+
end
|
57
|
+
|
58
|
+
task :test_mysql do
|
59
|
+
ENV['RISU_TEST_ENV'] = "mysql"
|
60
|
+
Rake::Task['run_tests'].invoke
|
61
|
+
end
|
58
62
|
|
59
|
-
Rake::TestTask.new("
|
63
|
+
Rake::TestTask.new("run_tests") do |t|
|
60
64
|
t.libs << "test"
|
61
|
-
t.pattern = 'test
|
65
|
+
t.pattern = 'test/*/*_test.rb'
|
62
66
|
t.verbose = true
|
63
|
-
|
67
|
+
end
|
data/bin/risu
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
#
|
3
3
|
# Copyright (c) 2010-2012 Arxopia LLC.
|
4
4
|
# All rights reserved.
|
5
|
-
|
5
|
+
#
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
8
|
-
|
8
|
+
#
|
9
9
|
# * Redistributions of source code must retain the above copyright
|
10
10
|
# notice, this list of conditions and the following disclaimer.
|
11
11
|
# * Redistributions in binary form must reproduce the above copyright
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
15
15
|
# may be used to endorse or promote products derived from this software
|
16
16
|
# without specific prior written permission.
|
17
|
-
|
17
|
+
#
|
18
18
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
19
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
20
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
data/lib/risu.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2010-2012 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
|
-
|
3
|
+
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
6
|
-
|
6
|
+
#
|
7
7
|
# * Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# * Redistributions in binary form must reproduce the above copyright
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
13
13
|
# may be used to endorse or promote products derived from this software
|
14
14
|
# without specific prior written permission.
|
15
|
-
|
15
|
+
#
|
16
16
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
17
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
18
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
module Risu
|
28
28
|
APP_NAME = "risu"
|
29
|
-
VERSION = "1.5.
|
29
|
+
VERSION = "1.5.2"
|
30
30
|
GRAPH_WIDTH = 750
|
31
31
|
EMAIL = "jacob.hammack@hammackj.com"
|
32
32
|
CONFIG_FILE = "./risu.cfg"
|
@@ -43,7 +43,7 @@ require 'gruff'
|
|
43
43
|
require 'prawn'
|
44
44
|
require 'prawn/layout'
|
45
45
|
require 'stringio'
|
46
|
-
require '
|
46
|
+
require 'mysql2'
|
47
47
|
require 'irb'
|
48
48
|
|
49
49
|
require 'optparse'
|
data/lib/risu/base.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2010-2012 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
|
-
|
3
|
+
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
6
|
-
|
6
|
+
#
|
7
7
|
# * Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# * Redistributions in binary form must reproduce the above copyright
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
13
13
|
# may be used to endorse or promote products derived from this software
|
14
14
|
# without specific prior written permission.
|
15
|
-
|
15
|
+
#
|
16
16
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
17
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
18
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
@@ -31,5 +31,4 @@ end
|
|
31
31
|
|
32
32
|
require 'risu/base/template_base'
|
33
33
|
require 'risu/base/template_manager'
|
34
|
-
require 'risu/base/prawn_templater'
|
35
34
|
require 'risu/base/templater'
|
data/lib/risu/base/schema.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2010-2012 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
|
-
|
3
|
+
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
6
|
-
|
6
|
+
#
|
7
7
|
# * Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# * Redistributions in binary form must reproduce the above copyright
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
13
13
|
# may be used to endorse or promote products derived from this software
|
14
14
|
# without specific prior written permission.
|
15
|
-
|
15
|
+
#
|
16
16
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
17
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
18
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
@@ -182,7 +182,7 @@ module Risu
|
|
182
182
|
add_index :references, :plugin_id
|
183
183
|
|
184
184
|
#Default data for service descriptions
|
185
|
-
#@todo Unused
|
185
|
+
#@todo Unused ATM, might be better to use a yaml file tho..
|
186
186
|
ServiceDescription.create :name => "www", :description => ""
|
187
187
|
ServiceDescription.create :name => "cifs", :description => ""
|
188
188
|
ServiceDescription.create :name => "smb", :description => ""
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2010-2012 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
|
-
|
3
|
+
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
6
|
-
|
6
|
+
#
|
7
7
|
# * Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# * Redistributions in binary form must reproduce the above copyright
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
13
13
|
# may be used to endorse or promote products derived from this software
|
14
14
|
# without specific prior written permission.
|
15
|
-
|
15
|
+
#
|
16
16
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
17
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
18
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2010-2012 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
|
-
|
3
|
+
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
6
|
-
|
6
|
+
#
|
7
7
|
# * Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# * Redistributions in binary form must reproduce the above copyright
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
13
13
|
# may be used to endorse or promote products derived from this software
|
14
14
|
# without specific prior written permission.
|
15
|
-
|
15
|
+
#
|
16
16
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
17
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
18
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
@@ -35,7 +35,6 @@ module Risu
|
|
35
35
|
# @param path Path relative to the base_dir of risu
|
36
36
|
#
|
37
37
|
# @return New instance of the template manager with templates loaded.
|
38
|
-
#
|
39
38
|
def initialize (path)
|
40
39
|
@registered_templates = Array.new
|
41
40
|
@templates = Array.new
|
@@ -49,7 +48,6 @@ module Risu
|
|
49
48
|
# Loads templates from a specific path
|
50
49
|
#
|
51
50
|
# @param path Path to templates to load
|
52
|
-
#
|
53
51
|
def load_templates(path)
|
54
52
|
begin
|
55
53
|
Dir["#{path}/**/*.rb"].each do |x|
|
@@ -72,8 +70,11 @@ module Risu
|
|
72
70
|
|
73
71
|
# Validates that a template is a valid template
|
74
72
|
#
|
73
|
+
# @todo look at refactoring this to valid?(template)
|
74
|
+
#
|
75
75
|
# @param template The template to validate
|
76
76
|
#
|
77
|
+
# @return [Boolean] If the template is valid
|
77
78
|
def validate(template)
|
78
79
|
t = template.new
|
79
80
|
|
@@ -97,8 +98,7 @@ module Risu
|
|
97
98
|
return nil
|
98
99
|
end
|
99
100
|
|
100
|
-
# Displays a list of all the templates
|
101
|
-
#
|
101
|
+
# Displays a list of all the templates to STDOUT
|
102
102
|
def display_templates
|
103
103
|
puts "Available Templates"
|
104
104
|
@registered_templates.each do |x|
|
data/lib/risu/base/templater.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2010-2012 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
|
-
|
3
|
+
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
6
|
-
|
6
|
+
#
|
7
7
|
# * Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# * Redistributions in binary form must reproduce the above copyright
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
13
13
|
# may be used to endorse or promote products derived from this software
|
14
14
|
# without specific prior written permission.
|
15
|
-
|
15
|
+
#
|
16
16
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
17
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
18
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
@@ -56,7 +56,8 @@ module Risu
|
|
56
56
|
t.render(output) unless t == nil
|
57
57
|
end
|
58
58
|
rescue => e
|
59
|
-
|
59
|
+
raise unless Rails.env.production?
|
60
|
+
puts "Templater Error: #{e.message} \n #{e.backtrace.join("\n\t")}\n"
|
60
61
|
end
|
61
62
|
end
|
62
63
|
end
|
data/lib/risu/cli.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2010-2012 Arxopia LLC.
|
2
2
|
# All rights reserved.
|
3
|
-
|
3
|
+
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
6
|
-
|
6
|
+
#
|
7
7
|
# * Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# * Redistributions in binary form must reproduce the above copyright
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# * Neither the name of the Arxopia LLC nor the names of its contributors
|
13
13
|
# may be used to endorse or promote products derived from this software
|
14
14
|
# without specific prior written permission.
|
15
|
-
|
15
|
+
#
|
16
16
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
17
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
18
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|