daemon-kit 0.2.3 → 0.3.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.travis.yml +15 -0
- data/Gemfile +1 -1
- data/History.txt +4 -0
- data/{README.rdoc → README.md} +43 -34
- data/Rakefile +1 -1
- data/bin/daemon-kit +4 -0
- data/daemon-kit.gemspec +6 -6
- data/features/amqp_generator.feature +27 -0
- data/features/app_generator.feature +46 -0
- data/features/capistrano_generator.feature +30 -0
- data/features/cron_generator.feature +26 -0
- data/features/ruote_generator.feature +27 -0
- data/features/sqs_generator.feature +21 -0
- data/features/step_definitions/daemon_steps.rb +10 -0
- data/features/support/env.rb +8 -0
- data/features/test_unit_generator.feature +18 -0
- data/lib/daemon_kit.rb +0 -1
- data/lib/daemon_kit/generators.rb +0 -1
- data/lib/daemon_kit/version.rb +1 -1
- data/lib/generators/daemon_kit/amqp/amqp_generator.rb +1 -1
- data/lib/generators/daemon_kit/app/app_generator.rb +1 -3
- data/lib/generators/daemon_kit/app/templates/script/destroy +1 -1
- data/lib/generators/daemon_kit/capistrano/capistrano_generator.rb +1 -1
- data/lib/generators/daemon_kit/cron/cron_generator.rb +1 -1
- data/lib/generators/daemon_kit/rspec/templates/spec/%app_name%_spec.rb +3 -3
- data/lib/generators/daemon_kit/ruote/ruote_generator.rb +4 -2
- data/lib/generators/daemon_kit/sqs/sqs_generator.rb +1 -1
- data/spec/abstract_logger_spec.rb +3 -3
- data/spec/spec_helper.rb +17 -9
- data/tasks/cucumber.rake +4 -11
- metadata +69 -82
- data/lib/daemon_kit/nanite.rb +0 -7
- data/lib/daemon_kit/nanite/agent.rb +0 -77
- data/lib/generators/daemon_kit/nanite_agent/USAGE +0 -5
- data/lib/generators/daemon_kit/nanite_agent/nanite_agent_generator.rb +0 -29
- data/lib/generators/daemon_kit/nanite_agent/templates/config/nanite.yml +0 -35
- data/lib/generators/daemon_kit/nanite_agent/templates/config/pre-daemonize/nanite_agent.rb +0 -6
- data/lib/generators/daemon_kit/nanite_agent/templates/lib/actors/sample.rb +0 -11
- data/lib/generators/daemon_kit/nanite_agent/templates/libexec/%app_name%-daemon.rb +0 -31
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -71
- data/tasks/tests.rake +0 -6
- data/test/test_amqp_generator.rb +0 -48
- data/test/test_cron_generator.rb +0 -45
- data/test/test_daemon-kit_generator.rb +0 -84
- data/test/test_daemon_kit_config.rb +0 -28
- data/test/test_deploy_capistrano_generator.rb +0 -48
- data/test/test_generator_helper.rb +0 -29
- data/test/test_helper.rb +0 -7
- data/test/test_nanite_agent_generator.rb +0 -49
- data/test/test_ruote_generator.rb +0 -51
- data/test/test_sqs_generator.rb +0 -48
- data/test/test_test_unit_generator.rb +0 -46
data/lib/daemon_kit/nanite.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
module Nanite
|
2
|
-
class Agent
|
3
|
-
|
4
|
-
attr_accessor :init_block
|
5
|
-
|
6
|
-
def load_actors_with_daemon_kit_changes( &block )
|
7
|
-
actors = @options[:actors]
|
8
|
-
Dir["#{DaemonKit.root}/lib/actors/*.rb"].each do |actor|
|
9
|
-
next if actors && !actors.include?( File.basename(actor, '.rb') )
|
10
|
-
Nanite::Log.info( "[setup] loading #{actor}" )
|
11
|
-
require actor
|
12
|
-
end
|
13
|
-
|
14
|
-
self.init_block.call( self )
|
15
|
-
end
|
16
|
-
|
17
|
-
alias_method :load_actors_without_daemon_kit_changes, :load_actors
|
18
|
-
alias_method :load_actors, :load_actors_with_daemon_kit_changes
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module DaemonKit
|
23
|
-
module Nanite
|
24
|
-
# Pull support into a daemon for being a nanite agent.
|
25
|
-
class Agent
|
26
|
-
|
27
|
-
@@instance = nil
|
28
|
-
|
29
|
-
class << self
|
30
|
-
|
31
|
-
def instance
|
32
|
-
@instance ||= new
|
33
|
-
end
|
34
|
-
|
35
|
-
private :new
|
36
|
-
|
37
|
-
def run(&block)
|
38
|
-
instance.run(&block)
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
def initialize
|
44
|
-
@config = DaemonKit::Config.load( 'nanite' ).to_h( true )
|
45
|
-
|
46
|
-
config_agent
|
47
|
-
end
|
48
|
-
|
49
|
-
def run(&block)
|
50
|
-
# Ensure graceful shutdown of the connection to the broker
|
51
|
-
DaemonKit.trap('INT') { ::EM.stop }
|
52
|
-
DaemonKit.trap('TERM') { ::EM.stop }
|
53
|
-
::Nanite::Log.logger = DaemonKit.logger
|
54
|
-
|
55
|
-
# Start our mapper
|
56
|
-
mapper_thread = Thread.new do
|
57
|
-
EM.run do
|
58
|
-
agent = ::Nanite::Agent.new( @config )
|
59
|
-
agent.init_block = block
|
60
|
-
agent.run
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
mapper_thread.join
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
# Make sure to fine tune the agent config to be DK friendly
|
70
|
-
def config_agent
|
71
|
-
@config[:root] = DAEMON_ROOT
|
72
|
-
@config[:daemonize] = false
|
73
|
-
@config[:actors_dir] = File.join(DAEMON_ROOT, 'lib', 'actors')
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module DaemonKit
|
2
|
-
module Generators
|
3
|
-
class NaniteAgentGenerator < Base
|
4
|
-
|
5
|
-
def update_gemfile
|
6
|
-
append_file 'Gemfile', "gem 'nanite'\n"
|
7
|
-
end
|
8
|
-
|
9
|
-
def create_config
|
10
|
-
directory 'config'
|
11
|
-
end
|
12
|
-
|
13
|
-
def create_actors
|
14
|
-
directory 'lib'
|
15
|
-
end
|
16
|
-
|
17
|
-
def create_libexec
|
18
|
-
directory 'libexec'
|
19
|
-
end
|
20
|
-
|
21
|
-
protected
|
22
|
-
|
23
|
-
def self.source_root
|
24
|
-
File.expand_path( File.join( File.dirname(__FILE__), 'templates') )
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# Nanite agent configuration file
|
2
|
-
|
3
|
-
# These values will be used to configure the nanite agent, any values
|
4
|
-
# omitted will let the gem use it's own defaults.
|
5
|
-
|
6
|
-
# The configuration specifies the following keys:
|
7
|
-
# * user - Specify the rabbitmq username
|
8
|
-
# * pass - Specify the rabbitmq password
|
9
|
-
# * host - Specify the rabbitmq hostname
|
10
|
-
# * vhost - Specify the rabbitmq vhost
|
11
|
-
# * port - Specify the rabbitmq PORT, default 5672
|
12
|
-
# * token - Specify the agent identity
|
13
|
-
# * security - Use Security features of rabbitmq to restrict nanites to themselves
|
14
|
-
# * format - The serialization type to use for transfering data. Can be marshal, json or yaml. Default is marshal
|
15
|
-
# * tag - YAML array of tags
|
16
|
-
# * ping-time - Specify how often the agents contacts the mapper
|
17
|
-
# * actors - Comma separated list of actors to load (all ruby files in actors directory by default)
|
18
|
-
|
19
|
-
defaults: &defaults
|
20
|
-
user: nanite
|
21
|
-
pass: testing
|
22
|
-
host: localhost
|
23
|
-
vhost: /nanite
|
24
|
-
# tag:
|
25
|
-
# - foo
|
26
|
-
# - bar
|
27
|
-
|
28
|
-
development:
|
29
|
-
<<: *defaults
|
30
|
-
|
31
|
-
test:
|
32
|
-
<<: *defaults
|
33
|
-
|
34
|
-
production:
|
35
|
-
<<: *defaults
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# Generated nanite agent daemon
|
2
|
-
|
3
|
-
# Do your post daemonization configuration here
|
4
|
-
# At minimum you need just the first line (without the block), or a lot
|
5
|
-
# of strange things might start happening...
|
6
|
-
DaemonKit::Application.running! do |config|
|
7
|
-
# Trap signals with blocks or procs
|
8
|
-
# config.trap( 'INT' ) do
|
9
|
-
# # do something clever
|
10
|
-
# end
|
11
|
-
# config.trap( 'TERM', Proc.new { puts 'Going down' } )
|
12
|
-
end
|
13
|
-
|
14
|
-
# IMPORTANT CONFIGURATION NOTE
|
15
|
-
#
|
16
|
-
# Please review and update 'config/nanite.yml' accordingly or this
|
17
|
-
# daemon won't work as advertised.
|
18
|
-
#
|
19
|
-
# Your actors live in DAEMON_ROOT/lib/actors
|
20
|
-
|
21
|
-
# Run the agent, and get the running agent.
|
22
|
-
DaemonKit::Nanite::Agent.run do |agent|
|
23
|
-
# Use the yielded agent instance to register your actors:
|
24
|
-
agent.register Sample.new
|
25
|
-
|
26
|
-
# This block can used to make your agent perform other tasks as
|
27
|
-
# well. Remember that you have access to a running EventMachine
|
28
|
-
# reactor since the AMQP gem used by nanite uses it. Other than that
|
29
|
-
# you can mostly leave this file alone and concentrate on developing
|
30
|
-
# your actors in the lib/actors/ directory of the project.
|
31
|
-
end
|
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/daemon-kit.rb'}"
|
9
|
-
puts "Loading daemon-kit gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/script/txt2html
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
load File.dirname(__FILE__) + "/../Rakefile"
|
4
|
-
require 'rubyforge'
|
5
|
-
require 'redcloth'
|
6
|
-
require 'syntax/convertors/html'
|
7
|
-
require 'erb'
|
8
|
-
|
9
|
-
download = "http://rubyforge.org/projects/#{$hoe.rubyforge_name}"
|
10
|
-
version = $hoe.version
|
11
|
-
|
12
|
-
def rubyforge_project_id
|
13
|
-
RubyForge.new.configure.autoconfig["group_ids"][$hoe.rubyforge_name]
|
14
|
-
end
|
15
|
-
|
16
|
-
class Fixnum
|
17
|
-
def ordinal
|
18
|
-
# teens
|
19
|
-
return 'th' if (10..19).include?(self % 100)
|
20
|
-
# others
|
21
|
-
case self % 10
|
22
|
-
when 1: return 'st'
|
23
|
-
when 2: return 'nd'
|
24
|
-
when 3: return 'rd'
|
25
|
-
else return 'th'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class Time
|
31
|
-
def pretty
|
32
|
-
return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def convert_syntax(syntax, source)
|
37
|
-
return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
|
38
|
-
end
|
39
|
-
|
40
|
-
if ARGV.length >= 1
|
41
|
-
src, template = ARGV
|
42
|
-
template ||= File.join(File.dirname(__FILE__), '/../website/template.html.erb')
|
43
|
-
else
|
44
|
-
puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
|
45
|
-
exit!
|
46
|
-
end
|
47
|
-
|
48
|
-
template = ERB.new(File.open(template).read)
|
49
|
-
|
50
|
-
title = nil
|
51
|
-
body = nil
|
52
|
-
File.open(src) do |fsrc|
|
53
|
-
title_text = fsrc.readline
|
54
|
-
body_text_template = fsrc.read
|
55
|
-
body_text = ERB.new(body_text_template).result(binding)
|
56
|
-
syntax_items = []
|
57
|
-
body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
|
58
|
-
ident = syntax_items.length
|
59
|
-
element, syntax, source = $1, $2, $3
|
60
|
-
syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
|
61
|
-
"syntax-temp-#{ident}"
|
62
|
-
}
|
63
|
-
title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
|
64
|
-
body = RedCloth.new(body_text).to_html
|
65
|
-
body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
|
66
|
-
end
|
67
|
-
stat = File.stat(src)
|
68
|
-
created = stat.ctime
|
69
|
-
modified = stat.mtime
|
70
|
-
|
71
|
-
$stdout << template.result(binding)
|
data/tasks/tests.rake
DELETED
data/test/test_amqp_generator.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
-
|
3
|
-
|
4
|
-
class TestAmqpGenerator < Test::Unit::TestCase
|
5
|
-
include RubiGen::GeneratorTestHelper
|
6
|
-
|
7
|
-
def setup
|
8
|
-
bare_setup
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
bare_teardown
|
13
|
-
end
|
14
|
-
|
15
|
-
# Some generator-related assertions:
|
16
|
-
# assert_generated_file(name, &block) # block passed the file contents
|
17
|
-
# assert_directory_exists(name)
|
18
|
-
# assert_generated_class(name, &block)
|
19
|
-
# assert_generated_module(name, &block)
|
20
|
-
# assert_generated_test_for(name, &block)
|
21
|
-
# The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
|
22
|
-
# assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
|
23
|
-
#
|
24
|
-
# Other helper methods are:
|
25
|
-
# app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
|
26
|
-
# bare_setup - place this in setup method to create the APP_ROOT folder for each test
|
27
|
-
# bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
|
28
|
-
|
29
|
-
def test_generator_without_options
|
30
|
-
name = "myapp"
|
31
|
-
run_generator('amqp', [name], sources)
|
32
|
-
assert_directory_exists "config"
|
33
|
-
assert_directory_exists "config/initializers"
|
34
|
-
assert_generated_file "config/amqp.yml"
|
35
|
-
assert_generated_file "config/initializers/myapp.rb"
|
36
|
-
assert_generated_file "libexec/myapp-daemon.rb"
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
def sources
|
41
|
-
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
42
|
-
]
|
43
|
-
end
|
44
|
-
|
45
|
-
def generator_path
|
46
|
-
"daemon_generators"
|
47
|
-
end
|
48
|
-
end
|
data/test/test_cron_generator.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
-
|
3
|
-
|
4
|
-
class TestCronGenerator < Test::Unit::TestCase
|
5
|
-
include RubiGen::GeneratorTestHelper
|
6
|
-
|
7
|
-
def setup
|
8
|
-
bare_setup
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
bare_teardown
|
13
|
-
end
|
14
|
-
|
15
|
-
# Some generator-related assertions:
|
16
|
-
# assert_generated_file(name, &block) # block passed the file contents
|
17
|
-
# assert_directory_exists(name)
|
18
|
-
# assert_generated_class(name, &block)
|
19
|
-
# assert_generated_module(name, &block)
|
20
|
-
# assert_generated_test_for(name, &block)
|
21
|
-
# The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
|
22
|
-
# assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
|
23
|
-
#
|
24
|
-
# Other helper methods are:
|
25
|
-
# app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
|
26
|
-
# bare_setup - place this in setup method to create the APP_ROOT folder for each test
|
27
|
-
# bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
|
28
|
-
|
29
|
-
def test_generator_without_options
|
30
|
-
name = "myapp"
|
31
|
-
run_generator('cron', [name], sources)
|
32
|
-
assert_directory_exists "config/initializers"
|
33
|
-
assert_generated_file "config/initializers/myapp.rb"
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
def sources
|
38
|
-
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
39
|
-
]
|
40
|
-
end
|
41
|
-
|
42
|
-
def generator_path
|
43
|
-
"daemon_generators"
|
44
|
-
end
|
45
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
-
|
3
|
-
class TestDaemonKitGenerator < Test::Unit::TestCase
|
4
|
-
include RubiGen::GeneratorTestHelper
|
5
|
-
|
6
|
-
attr_reader :daemon_name
|
7
|
-
def setup
|
8
|
-
bare_setup
|
9
|
-
@daemon_name = File.basename(File.expand_path(APP_ROOT))
|
10
|
-
end
|
11
|
-
|
12
|
-
def teardown
|
13
|
-
bare_teardown
|
14
|
-
end
|
15
|
-
|
16
|
-
# Some generator-related assertions:
|
17
|
-
# assert_generated_file(name, &block) # block passed the file contents
|
18
|
-
# assert_directory_exists(name)
|
19
|
-
# assert_generated_class(name, &block)
|
20
|
-
# assert_generated_module(name, &block)
|
21
|
-
# assert_generated_test_for(name, &block)
|
22
|
-
# The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
|
23
|
-
# assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
|
24
|
-
#
|
25
|
-
# Other helper methods are:
|
26
|
-
# app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
|
27
|
-
# bare_setup - place this in setup method to create the APP_ROOT folder for each test
|
28
|
-
# bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
|
29
|
-
|
30
|
-
def test_generator_without_options
|
31
|
-
run_generator('daemon_kit', [APP_ROOT], sources)
|
32
|
-
|
33
|
-
assert_generated_file "README"
|
34
|
-
assert_generated_file "Rakefile"
|
35
|
-
assert_directory_exists "bin"
|
36
|
-
assert_generated_file "bin/#{daemon_name}"
|
37
|
-
assert_directory_exists "config"
|
38
|
-
assert_generated_file "config/arguments.rb"
|
39
|
-
assert_generated_file "config/boot.rb"
|
40
|
-
assert_generated_file "config/environment.rb"
|
41
|
-
assert_generated_file "config/environments/development.rb"
|
42
|
-
assert_generated_file "config/environments/test.rb"
|
43
|
-
assert_generated_file "config/environments/production.rb"
|
44
|
-
assert_directory_exists "config/pre-daemonize"
|
45
|
-
assert_generated_file "config/pre-daemonize/readme"
|
46
|
-
assert_directory_exists "config/post-daemonize"
|
47
|
-
assert_generated_file "config/post-daemonize/readme"
|
48
|
-
assert_directory_exists "lib"
|
49
|
-
assert_generated_file "lib/#{daemon_name}.rb"
|
50
|
-
assert_directory_exists "libexec"
|
51
|
-
assert_generated_file "libexec/#{daemon_name}-daemon.rb"
|
52
|
-
assert_directory_exists "log"
|
53
|
-
assert_directory_exists "script"
|
54
|
-
assert_generated_file "script/console"
|
55
|
-
assert_generated_file "script/destroy"
|
56
|
-
assert_generated_file "script/generate"
|
57
|
-
assert_directory_exists "spec"
|
58
|
-
assert_directory_exists "tasks"
|
59
|
-
assert_directory_exists "vendor"
|
60
|
-
assert_directory_exists "tmp"
|
61
|
-
|
62
|
-
assert !File.exists?("#{APP_ROOT}/Capfile"), 'Capfile generated, but should not be'
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_generator_with_capistrano_deployer
|
66
|
-
run_generator('daemon_kit', [APP_ROOT, '-d capistrano'], sources)
|
67
|
-
|
68
|
-
assert_generated_file "Capfile"
|
69
|
-
assert_generated_file "config/deploy.rb"
|
70
|
-
end
|
71
|
-
|
72
|
-
private
|
73
|
-
def sources
|
74
|
-
[
|
75
|
-
RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path)),
|
76
|
-
RubiGen::PathSource.new(:app, File.join(File.dirname(__FILE__), "..", "daemon_generators")),
|
77
|
-
RubiGen::PathSource.new(:app, File.join(File.dirname(__FILE__), "..", "rubygems_generators"))
|
78
|
-
]
|
79
|
-
end
|
80
|
-
|
81
|
-
def generator_path
|
82
|
-
"app_generators"
|
83
|
-
end
|
84
|
-
end
|