daemon-kit 0.1.7.12 → 0.1.8pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/History.txt +7 -0
  2. data/Manifest.txt +4 -0
  3. data/README.rdoc +11 -9
  4. data/Rakefile +0 -1
  5. data/TODO.txt +1 -2
  6. data/bin/daemon-kit +11 -11
  7. data/daemon-kit.gemspec +109 -78
  8. data/lib/daemon_kit.rb +7 -10
  9. data/lib/daemon_kit/abstract_logger.rb +22 -14
  10. data/lib/daemon_kit/application.rb +0 -1
  11. data/lib/daemon_kit/arguments.rb +1 -6
  12. data/lib/daemon_kit/commands/destroy.rb +10 -0
  13. data/lib/daemon_kit/commands/generate.rb +10 -0
  14. data/lib/daemon_kit/config.rb +7 -2
  15. data/lib/daemon_kit/generators.rb +67 -0
  16. data/lib/daemon_kit/generators/base.rb +60 -0
  17. data/lib/daemon_kit/initializer.rb +1 -1
  18. data/lib/daemon_kit/jabber.rb +1 -0
  19. data/lib/daemon_kit/tasks/framework.rake +6 -1
  20. data/lib/daemon_kit/vendor/thor-0.12.3/CHANGELOG.rdoc +80 -0
  21. data/lib/daemon_kit/vendor/thor-0.12.3/LICENSE +20 -0
  22. data/lib/daemon_kit/vendor/thor-0.12.3/README.rdoc +234 -0
  23. data/lib/daemon_kit/vendor/thor-0.12.3/Thorfile +64 -0
  24. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor.rb +242 -0
  25. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions.rb +274 -0
  26. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/create_file.rb +103 -0
  27. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/directory.rb +91 -0
  28. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/empty_directory.rb +134 -0
  29. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/file_manipulation.rb +223 -0
  30. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/inject_into_file.rb +101 -0
  31. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/base.rb +515 -0
  32. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/core_ext/file_binary_read.rb +9 -0
  33. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  34. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/core_ext/ordered_hash.rb +100 -0
  35. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/error.rb +27 -0
  36. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/group.rb +271 -0
  37. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/invocation.rb +178 -0
  38. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser.rb +4 -0
  39. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/argument.rb +67 -0
  40. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/arguments.rb +145 -0
  41. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/option.rb +132 -0
  42. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/options.rb +142 -0
  43. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/rake_compat.rb +66 -0
  44. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/runner.rb +303 -0
  45. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/shell.rb +78 -0
  46. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/shell/basic.rb +239 -0
  47. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/shell/color.rb +108 -0
  48. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/task.rb +111 -0
  49. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/util.rb +233 -0
  50. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/version.rb +3 -0
  51. data/lib/daemon_kit/xmpp.rb +75 -6
  52. data/{daemon_generators → lib/generators/daemon_kit}/amqp/USAGE +0 -0
  53. data/lib/generators/daemon_kit/amqp/amqp_generator.rb +24 -0
  54. data/{daemon_generators → lib/generators/daemon_kit}/amqp/templates/config/amqp.yml +0 -0
  55. data/{daemon_generators/amqp/templates/config/initializers → lib/generators/daemon_kit/amqp/templates/config/pre-daemonize}/amqp.rb +0 -0
  56. data/{daemon_generators/amqp/templates/libexec/daemon.rb → lib/generators/daemon_kit/amqp/templates/libexec/%app_name%-daemon.rb} +0 -0
  57. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/USAGE +0 -0
  58. data/lib/generators/daemon_kit/app/app_generator.rb +140 -0
  59. data/lib/generators/daemon_kit/app/templates/Gemfile +8 -0
  60. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/README +0 -0
  61. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/Rakefile +0 -0
  62. data/lib/generators/daemon_kit/app/templates/bin/daemon.tt +7 -0
  63. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/arguments.rb +0 -0
  64. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/boot.rb +10 -3
  65. data/{app_generators/daemon_kit/templates/config/environment.rb → lib/generators/daemon_kit/app/templates/config/environment.rb.tt} +1 -1
  66. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/environments/development.rb +0 -0
  67. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/environments/production.rb +0 -0
  68. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/environments/test.rb +0 -0
  69. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/post-daemonize/readme +0 -0
  70. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/pre-daemonize/readme +0 -0
  71. data/{app_generators/daemon_kit/templates/lib/daemon.rb → lib/generators/daemon_kit/app/templates/lib/%app_name%.rb} +0 -0
  72. data/{app_generators/daemon_kit/templates/libexec/daemon.erb → lib/generators/daemon_kit/app/templates/libexec/%app_name%-daemon.rb} +0 -0
  73. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/script/console +0 -0
  74. data/lib/generators/daemon_kit/app/templates/script/destroy +2 -0
  75. data/lib/generators/daemon_kit/app/templates/script/generate +2 -0
  76. data/lib/generators/daemon_kit/capistrano/capistrano_generator.rb +21 -0
  77. data/{daemon_generators/deploy_capistrano → lib/generators/daemon_kit/capistrano}/templates/Capfile +0 -0
  78. data/{daemon_generators/deploy_capistrano → lib/generators/daemon_kit/capistrano}/templates/USAGE +0 -0
  79. data/{daemon_generators/deploy_capistrano/templates/config/deploy.rb → lib/generators/daemon_kit/capistrano/templates/config/deploy.rb.tt} +1 -1
  80. data/lib/generators/daemon_kit/capistrano/templates/config/deploy/production.rb.tt +6 -0
  81. data/lib/generators/daemon_kit/capistrano/templates/config/deploy/staging.rb.tt +6 -0
  82. data/{daemon_generators/deploy_capistrano → lib/generators/daemon_kit/capistrano}/templates/config/environments/staging.rb +0 -0
  83. data/{daemon_generators → lib/generators/daemon_kit}/cron/USAGE +0 -0
  84. data/lib/generators/daemon_kit/cron/cron_generator.rb +24 -0
  85. data/{daemon_generators/cron/templates/config/initializers → lib/generators/daemon_kit/cron/templates/config/pre-daemonize}/cron.rb +0 -0
  86. data/{daemon_generators/cron/templates/libexec/daemon.rb → lib/generators/daemon_kit/cron/templates/libexec/%app_name%-daemon.rb} +0 -0
  87. data/{daemon_generators → lib/generators/daemon_kit}/cucumber/USAGE +0 -0
  88. data/lib/generators/daemon_kit/cucumber/cucumber_generator.rb +45 -0
  89. data/{daemon_generators/cucumber/templates/cucumber_environment.rb → lib/generators/daemon_kit/cucumber/templates/config/environments/cucumber.rb} +0 -0
  90. data/lib/generators/daemon_kit/cucumber/templates/features/step_definitions/.empty_directory +0 -0
  91. data/{daemon_generators/cucumber/templates → lib/generators/daemon_kit/cucumber/templates/features/support}/env.rb +0 -0
  92. data/{daemon_generators/cucumber/templates → lib/generators/daemon_kit/cucumber/templates/script}/cucumber +1 -2
  93. data/{daemon_generators/cucumber/templates → lib/generators/daemon_kit/cucumber/templates/tasks}/cucumber.rake +0 -0
  94. data/{daemon_generators/jabber → lib/generators/daemon_kit/nanite_agent}/USAGE +0 -0
  95. data/lib/generators/daemon_kit/nanite_agent/nanite_agent_generator.rb +29 -0
  96. data/{daemon_generators → lib/generators/daemon_kit}/nanite_agent/templates/config/nanite.yml +0 -0
  97. data/{daemon_generators/nanite_agent/templates/config/initializers → lib/generators/daemon_kit/nanite_agent/templates/config/pre-daemonize}/nanite_agent.rb +0 -0
  98. data/{daemon_generators → lib/generators/daemon_kit}/nanite_agent/templates/lib/actors/sample.rb +0 -0
  99. data/{daemon_generators/nanite_agent/templates/libexec/daemon.rb → lib/generators/daemon_kit/nanite_agent/templates/libexec/%app_name%-daemon.rb} +0 -0
  100. data/{daemon_generators/nanite_agent → lib/generators/daemon_kit/rspec}/USAGE +0 -0
  101. data/lib/generators/daemon_kit/rspec/rspec_generator.rb +20 -0
  102. data/{daemon_generators/rspec/templates/spec.rb → lib/generators/daemon_kit/rspec/templates/spec/%app_name%_spec.rb} +0 -0
  103. data/{daemon_generators → lib/generators/daemon_kit}/rspec/templates/spec/spec.opts +0 -0
  104. data/{daemon_generators → lib/generators/daemon_kit}/rspec/templates/spec/spec_helper.rb +0 -0
  105. data/{daemon_generators → lib/generators/daemon_kit}/rspec/templates/tasks/rspec.rake +0 -0
  106. data/{daemon_generators/rspec → lib/generators/daemon_kit/ruote}/USAGE +0 -0
  107. data/lib/generators/daemon_kit/ruote/ruote_generator.rb +29 -0
  108. data/{daemon_generators → lib/generators/daemon_kit}/ruote/templates/config/amqp.yml +0 -0
  109. data/{daemon_generators/ruote/templates/config/initializers → lib/generators/daemon_kit/ruote/templates/config/pre-daemonize}/ruote.rb +0 -0
  110. data/{daemon_generators → lib/generators/daemon_kit}/ruote/templates/config/ruote.yml +0 -0
  111. data/{daemon_generators/ruote/templates/lib/daemon.rb → lib/generators/daemon_kit/ruote/templates/lib/%app_name%.rb} +0 -0
  112. data/{daemon_generators → lib/generators/daemon_kit}/ruote/templates/lib/sample.rb +0 -0
  113. data/{daemon_generators/ruote/templates/libexec/daemon.rb → lib/generators/daemon_kit/ruote/templates/libexec/%app_name%-daemon.rb} +0 -0
  114. data/{daemon_generators/ruote → lib/generators/daemon_kit/test_unit}/USAGE +0 -0
  115. data/{daemon_generators → lib/generators/daemon_kit}/test_unit/templates/tasks/test_unit.rake +0 -0
  116. data/{daemon_generators/test_unit/templates/test/test.rb → lib/generators/daemon_kit/test_unit/templates/test/%app_name%_test.rb.tt} +1 -1
  117. data/{daemon_generators → lib/generators/daemon_kit}/test_unit/templates/test/test_helper.rb +0 -0
  118. data/lib/generators/daemon_kit/test_unit/test_unit_generator.rb +20 -0
  119. data/lib/generators/daemon_kit/xmpp/templates/config/pre-daemonize/xmpp.rb +6 -0
  120. data/{daemon_generators/jabber/templates/config/jabber.yml → lib/generators/daemon_kit/xmpp/templates/config/xmpp.yml} +5 -2
  121. data/lib/generators/daemon_kit/xmpp/templates/libexec/%app_name%-daemon.rb +27 -0
  122. data/lib/generators/daemon_kit/xmpp/xmpp_generator.rb +24 -0
  123. data/spec/argument_spec.rb +1 -1
  124. data/spec/config_spec.rb +7 -3
  125. metadata +110 -86
  126. data/app_generators/daemon_kit/daemon_kit_generator.rb +0 -178
  127. data/app_generators/daemon_kit/templates/bin/daemon.erb +0 -7
  128. data/app_generators/daemon_kit/templates/script/destroy +0 -14
  129. data/app_generators/daemon_kit/templates/script/generate +0 -14
  130. data/daemon_generators/amqp/amqp_generator.rb +0 -65
  131. data/daemon_generators/cron/cron_generator.rb +0 -64
  132. data/daemon_generators/cucumber/cucumber_generator.rb +0 -38
  133. data/daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb +0 -35
  134. data/daemon_generators/deploy_capistrano/templates/config/deploy/production.rb +0 -6
  135. data/daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb +0 -6
  136. data/daemon_generators/jabber/jabber_generator.rb +0 -65
  137. data/daemon_generators/jabber/templates/config/initializers/jabber.rb +0 -7
  138. data/daemon_generators/jabber/templates/libexec/daemon.rb +0 -27
  139. data/daemon_generators/nanite_agent/nanite_agent_generator.rb +0 -68
  140. data/daemon_generators/rspec/rspec_generator.rb +0 -55
  141. data/daemon_generators/ruote/ruote_generator.rb +0 -67
  142. data/daemon_generators/test_unit/USAGE +0 -5
  143. data/daemon_generators/test_unit/test_unit_generator.rb +0 -51
  144. data/test/test_jabber_generator.rb +0 -49
@@ -1,67 +0,0 @@
1
- class RuoteGenerator < RubiGen::Base
2
-
3
- default_options :author => nil
4
-
5
- attr_reader :name
6
-
7
- def initialize(runtime_args, runtime_options = {})
8
- super
9
- usage if args.empty?
10
- @name = args.shift
11
- extract_options
12
- end
13
-
14
- def manifest
15
- record do |m|
16
- # Ensure appropriate folder(s) exists
17
- m.directory ''
18
-
19
- # Create stubs
20
- # m.template "template.rb.erb", "some_file_after_erb.rb"
21
- # m.template_copy_each ["template.rb", "template2.rb"]
22
- # m.template_copy_each ["template.rb", "template2.rb"], "some/path"
23
- # m.file "file", "some_file_copied"
24
- # m.file_copy_each ["path/to/file", "path/to/file2"]
25
- # m.file_copy_each ["path/to/file", "path/to/file2"], "some/path"
26
-
27
- m.directory 'config'
28
- m.template 'config/amqp.yml', 'config/amqp.yml'
29
- m.template 'config/ruote.yml', 'config/ruote.yml'
30
- m.directory 'config/initializers'
31
- m.template 'config/initializers/ruote.rb', "config/initializers/#{name}.rb"
32
-
33
- m.directory 'lib'
34
- m.template 'lib/daemon.rb', "lib/#{name}.rb"
35
- m.template 'lib/sample.rb', 'lib/sample.rb'
36
- m.directory 'libexec'
37
- m.template 'libexec/daemon.rb', "libexec/#{name}-daemon.rb"
38
- end
39
- end
40
-
41
- protected
42
- def banner
43
- <<-EOS
44
- Creates a ...
45
-
46
- USAGE: #{$0} #{spec.name} name
47
- EOS
48
- end
49
-
50
- def add_options!(opts)
51
- # opts.separator ''
52
- # opts.separator 'Options:'
53
- # For each option below, place the default
54
- # at the top of the file next to "default_options"
55
- # opts.on("-a", "--author=\"Your Name\"", String,
56
- # "Some comment about this option",
57
- # "Default: none") { |o| options[:author] = o }
58
- # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
59
- end
60
-
61
- def extract_options
62
- # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
63
- # Templates can access these value via the attr_reader-generated methods, but not the
64
- # raw instance variable value.
65
- # @author = options[:author]
66
- end
67
- end
@@ -1,5 +0,0 @@
1
- Description:
2
-
3
-
4
- Usage:
5
-
@@ -1,51 +0,0 @@
1
- class TestUnitGenerator < RubiGen::Base
2
-
3
- attr_reader :gem_name, :module_name
4
-
5
- def initialize(runtime_args, runtime_options = {})
6
- super
7
- @destination_root = File.expand_path(destination_root)
8
- @gem_name = base_name
9
- @module_name = @gem_name.camelcase
10
- extract_options
11
- end
12
-
13
- def manifest
14
- record do |m|
15
- # Ensure appropriate folder(s) exists
16
- m.directory 'test'
17
- m.directory 'tasks'
18
-
19
- m.template 'test/test.rb', "test/#{gem_name}_test.rb"
20
- m.template_copy_each %w( test_helper.rb ), 'test'
21
- m.file_copy_each %w( test_unit.rake ), 'tasks'
22
- end
23
- end
24
-
25
- protected
26
- def banner
27
- <<-EOS
28
- Creates a ...
29
-
30
- USAGE: #{$0} #{spec.name} name
31
- EOS
32
- end
33
-
34
- def add_options!(opts)
35
- # opts.separator ''
36
- # opts.separator 'Options:'
37
- # For each option below, place the default
38
- # at the top of the file next to "default_options"
39
- # opts.on("-a", "--author=\"Your Name\"", String,
40
- # "Some comment about this option",
41
- # "Default: none") { |o| options[:author] = o }
42
- # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
43
- end
44
-
45
- def extract_options
46
- # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
47
- # Templates can access these value via the attr_reader-generated methods, but not the
48
- # raw instance variable value.
49
- # @author = options[:author]
50
- end
51
- end
@@ -1,49 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
-
3
-
4
- class TestJabberGenerator < 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('jabber', [name], sources)
32
- assert_directory_exists "config"
33
- assert_generated_file "config/jabber.yml"
34
- assert_directory_exists "config/initializers"
35
- assert_generated_file "config/initializers/myapp.rb"
36
- assert_directory_exists "libexec"
37
- assert_generated_file "libexec/myapp-daemon.rb"
38
- end
39
-
40
- private
41
- def sources
42
- [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
43
- ]
44
- end
45
-
46
- def generator_path
47
- "daemon_generators"
48
- end
49
- end