warning-shot 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/License.txt +24 -0
- data/Manifest.txt +44 -0
- data/README.txt +65 -0
- data/Rakefile +4 -0
- data/bin/warning-shot +74 -0
- data/config/hoe.rb +71 -0
- data/config/requirements.rb +17 -0
- data/config/warning_shot/binaries.yml +10 -0
- data/config/warning_shot/classes.yml +12 -0
- data/config/warning_shot/filesystem.yml +8 -0
- data/config/warning_shot/gems.yml +15 -0
- data/config/warning_shot/preload.yml +10 -0
- data/config/warning_shot/scripts/ruby/example.rb +19 -0
- data/config/warning_shot/scripts/ruby/post.rb +18 -0
- data/config/warning_shot/scripts/ruby/post_example.rb +18 -0
- data/config/warning_shot/scripts/ruby/pre.rb +18 -0
- data/config/warning_shot/scripts/ruby/pre_example.rb +19 -0
- data/config/warning_shot/scripts/shell/pre.sh +0 -0
- data/config/warning_shot/urls.yml +9 -0
- data/images/ruby_fail.png +0 -0
- data/images/ruby_ok.png +0 -0
- data/lib/warning_shot/config_parser.rb +46 -0
- data/lib/warning_shot/dep_checker.rb +584 -0
- data/lib/warning_shot/gem_handler.rb +217 -0
- data/lib/warning_shot/template_generator.rb +74 -0
- data/lib/warning_shot/test_script.rb +23 -0
- data/lib/warning_shot/version.rb +15 -0
- data/lib/warning_shot.rb +34 -0
- data/log/debug.log +0 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/test_helper.rb +2 -0
- data/test/test_warning_shot.rb +11 -0
- data/website/index.html +93 -0
- data/website/index.txt +39 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.rhtml +48 -0
- metadata +102 -0
data/History.txt
ADDED
data/License.txt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
* Copyright (c) 2007 Ripple Networks, Inc.
|
2
|
+
* All rights reserved.
|
3
|
+
*
|
4
|
+
* Redistribution and use in source and binary forms, with or without
|
5
|
+
* modification, are permitted provided that the following conditions are met:
|
6
|
+
* * Redistributions of source code must retain the above copyright
|
7
|
+
* notice, this list of conditions and the following disclaimer.
|
8
|
+
* * Redistributions in binary form must reproduce the above copyright
|
9
|
+
* notice, this list of conditions and the following disclaimer in the
|
10
|
+
* documentation and/or other materials provided with the distribution.
|
11
|
+
* * Neither the name of the <organization> nor the
|
12
|
+
* names of its contributors may be used to endorse or promote products
|
13
|
+
* derived from this software without specific prior written permission.
|
14
|
+
*
|
15
|
+
* THIS SOFTWARE IS PROVIDED BY RIPPLE NETWORKS, INC ``AS IS'' AND ANY
|
16
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
* DISCLAIMED. IN NO EVENT SHALL RIPPLE NETWORKS, INC BE LIABLE FOR ANY
|
19
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
History.txt
|
2
|
+
License.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
bin/warning-shot
|
7
|
+
config/hoe.rb
|
8
|
+
config/requirements.rb
|
9
|
+
config/warning_shot/binaries.yml
|
10
|
+
config/warning_shot/classes.yml
|
11
|
+
config/warning_shot/filesystem.yml
|
12
|
+
config/warning_shot/gems.yml
|
13
|
+
config/warning_shot/preload.yml
|
14
|
+
config/warning_shot/urls.yml
|
15
|
+
config/warning_shot/scripts/shell/pre.sh
|
16
|
+
config/warning_shot/scripts/ruby/pre.rb
|
17
|
+
config/warning_shot/scripts/ruby/pre_example.rb
|
18
|
+
config/warning_shot/scripts/ruby/example.rb
|
19
|
+
config/warning_shot/scripts/ruby/post_example.rb
|
20
|
+
config/warning_shot/scripts/ruby/post.rb
|
21
|
+
images/ruby_ok.png
|
22
|
+
images/ruby_fail.png
|
23
|
+
lib/warning_shot.rb
|
24
|
+
lib/warning_shot/dep_checker.rb
|
25
|
+
lib/warning_shot/template_generator.rb
|
26
|
+
lib/warning_shot/gem_handler.rb
|
27
|
+
lib/warning_shot/config_parser.rb
|
28
|
+
lib/warning_shot/test_script.rb
|
29
|
+
lib/warning_shot/version.rb
|
30
|
+
log/debug.log
|
31
|
+
script/destroy
|
32
|
+
script/generate
|
33
|
+
script/txt2html
|
34
|
+
setup.rb
|
35
|
+
tasks/deployment.rake
|
36
|
+
tasks/environment.rake
|
37
|
+
tasks/website.rake
|
38
|
+
test/test_helper.rb
|
39
|
+
test/test_warning_shot.rb
|
40
|
+
website/index.html
|
41
|
+
website/index.txt
|
42
|
+
website/javascripts/rounded_corners_lite.inc.js
|
43
|
+
website/stylesheets/screen.css
|
44
|
+
website/template.rhtml
|
data/README.txt
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
README
|
2
|
+
|
3
|
+
|
4
|
+
INSTALLATION
|
5
|
+
gem install warning_shot
|
6
|
+
|
7
|
+
|
8
|
+
USAGE
|
9
|
+
WarningShot can be used from the command line or in a capistrano script via the 'warning-shot' binary.
|
10
|
+
|
11
|
+
Options are:
|
12
|
+
|
13
|
+
--environment=RAILS_ENV Environment to test in.
|
14
|
+
Default: development
|
15
|
+
-s, --strict URL Testing is only successful on 200 instead of 2xx
|
16
|
+
-f, --flush Flush log before running
|
17
|
+
-g, --gems Install/update all missing OR outdated gems
|
18
|
+
--dir=DIR The root directory of the application to check.
|
19
|
+
Default: .
|
20
|
+
--log=LOG Path of log file.
|
21
|
+
Default: (--dir path)/logs/warning_shot_(--environment).log
|
22
|
+
--configs=PATH Path to config files to use.
|
23
|
+
Default: (--dir path)/config/warning_shot/
|
24
|
+
-v, --verbose Output verbose information.
|
25
|
+
-n, --growl Output final results via growlnotify (Requires growlnotify)
|
26
|
+
--templates=[PATH] Generates template files
|
27
|
+
Default: Not Generated! (If specified, default is '.')
|
28
|
+
-h, --help Show this help message.
|
29
|
+
|
30
|
+
|
31
|
+
CONFIGURATION FILES
|
32
|
+
(Additional details are in each individual config file)
|
33
|
+
Configuration files can be generated with 'warning-shot --templates=/PATH/TO/TEMPLATES'. This will
|
34
|
+
generate five configuration files:
|
35
|
+
- binaries.yml (Binary applications or scripts)
|
36
|
+
- classes.yml (Classes your application is dependent on, generally anything after 'requires')
|
37
|
+
- filesystem.yml (Specific files or directories to test existance of)
|
38
|
+
- gems.yml (Required gems and their versions)
|
39
|
+
- preload.yml (These are files that are needed for testing, they will be loaded with 'requires' before testing starts.)
|
40
|
+
A failed preload is fatal and will stop testing.
|
41
|
+
- urls.yml (Required URLs)
|
42
|
+
|
43
|
+
Each config file contains a list of application environments as well as a 'global' environment. Dependency
|
44
|
+
requirements can be placed in the applicable environment where the dependency exists, or can be added to the
|
45
|
+
'global' environment, which will use the dependency in all cases.
|
46
|
+
|
47
|
+
Template generation will also create a 'scripts' directory for ruby and shell scripts (discussed next).
|
48
|
+
|
49
|
+
|
50
|
+
SCRIPTS
|
51
|
+
Scripts are available for more complex dependency testing, like testing web services, verifying network interfaces, etc.
|
52
|
+
|
53
|
+
Currently only ruby scripts are supported (bash will be supported soon). All scipts should extend "RippleNetworks::WarningShot::TestScript"
|
54
|
+
and implement a "run" method. "run" should return whether the test passed or failed (true or false).
|
55
|
+
|
56
|
+
Test scripts are run in a natural sort order with the exception of "pre" and "post" scripts.
|
57
|
+
|
58
|
+
A master pre and post script exists (pre.rb and post.rb respectively) that will run before and after all other scripts.
|
59
|
+
This can be used to set up and tear down additional aspects of the test environment.
|
60
|
+
|
61
|
+
Each script that you create can also have a pre and post script run by creating an additional script with the
|
62
|
+
prefix "pre_" or "post_" in the script directory.
|
63
|
+
|
64
|
+
The scripts should return a TRUE of FALSE value to let WarningShot know if the test was considered a pass or not. An array
|
65
|
+
can be returned [Boolean,String] of the result and message. The message will be display if provided.
|
data/Rakefile
ADDED
data/bin/warning-shot
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created on 2007-12-12.
|
4
|
+
# Author: Cory O'Daniel
|
5
|
+
# Copyright (c) 2007. All rights reserved.
|
6
|
+
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
require 'warning_shot'
|
10
|
+
include RippleNetworks::WarningShot
|
11
|
+
require 'optparse'
|
12
|
+
|
13
|
+
OPTIONS = DepChecker::DEFAULTS.clone
|
14
|
+
MANDATORY_OPTIONS = DepChecker::MANDATORY_OPTIONS.clone
|
15
|
+
|
16
|
+
parser = OptionParser.new do |opts|
|
17
|
+
opts.banner = <<BANNER
|
18
|
+
WarningShot - Application Dependency Checker
|
19
|
+
|
20
|
+
Usage: #{File.basename($0)} [options]
|
21
|
+
|
22
|
+
Options are:
|
23
|
+
BANNER
|
24
|
+
opts.separator ""
|
25
|
+
opts.on("--environment=APP_ENV", DepChecker::ENVIRONMENT_MAP.keys,
|
26
|
+
"Environment to test in.",
|
27
|
+
"Default: #{OPTIONS[:environment]}") { |OPTIONS[:environment]| }
|
28
|
+
opts.on("-s", "--strict",
|
29
|
+
"URL Testing is only successful on 200 instead of 2xx") { |OPTIONS[:strict]| }
|
30
|
+
opts.on("-f", "--flush",
|
31
|
+
"Flush log before running") { |OPTIONS[:flush]| }
|
32
|
+
opts.on("-g", "--gems",
|
33
|
+
"Install/update all missing OR outdated gems") { |OPTIONS[:gems]| }
|
34
|
+
opts.on("--dir=DIR", String,
|
35
|
+
"The root directory of the application to check.",
|
36
|
+
"Default: #{OPTIONS[:dir]}") { |OPTIONS[:dir]| }
|
37
|
+
opts.on("--log=LOG", String,
|
38
|
+
"Path of log file.",
|
39
|
+
"Default: (--dir path)/logs/warning_shot_(--environment).log") { |OPTIONS[:log]| }
|
40
|
+
opts.on("--configs=PATH", String,
|
41
|
+
"Path to config files to use.",
|
42
|
+
"Default: (--dir path)/config/warning_shot/") { |OPTIONS[:configs]| }
|
43
|
+
opts.on("-v", "--verbose",
|
44
|
+
"Output verbose information.") { |OPTIONS[:verbose]| }
|
45
|
+
opts.on("-n", "--growl",
|
46
|
+
"Output final results via growlnotify (Requires growlnotify)") { |OPTIONS[:growl]| }
|
47
|
+
opts.on("--templates=[PATH]",String,
|
48
|
+
"Generates template files",
|
49
|
+
"Default: Not Generated! (If specified, default is '.')") { |OPTIONS[:templates]| }
|
50
|
+
opts.on("-h", "--help",
|
51
|
+
"Show this help message.") { puts opts; exit }
|
52
|
+
|
53
|
+
begin
|
54
|
+
opts.parse!(ARGV)
|
55
|
+
rescue OptionParser::InvalidOption => opio
|
56
|
+
puts opio
|
57
|
+
puts opts
|
58
|
+
exit
|
59
|
+
rescue OptionParser::InvalidArgument => opia
|
60
|
+
puts opia
|
61
|
+
puts opts
|
62
|
+
exit
|
63
|
+
end
|
64
|
+
|
65
|
+
if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |OPTIONS| options[option.to_sym].nil? }
|
66
|
+
puts opts; exit
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if OPTIONS[:templates] == false
|
71
|
+
DepChecker.new(OPTIONS).run()
|
72
|
+
else
|
73
|
+
DepChecker::generate_templates(OPTIONS[:templates])
|
74
|
+
end
|
data/config/hoe.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'warning_shot/version'
|
2
|
+
|
3
|
+
AUTHOR = ["Cory O'Daniel"]
|
4
|
+
EMAIL = "codaniel @nospam@ rippletv.com"
|
5
|
+
DESCRIPTION = "Application Dependency Checker"
|
6
|
+
GEM_NAME = 'warning-shot'
|
7
|
+
RUBYFORGE_PROJECT = 'warning-shot'
|
8
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
+
|
11
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
12
|
+
@config = nil
|
13
|
+
RUBYFORGE_USERNAME = "coryodaniel"
|
14
|
+
def rubyforge_username
|
15
|
+
unless @config
|
16
|
+
begin
|
17
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
18
|
+
rescue
|
19
|
+
puts <<-EOS
|
20
|
+
ERROR: No rubyforge config file found: #{@config_file}
|
21
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
22
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
23
|
+
EOS
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
end
|
27
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
REV = nil
|
32
|
+
# UNCOMMENT IF REQUIRED:
|
33
|
+
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
34
|
+
VERS = RippleNetworks::WarningShot::VERSION::STRING + (REV ? ".#{REV}" : "")
|
35
|
+
RDOC_OPTS = ['--quiet', '--title', 'warning_shot documentation',
|
36
|
+
"--opname", "index.html",
|
37
|
+
"--line-numbers",
|
38
|
+
"--main", "README",
|
39
|
+
"--inline-source"]
|
40
|
+
|
41
|
+
class Hoe
|
42
|
+
def extra_deps
|
43
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
44
|
+
@extra_deps
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Generate all the Rake tasks
|
49
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
50
|
+
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
51
|
+
p.author = AUTHOR
|
52
|
+
p.description = DESCRIPTION
|
53
|
+
p.email = EMAIL
|
54
|
+
p.summary = DESCRIPTION
|
55
|
+
p.url = HOMEPATH
|
56
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
57
|
+
p.test_globs = ["test/**/test_*.rb"]
|
58
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
59
|
+
|
60
|
+
# == Optional
|
61
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
62
|
+
p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
63
|
+
|
64
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
69
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
70
|
+
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
71
|
+
hoe.rsync_args = '-av --delete --ignore-errors'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
include FileUtils
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
+
begin
|
7
|
+
require req_gem
|
8
|
+
rescue LoadError
|
9
|
+
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
+
puts "Installation: gem install #{req_gem} -y"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
16
|
+
|
17
|
+
require 'warning_shot'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#These are classes your application is dependent upon, ie things that appear after "requires"
|
2
|
+
# in your source code. After the environment is booted (RAILS, MERB) these will be tested to
|
3
|
+
# see if they are accessible via "requires". They should be listed just as they are
|
4
|
+
# in your source code
|
5
|
+
---
|
6
|
+
:global:
|
7
|
+
- yaml
|
8
|
+
:development: []
|
9
|
+
:test: []
|
10
|
+
:qa: []
|
11
|
+
:production: []
|
12
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# rake: => Will verify exists or install newest
|
2
|
+
# rake:0.4.0 => Will verify 0.4.0 or install that version
|
3
|
+
# rake:>0.4.0 => Will verify/install anything after 0.4.0
|
4
|
+
# rake:>0.0.0 => Will verify/install newest
|
5
|
+
# rake:>= 0.3.0 => will verify/install 0.3.0 or later
|
6
|
+
# rake:<1.0 => will verify/install less than 1.0
|
7
|
+
---
|
8
|
+
:global:
|
9
|
+
- rake:=0.7.3
|
10
|
+
:test: []
|
11
|
+
:development: []
|
12
|
+
:qa: []
|
13
|
+
:stage: []
|
14
|
+
:production: []
|
15
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#This is an example script
|
2
|
+
class Example < RippleNetworks::WarningShot::TestScript
|
3
|
+
|
4
|
+
def initialize()
|
5
|
+
end
|
6
|
+
|
7
|
+
=begin rdoc
|
8
|
+
*Name*:: run
|
9
|
+
*Access*:: public
|
10
|
+
*Description*:: Performs test
|
11
|
+
===Returns
|
12
|
+
*Description*:: Result of test
|
13
|
+
*Datatype*:: boolean
|
14
|
+
=end
|
15
|
+
def run()
|
16
|
+
return [true,"This test passed."]
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#Post script will run after all other scripts
|
2
|
+
class Post < RippleNetworks::WarningShot::TestScript
|
3
|
+
def initialize()
|
4
|
+
end
|
5
|
+
|
6
|
+
=begin rdoc
|
7
|
+
*Name*:: run
|
8
|
+
*Access*:: public
|
9
|
+
*Description*:: Performs test
|
10
|
+
===Returns
|
11
|
+
*Description*:: Result of test
|
12
|
+
*Datatype*:: boolean
|
13
|
+
=end
|
14
|
+
def run()
|
15
|
+
return true
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#post_example will run after example.rb
|
2
|
+
class PostExample < RippleNetworks::WarningShot::TestScript
|
3
|
+
def initialize()
|
4
|
+
end
|
5
|
+
|
6
|
+
=begin rdoc
|
7
|
+
*Name*:: run
|
8
|
+
*Access*:: public
|
9
|
+
*Description*:: Performs test
|
10
|
+
===Returns
|
11
|
+
*Description*:: Result of test
|
12
|
+
*Datatype*:: boolean
|
13
|
+
=end
|
14
|
+
def run()
|
15
|
+
return true
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#Pre Script will run before all other scripts
|
2
|
+
class Pre < RippleNetworks::WarningShot::TestScript
|
3
|
+
def initialize()
|
4
|
+
end
|
5
|
+
|
6
|
+
=begin rdoc
|
7
|
+
*Name*:: run
|
8
|
+
*Access*:: public
|
9
|
+
*Description*:: Performs test
|
10
|
+
===Returns
|
11
|
+
*Description*:: Result of test
|
12
|
+
*Datatype*:: boolean
|
13
|
+
=end
|
14
|
+
def run()
|
15
|
+
return true
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#pre_example will run before the example.rb script
|
2
|
+
class PreExample < RippleNetworks::WarningShot::TestScript
|
3
|
+
|
4
|
+
def initialize()
|
5
|
+
end
|
6
|
+
|
7
|
+
=begin rdoc
|
8
|
+
*Name*:: run
|
9
|
+
*Access*:: public
|
10
|
+
*Description*:: Performs test
|
11
|
+
===Returns
|
12
|
+
*Description*:: Result of test
|
13
|
+
*Datatype*:: boolean
|
14
|
+
=end
|
15
|
+
def run()
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
File without changes
|
Binary file
|
data/images/ruby_ok.png
ADDED
Binary file
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module RippleNetworks
|
2
|
+
module WarningShot
|
3
|
+
class ConfigParser
|
4
|
+
require 'yaml'
|
5
|
+
include RippleNetworks::WarningShot
|
6
|
+
|
7
|
+
def ConfigParser.run(ws)
|
8
|
+
|
9
|
+
env_interned = ws.options[:environment].intern
|
10
|
+
configs_not_found = 0
|
11
|
+
|
12
|
+
DepChecker::DEP_FILES.each do |config_file|
|
13
|
+
|
14
|
+
file_path = File.join(ws.options[:configs],%{#{config_file}.yml})
|
15
|
+
|
16
|
+
begin
|
17
|
+
yaml = YAML::load(File.open(file_path,"r"))
|
18
|
+
|
19
|
+
#Default missing environments to []
|
20
|
+
global = (yaml[:global].nil? || yaml[:global] === true)? [] : yaml[:global]
|
21
|
+
running_env = (yaml[env_interned].nil? || yaml[env_interned] === true)? [] : yaml[env_interned]
|
22
|
+
|
23
|
+
#Merge :global and current mode, make unique
|
24
|
+
ws.configs[config_file] = global.concat(running_env)
|
25
|
+
ws.configs[config_file].uniq!
|
26
|
+
|
27
|
+
ws.record("LOADED: #{config_file}.yml")
|
28
|
+
rescue Errno::ENOENT => e
|
29
|
+
ws.configs[config_file] = {}
|
30
|
+
configs_not_found += 1
|
31
|
+
ws.record("NOT FOUND: #{config_file}.yml",:warning)
|
32
|
+
rescue Exception => e
|
33
|
+
ws.record(e.inspect)
|
34
|
+
ws.configs[config_file] = {}
|
35
|
+
ws.record("MALFORMED: #{config_file}.yml",:error)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
if configs_not_found == DepChecker::DEP_FILES.size
|
40
|
+
ws.record("No configuration files found!\n\t\tTo generate run 'warning-shot --templates=PATH'",:info)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|