warningshot 0.9.4

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.
Files changed (72) hide show
  1. data/CHANGELOG +0 -0
  2. data/CONTRIBUTORS +2 -0
  3. data/LICENSE +22 -0
  4. data/README +101 -0
  5. data/Rakefile +28 -0
  6. data/TODO +148 -0
  7. data/bin/warningshot +19 -0
  8. data/bin/ws-stage.bat +3 -0
  9. data/bin/ws-stage.sh +3 -0
  10. data/images/warning_shot.png +0 -0
  11. data/images/warning_shot_sml.png +0 -0
  12. data/images/warningshot_green.png +0 -0
  13. data/images/warningshot_red.png +0 -0
  14. data/lib/core_ext/hash.rb +14 -0
  15. data/lib/core_ext/kernel.rb +8 -0
  16. data/lib/core_ext/object.rb +7 -0
  17. data/lib/core_ext/string.rb +5 -0
  18. data/lib/resolvers/core_lib_resolver.rb +76 -0
  19. data/lib/resolvers/directory_resolver.rb +31 -0
  20. data/lib/resolvers/file_resolver.rb +87 -0
  21. data/lib/resolvers/gem_resolver.rb +94 -0
  22. data/lib/resolvers/integrity_resolver.rb +69 -0
  23. data/lib/resolvers/manual_resolver.rb +19 -0
  24. data/lib/resolvers/permission_resolver.rb +72 -0
  25. data/lib/resolvers/symlink_resolver.rb +43 -0
  26. data/lib/resolvers/url_resolver.rb +76 -0
  27. data/lib/warning_shot/config.rb +132 -0
  28. data/lib/warning_shot/dependency_resolver.rb +155 -0
  29. data/lib/warning_shot/growl.rb +14 -0
  30. data/lib/warning_shot/logger.rb +27 -0
  31. data/lib/warning_shot/resolver.rb +542 -0
  32. data/lib/warning_shot/template_generator.rb +28 -0
  33. data/lib/warning_shot/version.rb +7 -0
  34. data/lib/warning_shot/warning_shot.rb +130 -0
  35. data/lib/warningshot.rb +16 -0
  36. data/tasks/gemspec.rb +48 -0
  37. data/tasks/rpsec.rb +58 -0
  38. data/tasks/yard.rb +4 -0
  39. data/templates/binaries.yml +26 -0
  40. data/templates/core_libs.yml +18 -0
  41. data/templates/directories.yml +23 -0
  42. data/templates/files.yml +18 -0
  43. data/templates/gems.yml +26 -0
  44. data/templates/manual.yml +29 -0
  45. data/templates/mounts.yml +8 -0
  46. data/templates/permissions.yml +31 -0
  47. data/templates/symlinks.yml +30 -0
  48. data/templates/urls.yml +21 -0
  49. data/test/data/mock.yaml +16 -0
  50. data/test/data/mock.yml +10 -0
  51. data/test/data/mock_resolver.rb +16 -0
  52. data/test/data/permission_test.txt +1 -0
  53. data/test/data/resolvers/file/src/that.txt +1 -0
  54. data/test/log/warningshot.log +643 -0
  55. data/test/spec/spec.opts.zoiks +0 -0
  56. data/test/spec/spec_helper.rb +11 -0
  57. data/test/spec/unit/resolvers/core_lib_resolver_spec.rb +39 -0
  58. data/test/spec/unit/resolvers/directory_resolver_spec.rb +39 -0
  59. data/test/spec/unit/resolvers/file_resolver_spec.rb +134 -0
  60. data/test/spec/unit/resolvers/gem_resolver_spec.rb +74 -0
  61. data/test/spec/unit/resolvers/integrity_resolver_spec.rb +103 -0
  62. data/test/spec/unit/resolvers/manual_resolver_spec.rb +17 -0
  63. data/test/spec/unit/resolvers/permission_resolver_spec.rb +56 -0
  64. data/test/spec/unit/resolvers/symlink_resolver_spec.rb +44 -0
  65. data/test/spec/unit/resolvers/url_resolver_spec.rb +64 -0
  66. data/test/spec/unit/warning_shot/config_spec.rb +35 -0
  67. data/test/spec/unit/warning_shot/dependency_resolver_spec.rb +43 -0
  68. data/test/spec/unit/warning_shot/resolver_spec.rb +347 -0
  69. data/test/spec/unit/warning_shot/template_generator_spec.rb +21 -0
  70. data/test/spec/unit/warning_shot/version_spec.rb +7 -0
  71. data/test/spec/unit/warning_shot/warning_shot_spec.rb +3 -0
  72. metadata +143 -0
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+ require 'fileutils'
3
+ require 'yaml'
4
+ require 'optparse'
5
+ require 'logger'
6
+ require 'set'
7
+ require 'rbconfig'
8
+
9
+ # Load core extensions
10
+ Dir.glob(File.join(File.dirname(__FILE__), "core_ext", "**", "*.rb")).each {|f| require f}
11
+
12
+ # Load WarningShot
13
+ Dir.glob(File.dirname(__FILE__) / "warning_shot" / "**" / "*.rb").each {|f| require f}
14
+
15
+ # Load resolvers
16
+ Dir.glob(File.dirname(__FILE__) / "resolvers" / "**" / "*.rb").each {|f| require f}
data/tasks/gemspec.rb ADDED
@@ -0,0 +1,48 @@
1
+ spec = Gem::Specification.new do |s|
2
+ s.name = NAME
3
+ s.version = WarningShot::VERSION
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["Cory ODaniel"]
7
+ s.date = %q{2008-10-15}
8
+ s.default_executable = %q{warningshot}
9
+ s.description = %q{WarningShot Dependency Resolution Framework.}
10
+ s.email = %q{warningshot@coryodaniel.com.com}
11
+ s.executables = ["warningshot"]
12
+ s.extra_rdoc_files = ["README", "LICENSE", "TODO"]
13
+ s.files = %w(LICENSE README Rakefile TODO CHANGELOG CONTRIBUTORS)
14
+ s.files += Dir["{doc,bin,test,lib,tasks,test,templates,images}/**/*"]
15
+ s.has_rdoc = true
16
+ s.homepage = %q{http://warningshot.lighthouseapp.com}
17
+ s.require_paths = ["lib"]
18
+ s.required_ruby_version = Gem::Requirement.new(">= 1.8.6")
19
+ s.rubygems_version = %q{1.2.0}
20
+ s.summary = s.description
21
+
22
+ #if s.respond_to? :specification_version then
23
+ # current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ # s.specification_version = 2
25
+
26
+ # if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ # #s.add_runtime_dependency(%q<gem>, [">= version"])
28
+ # else
29
+ # #s.add_runtime_dependency(%q<gem>, [">= version"])
30
+ # end
31
+ #else
32
+ # #s.add_runtime_dependency(%q<gem>, [">= version"])
33
+ #end
34
+ end
35
+
36
+ Rake::GemPackageTask.new(spec) do |package|
37
+ package.gem_spec = spec
38
+ end
39
+
40
+ desc "Run :package and install the resulting .gem"
41
+ task :install => :package do
42
+ sh %{sudo gem install --local pkg/#{NAME}-#{WarningShot::VERSION}.gem --no-rdoc --no-ri}
43
+ end
44
+
45
+ desc "Run :clean and uninstall the .gem"
46
+ task :uninstall => :clean do
47
+ sh %{sudo gem uninstall #{NAME}}
48
+ end
data/tasks/rpsec.rb ADDED
@@ -0,0 +1,58 @@
1
+ desc "Run specs, run a specific spec with TASK=spec/path_to_spec.rb"
2
+ task :spec => [ "spec:default" ]
3
+
4
+ namespace :spec do
5
+ OPTS_FILENAME = "./spec/spec.opts"
6
+ ENV["WARNING_SHOT_ENV"] = 'test'
7
+
8
+ if File.exist?(OPTS_FILENAME)
9
+ SPEC_OPTS = ["--options", OPTS_FILENAME]
10
+ else
11
+ SPEC_OPTS = ["--color", "--format", "specdoc"]
12
+ end
13
+
14
+ Spec::Rake::SpecTask.new('default') do |t|
15
+ t.spec_opts = SPEC_OPTS
16
+ if(ENV['CLASS'])
17
+ t.spec_files = ['test/spec/spec_helper.rb',"test/spec/**/#{ENV['CLASS']}_spec.rb"]
18
+ else
19
+ t.spec_files = ['test/spec/spec_helper.rb','test/spec/**/*_spec.rb']
20
+ end
21
+ end
22
+
23
+ desc "Run unit specs, run a spec for a specific class with CLASS=klass"
24
+ Spec::Rake::SpecTask.new('unit') do |t|
25
+ t.spec_opts = SPEC_OPTS
26
+ if(ENV['CLASS'])
27
+ t.spec_files = ['test/spec/spec_helper.rb',"test/spec/unit/#{ENV['CLASS']}_spec.rb"]
28
+ else
29
+ t.spec_files = ['test/spec/spec_helper.rb','test/spec/unit/**/*_spec.rb']
30
+ end
31
+ end
32
+
33
+ desc "Run integration specs, run a spec for a specific class with CLASS=klass"
34
+ Spec::Rake::SpecTask.new('integration') do |t|
35
+ t.spec_opts = SPEC_OPTS
36
+ if(ENV['CLASS'])
37
+ t.spec_files = ['test/spec/spec_helper.rb',"test/spec/integration/#{ENV['CLASS']}_spec.rb"]
38
+ else
39
+ t.spec_files = ['test/spec/spec_helper.rb','test/spec/integration/**/*_spec.rb']
40
+ end
41
+ end
42
+
43
+ desc "Run all specs and output the result in html"
44
+ Spec::Rake::SpecTask.new('html') do |t|
45
+ t.spec_opts = ["--format", "html"]
46
+ t.libs = ['lib']
47
+ t.spec_files = ['test/spec/spec_helper.rb','test/spec/**/*_spec.rb']
48
+ end
49
+
50
+ desc "Run specs and check coverage with rcov"
51
+ Spec::Rake::SpecTask.new('coverage') do |t|
52
+ t.spec_opts = SPEC_OPTS
53
+ t.spec_files = ['test/spec/spec_helper.rb','test/spec/**/*_spec.rb']
54
+ t.libs = ['lib']
55
+ t.rcov = true
56
+ t.rcov_opts = ["--exclude 'config,spec'"]
57
+ end
58
+ end
data/tasks/yard.rb ADDED
@@ -0,0 +1,4 @@
1
+ #YARD::Rake::YardocTask.new do |t|
2
+ # t.files = ['lib/**/*.rb', OTHER_PATHS] # optional
3
+ # t.options = ['--any', '--extra', '--opts'] # optional
4
+ #end
@@ -0,0 +1,26 @@
1
+ # Tests for executables/binaries (uses `which`, apt, yum, gems)
2
+
3
+ # You can add your own environments below. Requirements listed in
4
+ # the 'global' environment are always checked
5
+ # ---
6
+ # :localdev:
7
+ # - ls
8
+ # - mkdir
9
+ # :global:
10
+ # - /usr/sbin/sendmail
11
+ # :production:
12
+ # -
13
+ #
14
+ # - {manager: 'apt',name:'banshee', version: '>0.1.0'}
15
+ # - {manager: 'gems',name:'merb', version: '>0.9.0'}
16
+ # - {manager: 'ports',name:'libmemcached', version: '>0.1.0'}
17
+ # - {manager: 'yum',name:'libmemcached', version: '>0.1.0'}
18
+
19
+ ---
20
+ :branch: binaries
21
+ :environments:
22
+ :development: []
23
+ :global: []
24
+ :test: []
25
+ :qa: []
26
+ :production: []
@@ -0,0 +1,18 @@
1
+ # Checks to see that core libraries are available
2
+
3
+ # You can add your own environments below. Requirements listed in
4
+ # the 'global' environment are always checked
5
+ # ---
6
+ # :localdev:
7
+ # - logger
8
+ # :global:
9
+ # - yaml
10
+ #
11
+ ---
12
+ - :branch: core_lib
13
+ :environments:
14
+ :development: []
15
+ :global: []
16
+ :test: []
17
+ :qa: []
18
+ :production: []
@@ -0,0 +1,23 @@
1
+ # Directories that your application depends on
2
+ # You can add your own environments below. Requirements listed in
3
+ # the 'global' environment are always checked
4
+ # ---
5
+ # - :branch: directories
6
+ # :environments:
7
+ # :development: []
8
+ # :global:
9
+ # - /etc/nginx
10
+ # - /tmp
11
+ # - /mnt/media
12
+ # :test: []
13
+ # :qa: []
14
+ # :production: []
15
+
16
+ ---
17
+ :branch: directory
18
+ :environments:
19
+ :development: []
20
+ :global: []
21
+ :test: []
22
+ :qa: []
23
+ :production: []
@@ -0,0 +1,18 @@
1
+ # You can add your own environments below. Requirements listed in
2
+ # the 'global' environment are always checked
3
+
4
+ # Each environt takes an array of strings or hashes(source,target,md5)
5
+ # source is where it can be found
6
+ # target is where it should be
7
+ # md5 is the md5 the 'target' copy should hash to, this is optional and used by IntegrityResolver
8
+ # - /etc/nginx/nginx.conf
9
+ # - { target: "./public/this.txt", source: "http://example.com/index.html"}
10
+ # - { target: "file:///tmp/somefile.txt", source: "~/.secret/file.txt"}
11
+ ---
12
+ - :branch: file
13
+ :environments:
14
+ :development: []
15
+ :global: []
16
+ :test: []
17
+ :qa: []
18
+ :production: []
@@ -0,0 +1,26 @@
1
+ # Checks for and installs ruby gems
2
+ # You can add your own environments below. Requirements listed in
3
+ # the 'global' environment are always checked
4
+
5
+ # Each environment takes an array of hashes or strings, if a gem is a listed as a string
6
+ # it is assumed the version to install is the newest (>=0.0.0)
7
+
8
+ #---
9
+ #- :branch: gem
10
+ # :environments:
11
+ # :development: []
12
+ # :global:
13
+ # - {name: "rails", :version ">=2.0.0"}
14
+ # - image_science
15
+ # :test: []
16
+ # :qa: []
17
+ # :production: []
18
+
19
+ ---
20
+ - :branch: gem
21
+ :environments:
22
+ :development: []
23
+ :global: []
24
+ :test: []
25
+ :qa: []
26
+ :production: []
@@ -0,0 +1,29 @@
1
+ # You can add your own environments below. Requirements listed in
2
+ # the 'global' environment are always checked
3
+
4
+ # Manual resolvers are essentially glorified todo notes. Since WarningShot
5
+ # parses all yaml files into a dependency tree you can actually add manual resolvers
6
+ # to your other files, for example file.yml
7
+ #
8
+ # ---
9
+ # - :branch: file
10
+ # :environments:
11
+ # :development: []
12
+ # :global:
13
+ # - /etc/nginx/nginx.conf
14
+ #
15
+ # - :branch: manual
16
+ # :environments:
17
+ # :global:
18
+ # - "wash the dog"
19
+ # - "do dishes"
20
+ # - "finish deployment"
21
+
22
+ - :branch: manual
23
+ :environments:
24
+ :global:
25
+ - "Make sure you've updated your WarningShot config files for any new requirements!"
26
+ :development: []
27
+ :qa: []
28
+ :production: []
29
+ :test: []
@@ -0,0 +1,8 @@
1
+ ---
2
+ :branch: mounts
3
+ :environments:
4
+ :development: []
5
+ :global: []
6
+ :test: []
7
+ :qa: []
8
+ :production: []
@@ -0,0 +1,31 @@
1
+ # You can add your own environments below. Requirements listed in
2
+ # the 'global' environment are always checked
3
+
4
+ # Each environt takes an array hashes
5
+ # @param path [String] REQUIRED
6
+ # the path to check permissions
7
+ #
8
+ # @param mode [String] OPTIONAL; Default 0755
9
+ # MOde of file 0777, 0755, etc
10
+ #
11
+ # @param user [String] OPTIONAL; Default nobody
12
+ # User that should own resource
13
+ #
14
+ # @param group [STring] OPTIONAL; Default nobody
15
+ # Group that should own resource
16
+ #
17
+ # @param recursive [String] OPTIONAL; Default none
18
+ # What methods should be recursvie: 'chmod','chown','both','none'
19
+ #
20
+ # @example
21
+ # - { path: './public/images', mode: '0777', user: 'www-data', group: 'www-data'}
22
+ # - { path: '.', mode: '0755', user: 'www-data', group: 'www-data', recursive: "both"}
23
+ # - { path: '/tmp/app_cache/', mode: '0777', user: 'nobody', group: 'nobody' }
24
+ ---
25
+ - :branch: permission
26
+ :environments:
27
+ :global: []
28
+ :test: []
29
+ :production: []
30
+ :development: []
31
+ :qa: []
@@ -0,0 +1,30 @@
1
+ # You can add your own environments below. Requirements listed in
2
+ # the 'global' environment are always checked
3
+
4
+ #Symlink just check for the link to exist, not the target, the target should be specified in
5
+ # a FileResolver or DirectoryResolver
6
+
7
+ #No resolving is done if a source is not provided
8
+
9
+ # Options
10
+ # target - <String> the link
11
+ # source - <String> where the link should link to (ln -s source target)
12
+ # force - <Boolean> (default true) -f flag
13
+
14
+ # ---
15
+ # :localdev:
16
+ # - /my/path/to/symlink
17
+ # :global:
18
+ # - /another/great/symlink
19
+ # - { target: "/a/simple/resolution/example", source: "/the/path/to/the/goods", force: false}
20
+ # - { target: "/super/symlink", source: "/some/target/directory/"}
21
+ # - { target: "/etc/my/awesome.conf", source: "/etc/the/real.conf"}
22
+
23
+ ---
24
+ :branch: symlink
25
+ :environments:
26
+ :development: []
27
+ :global: []
28
+ :test: []
29
+ :qa: []
30
+ :production: []
@@ -0,0 +1,21 @@
1
+ # You can add your own environments below. Requirements listed in
2
+ # the 'global' environment are always checked
3
+ # ---
4
+ # - :branch: url
5
+ # :environments:
6
+ # :test: []
7
+ # :global:
8
+ # - "http://maps.google.com"
9
+ # - "http://microsoft.com" #jk dont depend on that
10
+ # :development: []
11
+ # :qa: []
12
+ # :production: []
13
+
14
+ ---
15
+ - :branch: url
16
+ :environments:
17
+ :test: []
18
+ :global: []
19
+ :development: []
20
+ :qa: []
21
+ :production: []
@@ -0,0 +1,16 @@
1
+ ---
2
+ - :branch: mock
3
+ :environments:
4
+ :rspec:
5
+ - { this: 'is this.yaml', that: 'is that.yaml' }
6
+ - { less: 'is less', more: 'is more' }
7
+ :global:
8
+ - { this_g: 'is this.global.yaml', that_g: 'is that.global.yaml' }
9
+ - { data: 'is raw', info: 'is processed' }
10
+ - { less: 'is more', more: 'is less' }
11
+ :development:
12
+
13
+ - :branch: faux
14
+ :environments:
15
+ :development:
16
+ - { this: 'is faux', that: 'is faux' }
@@ -0,0 +1,10 @@
1
+ ---
2
+ - :branch: mock
3
+ :environments:
4
+ :rspec:
5
+ - { something: 'is great', something_else: 'is better' }
6
+ - { this: 'is this.yml', that: 'is that.yml' }
7
+ :global:
8
+ - { this_g: 'is this.global.yml', that_g: 'is that.global.yml' }
9
+ - { data: 'is raw', info: 'is processed' }
10
+ - { less: 'is more', more: 'is less' }
@@ -0,0 +1,16 @@
1
+ class MockResolver
2
+ include WarningShot::Resolver
3
+
4
+ ######### Flags
5
+ disable!
6
+
7
+ ######### Attributes
8
+ order 1
9
+ branch :mock
10
+ description 'A mock resolver'
11
+
12
+ def initialize;end;
13
+
14
+ end
15
+
16
+ # TODO RENAME order to order
@@ -0,0 +1 @@
1
+ This file is used for testing the PermissionResolver
@@ -0,0 +1 @@
1
+ This is THAT file.