init 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.semver +5 -0
- data/History.txt +12 -0
- data/Manifest.txt +8 -4
- data/README.rdoc +19 -7
- data/Rakefile +15 -9
- data/examples/mongrel.rb +52 -0
- data/examples/murmur.rb +5 -5
- data/init.gemspec +47 -0
- data/lib/{init.rb → aef/init.rb} +6 -5
- data/lib/{init → aef/init}/init.rb +3 -5
- data/spec/bin/mock_daemon.rb +1 -1
- data/spec/bin/simple_init.rb +4 -7
- data/spec/init_spec.rb +31 -52
- data/spec/spec_helper.rb +49 -0
- metadata +86 -26
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/.semver
ADDED
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 1.1.0 / 2010-10-04
|
2
|
+
|
3
|
+
* 3 minor enhancements
|
4
|
+
|
5
|
+
* Pathname library required by default
|
6
|
+
* semver gem is used to define the version
|
7
|
+
* Specs heavily improved
|
8
|
+
|
9
|
+
* 1 minor bugfix
|
10
|
+
|
11
|
+
* Files are now correctly namespaced
|
12
|
+
|
1
13
|
=== 1.0.0 / 2009-03-25
|
2
14
|
|
3
15
|
* 1 major enhancement
|
data/Manifest.txt
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
+
.semver
|
2
|
+
COPYING.txt
|
1
3
|
History.txt
|
2
4
|
Manifest.txt
|
3
5
|
README.rdoc
|
4
|
-
COPYING.txt
|
5
6
|
Rakefile
|
6
|
-
|
7
|
-
lib/init/init.rb
|
7
|
+
examples/mongrel.rb
|
8
8
|
examples/murmur.rb
|
9
|
-
|
9
|
+
init.gemspec
|
10
|
+
lib/aef/init.rb
|
11
|
+
lib/aef/init/init.rb
|
10
12
|
spec/bin/mock_daemon.rb
|
11
13
|
spec/bin/simple_init.rb
|
14
|
+
spec/init_spec.rb
|
15
|
+
spec/spec_helper.rb
|
data/README.rdoc
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
= Init
|
2
2
|
|
3
3
|
* Project: https://rubyforge.org/projects/aef/
|
4
|
+
* RDoc: http://rdoc.info/projects/aef/init/
|
4
5
|
* RDoc: http://aef.rubyforge.org/init/
|
5
6
|
* Github: http://github.com/aef/init/
|
6
7
|
|
@@ -11,13 +12,23 @@ Clean and simple *nix init scripts with Ruby
|
|
11
12
|
== FEATURES/PROBLEMS:
|
12
13
|
|
13
14
|
* Tested and fully working on:
|
14
|
-
* Ubuntu Linux
|
15
|
-
|
15
|
+
* Ubuntu Linux 9.10 (Karmic Koala) on x86_64
|
16
|
+
* Ruby 1.8.7
|
17
|
+
* Ruby 1.9.2
|
18
|
+
* JRuby 1.5.3
|
19
|
+
* Debian GNU/Linux 4.0 (Lenny) on x86
|
20
|
+
* Ruby 1.8.7
|
21
|
+
* Ruby 1.9.2
|
22
|
+
* JRuby 1.5.3
|
16
23
|
|
17
24
|
== SYNOPSIS:
|
18
25
|
|
19
|
-
|
20
|
-
|
26
|
+
Load the library:
|
27
|
+
|
28
|
+
require 'aef/init'
|
29
|
+
|
30
|
+
Simply subclass Aef::Init and define at least a start and a stop method. At the
|
31
|
+
end, call the parse method on that class.
|
21
32
|
|
22
33
|
class DemoSubclass < Aef::Init
|
23
34
|
def start
|
@@ -70,16 +81,17 @@ class between Init and the final implementation:
|
|
70
81
|
...
|
71
82
|
end
|
72
83
|
|
73
|
-
See examples
|
84
|
+
See the examples folder and spec/bin/simple_ini.rb for working example classes.
|
74
85
|
|
75
86
|
== REQUIREMENTS:
|
76
87
|
|
77
88
|
* rubygems
|
89
|
+
* semver
|
78
90
|
|
79
91
|
=== Additional for automated testing
|
80
92
|
* hoe
|
81
93
|
* rspec
|
82
|
-
*
|
94
|
+
* facets
|
83
95
|
|
84
96
|
== INSTALL:
|
85
97
|
|
@@ -146,7 +158,7 @@ to include your changes before reviewing them.
|
|
146
158
|
|
147
159
|
== LICENSE:
|
148
160
|
|
149
|
-
Copyright
|
161
|
+
Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2010
|
150
162
|
|
151
163
|
This file is part of Init.
|
152
164
|
|
data/Rakefile
CHANGED
@@ -2,16 +2,22 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hoe'
|
5
|
-
require '
|
5
|
+
require 'semver'
|
6
6
|
|
7
|
-
Hoe.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
Hoe.spec 'init' do |p|
|
8
|
+
developer('Alexander E. Fischer', 'aef@raxys.net')
|
9
|
+
|
10
|
+
extra_deps << ['semver', '>= 0.2.2']
|
11
|
+
|
12
|
+
extra_dev_deps << ['rspec', '>= 1.3.0']
|
13
|
+
extra_dev_deps << ['facets', '>= 2.8.4']
|
14
|
+
|
15
|
+
self.version = SemVer.find.format '%M.%m.%p'
|
16
|
+
self.rubyforge_name = 'aef'
|
17
|
+
self.url = 'https://rubyforge.org/projects/aef/'
|
18
|
+
self.readme_file = 'README.rdoc'
|
19
|
+
self.extra_rdoc_files = %w{README.rdoc}
|
20
|
+
self.spec_extras = {
|
15
21
|
:rdoc_options => ['--main', 'README.rdoc', '--inline-source', '--line-numbers', '--title', 'Init']
|
16
22
|
}
|
17
23
|
end
|
data/examples/mongrel.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2010
|
4
|
+
#
|
5
|
+
# This file is part of Init.
|
6
|
+
#
|
7
|
+
# Init is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'aef/init'
|
21
|
+
|
22
|
+
class Mongrel < Aef::Init
|
23
|
+
BASE_DIR = Pathname('/srv/rails')
|
24
|
+
APPS = {
|
25
|
+
'my_project' => 8000,
|
26
|
+
'demo_app' => 8001
|
27
|
+
}
|
28
|
+
|
29
|
+
stop_start_delay 3
|
30
|
+
|
31
|
+
# An implementation of the start method
|
32
|
+
def start
|
33
|
+
APPS.each do |app_name, port|
|
34
|
+
puts "Starting #{app_name} on #{port}..."
|
35
|
+
`mongrel_rails start -d -p #{port} -e production -c #{BASE_DIR + app_name} -P log/mongrel.pid`
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# An implementation of the stop method
|
40
|
+
def stop
|
41
|
+
APPS.each do |app_name, port|
|
42
|
+
puts "Stopping #{app_name}..."
|
43
|
+
`mongrel_rails stop -c #{BASE_DIR + app_name} -P log/mongrel.pid`
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# The parser is only executed if the script is executed as a program, never
|
49
|
+
# when the script is required in a ruby program
|
50
|
+
if __FILE__ == $PROGRAM_NAME
|
51
|
+
Mongrel.parse
|
52
|
+
end
|
data/examples/murmur.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright
|
3
|
+
# Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2010
|
4
4
|
#
|
5
5
|
# This file is part of Init.
|
6
6
|
#
|
@@ -17,13 +17,13 @@
|
|
17
17
|
# You should have received a copy of the GNU General Public License
|
18
18
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
|
-
require 'init'
|
20
|
+
require 'aef/init'
|
21
21
|
|
22
22
|
# An example init script for the voice chat application Murmur
|
23
23
|
class Murmur < Aef::Init
|
24
|
-
PATH = '/opt/murmur'
|
25
|
-
DAEMON =
|
26
|
-
PIDFILE = '/var/run/murmur/murmur.pid'
|
24
|
+
PATH = Pathname('/opt/murmur')
|
25
|
+
DAEMON = PATH + 'murmur.x86'
|
26
|
+
PIDFILE = Pathname('/var/run/murmur/murmur.pid')
|
27
27
|
USER = 'mumble'
|
28
28
|
|
29
29
|
# Defines the seconds to wait between stop and start in the predefined restart
|
data/init.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{init}
|
5
|
+
s.version = "1.1.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Alexander E. Fischer"]
|
9
|
+
s.cert_chain = ["/home/dimedo/.gem/gem-public_cert.pem"]
|
10
|
+
s.date = %q{2010-10-04}
|
11
|
+
s.description = %q{Clean and simple *nix init scripts with Ruby}
|
12
|
+
s.email = ["aef@raxys.net"]
|
13
|
+
s.extra_rdoc_files = ["COPYING.txt", "History.txt", "Manifest.txt", "README.rdoc"]
|
14
|
+
s.files = [".semver", "COPYING.txt", "History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "examples/mongrel.rb", "examples/murmur.rb", "init.gemspec", "lib/aef/init.rb", "lib/aef/init/init.rb", "spec/bin/mock_daemon.rb", "spec/bin/simple_init.rb", "spec/init_spec.rb", "spec/spec_helper.rb"]
|
15
|
+
s.homepage = %q{https://rubyforge.org/projects/aef/}
|
16
|
+
s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--line-numbers", "--title", "Init"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{aef}
|
19
|
+
s.rubygems_version = %q{1.3.7}
|
20
|
+
s.signing_key = %q{/home/dimedo/.gem/gem-private_key.pem}
|
21
|
+
s.summary = %q{Clean and simple *nix init scripts with Ruby}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 3
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
28
|
+
s.add_runtime_dependency(%q<semver>, [">= 0.2.2"])
|
29
|
+
s.add_development_dependency(%q<rubyforge>, [">= 2.0.4"])
|
30
|
+
s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
|
31
|
+
s.add_development_dependency(%q<facets>, [">= 2.8.4"])
|
32
|
+
s.add_development_dependency(%q<hoe>, [">= 2.6.2"])
|
33
|
+
else
|
34
|
+
s.add_dependency(%q<semver>, [">= 0.2.2"])
|
35
|
+
s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
|
36
|
+
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
37
|
+
s.add_dependency(%q<facets>, [">= 2.8.4"])
|
38
|
+
s.add_dependency(%q<hoe>, [">= 2.6.2"])
|
39
|
+
end
|
40
|
+
else
|
41
|
+
s.add_dependency(%q<semver>, [">= 0.2.2"])
|
42
|
+
s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
|
43
|
+
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
44
|
+
s.add_dependency(%q<facets>, [">= 2.8.4"])
|
45
|
+
s.add_dependency(%q<hoe>, [">= 2.6.2"])
|
46
|
+
end
|
47
|
+
end
|
data/lib/{init.rb → aef/init.rb}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2010
|
2
2
|
#
|
3
3
|
# This file is part of Init.
|
4
4
|
#
|
@@ -15,6 +15,10 @@
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
16
16
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
+
require 'rubygems'
|
19
|
+
require 'pathname'
|
20
|
+
require 'semver'
|
21
|
+
|
18
22
|
# Namespace for projects of Alexander E. Fischer <aef@raxys.net>
|
19
23
|
#
|
20
24
|
# If you want to be able to simply type Example instead of Aef::Example to
|
@@ -23,8 +27,5 @@
|
|
23
27
|
#
|
24
28
|
# include Aef
|
25
29
|
module Aef
|
26
|
-
|
30
|
+
autoload :Init, 'aef/init/init'
|
27
31
|
end
|
28
|
-
|
29
|
-
libdir = File.dirname(__FILE__)
|
30
|
-
require File.join(libdir, 'init/init')
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2010
|
2
2
|
#
|
3
3
|
# This file is part of Init.
|
4
4
|
#
|
@@ -15,11 +15,9 @@
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
16
16
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
|
-
|
20
18
|
# Clean and simple *nix init scripts with Ruby
|
21
19
|
class Aef::Init
|
22
|
-
VERSION =
|
20
|
+
VERSION = SemVer.find
|
23
21
|
|
24
22
|
# Call this to begin commandline parsing
|
25
23
|
#
|
@@ -43,7 +41,7 @@ class Aef::Init
|
|
43
41
|
# This is neccessary because since ruby 1.9, the instance_methods method
|
44
42
|
# returns an array of symbols instead of an array of strings which it did
|
45
43
|
# in 1.8
|
46
|
-
command = command.to_sym if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('1.9')
|
44
|
+
command = command.to_sym if Gem::Version.new("#{RUBY_VERSION}") >= Gem::Version.new('1.9')
|
47
45
|
|
48
46
|
if command == :default
|
49
47
|
new.send(@@default_command)
|
data/spec/bin/mock_daemon.rb
CHANGED
data/spec/bin/simple_init.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright
|
3
|
+
# Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2010
|
4
4
|
#
|
5
5
|
# This file is part of Init.
|
6
6
|
#
|
@@ -17,12 +17,12 @@
|
|
17
17
|
# You should have received a copy of the GNU General Public License
|
18
18
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
|
20
|
-
require '
|
20
|
+
require 'aef/init'
|
21
21
|
|
22
22
|
# A library in between the base and the final class
|
23
23
|
class MiddleInit < Aef::Init
|
24
|
-
|
25
|
-
MOCK_EXECUTABLE = "#{
|
24
|
+
INTERPRETER = Pathname(RbConfig::CONFIG['bindir']) + RbConfig::CONFIG['ruby_install_name']
|
25
|
+
MOCK_EXECUTABLE = "#{INTERPRETER} spec/bin/mock_daemon.rb"
|
26
26
|
|
27
27
|
def middle
|
28
28
|
tempfile = ARGV.first
|
@@ -44,9 +44,6 @@ end
|
|
44
44
|
|
45
45
|
# The final implementation
|
46
46
|
class SimpleInit < MiddleInit
|
47
|
-
RUBY_PATH = 'ruby'
|
48
|
-
MOCK_EXECUTABLE = "#{RUBY_PATH} spec/bin/mock_daemon.rb"
|
49
|
-
|
50
47
|
# Defines the seconds to wait between stop and start in the predefined restart
|
51
48
|
# command
|
52
49
|
stop_start_delay 1.5
|
data/spec/init_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2010
|
2
2
|
#
|
3
3
|
# This file is part of Init.
|
4
4
|
#
|
@@ -15,90 +15,69 @@
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
16
16
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require '
|
19
|
-
|
20
|
-
require 'fileutils'
|
21
|
-
require 'tmpdir'
|
18
|
+
require './spec/spec_helper'
|
22
19
|
|
23
20
|
require 'rubygems'
|
24
21
|
require 'facets/timer'
|
25
22
|
|
26
|
-
module InitSpecHelper
|
27
|
-
RUBY_PATH = 'ruby'
|
28
|
-
|
29
|
-
def init_executable
|
30
|
-
"#{RUBY_PATH} spec/bin/simple_init.rb"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
23
|
describe Aef::Init do
|
35
24
|
before(:each) do
|
36
|
-
|
37
|
-
# a temporary directory (mktmpdir).
|
38
|
-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.8.7')
|
39
|
-
@folder_path = File.join(Dir.tmpdir, 'init_spec')
|
40
|
-
Dir.mkdir(@folder_path)
|
41
|
-
else
|
42
|
-
@folder_path = Dir.mktmpdir('init_spec')
|
43
|
-
end
|
25
|
+
@temp_dir = create_temp_dir
|
44
26
|
end
|
45
27
|
|
46
28
|
after(:each) do
|
47
|
-
|
29
|
+
@temp_dir.rmtree
|
48
30
|
end
|
49
31
|
|
50
|
-
include InitSpecHelper
|
51
|
-
|
52
32
|
it "should correctly execute the start command" do
|
53
|
-
start_output =
|
33
|
+
start_output = @temp_dir + 'start_output'
|
54
34
|
|
55
35
|
lambda {
|
56
|
-
`#{
|
57
|
-
}.should change{
|
36
|
+
`#{executable} start #{start_output}`.should be_true
|
37
|
+
}.should change{start_output.exist?}.from(false).to(true)
|
58
38
|
|
59
|
-
|
39
|
+
start_output.read.should == "#{start_output} --start --example -y\n"
|
60
40
|
|
61
41
|
end
|
62
42
|
|
63
43
|
it "should correctly execute the stop command" do
|
64
|
-
stop_output =
|
44
|
+
stop_output = @temp_dir + 'stop_output'
|
65
45
|
|
66
46
|
lambda {
|
67
|
-
`#{
|
68
|
-
}.should change{
|
47
|
+
`#{executable} stop #{stop_output}`.should be_true
|
48
|
+
}.should change{stop_output.exist?}.from(false).to(true)
|
69
49
|
|
70
|
-
|
50
|
+
stop_output.read.should == "#{stop_output} --stop --example -y\n"
|
71
51
|
end
|
72
52
|
|
73
53
|
it "should correctly execute the restart command" do
|
74
|
-
restart_output =
|
54
|
+
restart_output = @temp_dir + 'restart_output'
|
75
55
|
|
76
56
|
lambda {
|
77
|
-
`#{
|
78
|
-
}.should change{
|
57
|
+
`#{executable} restart #{restart_output}`.should be_true
|
58
|
+
}.should change{restart_output.exist?}.from(false).to(true)
|
79
59
|
|
80
|
-
|
81
|
-
"#{restart_output} --stop --example -y\n#{restart_output} --start --example -y\n"
|
60
|
+
restart_output.read.should ==
|
61
|
+
"#{restart_output} --stop --example -y\n#{restart_output} --start --example -y\n"
|
82
62
|
end
|
83
63
|
|
84
64
|
it "should correctly execute the middle command" do
|
85
|
-
middle_output =
|
65
|
+
middle_output = @temp_dir + 'middle_output'
|
86
66
|
|
87
67
|
lambda {
|
88
|
-
`#{
|
89
|
-
}.should change{
|
68
|
+
`#{executable} middle #{middle_output}`.should be_true
|
69
|
+
}.should change{middle_output.exist?}.from(false).to(true)
|
90
70
|
|
91
|
-
|
92
|
-
"#{middle_output} --middle -e --abc\n")
|
71
|
+
middle_output.read.should == "#{middle_output} --middle -e --abc\n"
|
93
72
|
end
|
94
73
|
|
95
74
|
it "should wait 3 seconds between stop and start through the restart command" do
|
96
|
-
restart_output =
|
75
|
+
restart_output = @temp_dir + 'restart_output'
|
97
76
|
|
98
77
|
timer = Timer.new
|
99
78
|
timer.start
|
100
79
|
|
101
|
-
`#{
|
80
|
+
`#{executable} restart #{restart_output}`.should be_true
|
102
81
|
|
103
82
|
timer.stop
|
104
83
|
(timer.total_time.should > 1.5).should be_true
|
@@ -107,23 +86,23 @@ describe Aef::Init do
|
|
107
86
|
it "should display a usage example if a wrong command is specified" do
|
108
87
|
usage_information = "Usage: spec/bin/simple_init.rb {middle|restart|start|stop}\n"
|
109
88
|
|
110
|
-
`#{
|
89
|
+
`#{executable} invalid`.should == usage_information
|
111
90
|
end
|
112
91
|
|
113
92
|
it "should only offer methods which are defined in Init or it's child classes" do
|
114
93
|
usage_information = "Usage: spec/bin/simple_init.rb {middle|restart|start|stop}\n"
|
115
94
|
|
116
|
-
`#{
|
117
|
-
`#{
|
118
|
-
`#{
|
95
|
+
`#{executable} methods`.should == usage_information
|
96
|
+
`#{executable} frozen?`.should == usage_information
|
97
|
+
`#{executable} to_a`.should == usage_information
|
119
98
|
end
|
120
99
|
|
121
100
|
it "should only offer methods which are defined as public in Init or it's child classes" do
|
122
101
|
usage_information = "Usage: spec/bin/simple_init.rb {middle|restart|start|stop}\n"
|
123
102
|
|
124
|
-
`#{
|
125
|
-
`#{
|
126
|
-
`#{
|
127
|
-
`#{
|
103
|
+
`#{executable} middle_protected`.should == usage_information
|
104
|
+
`#{executable} middle_private`.should == usage_information
|
105
|
+
`#{executable} end_protected`.should == usage_information
|
106
|
+
`#{executable} end_private`.should == usage_information
|
128
107
|
end
|
129
108
|
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Copyright Alexander E. Fischer <aef@raxys.net>, 2009-2010
|
2
|
+
#
|
3
|
+
# This file is part of Init.
|
4
|
+
#
|
5
|
+
# Linebreak is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
require 'rbconfig'
|
19
|
+
require 'pathname'
|
20
|
+
require 'tmpdir'
|
21
|
+
require 'rubygems'
|
22
|
+
|
23
|
+
$LOAD_PATH.unshift((Pathname.pwd + 'lib').to_s)
|
24
|
+
|
25
|
+
require 'aef/init'
|
26
|
+
|
27
|
+
module Aef::Init::SpecHelper
|
28
|
+
INTERPRETER = Pathname(RbConfig::CONFIG['bindir']) + RbConfig::CONFIG['ruby_install_name']
|
29
|
+
|
30
|
+
def create_temp_dir
|
31
|
+
# Before ruby 1.8.7, the tmpdir standard library had no method to create
|
32
|
+
# a temporary directory (mktmpdir).
|
33
|
+
if Gem::Version.new("#{RUBY_VERSION}") < Gem::Version.new('1.8.7')
|
34
|
+
temp_dir = Pathname(Dir.tmpdir) + 'init_spec'
|
35
|
+
Dir.mkdir(temp_dir)
|
36
|
+
temp_dir
|
37
|
+
else
|
38
|
+
Pathname(Dir.mktmpdir('init_spec'))
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def executable
|
43
|
+
"#{INTERPRETER} -Ilib spec/bin/simple_init.rb"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
Spec::Runner.configure do |config|
|
48
|
+
config.include Aef::Init::SpecHelper
|
49
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: init
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 1.1.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Alexander E. Fischer
|
@@ -29,39 +34,84 @@ cert_chain:
|
|
29
34
|
55akF+N8NbO6tpVDy6TMagqa10LfEpiQH6dvDHe/xdAqYOCrXKpmqzwu2PI=
|
30
35
|
-----END CERTIFICATE-----
|
31
36
|
|
32
|
-
date:
|
37
|
+
date: 2010-10-04 00:00:00 +02:00
|
33
38
|
default_executable:
|
34
39
|
dependencies:
|
35
40
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
41
|
+
name: semver
|
42
|
+
prerelease: false
|
43
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
segments:
|
49
|
+
- 0
|
50
|
+
- 2
|
51
|
+
- 2
|
52
|
+
version: 0.2.2
|
53
|
+
type: :runtime
|
54
|
+
version_requirements: *id001
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubyforge
|
57
|
+
prerelease: false
|
58
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
segments:
|
64
|
+
- 2
|
65
|
+
- 0
|
66
|
+
- 4
|
67
|
+
version: 2.0.4
|
37
68
|
type: :development
|
38
|
-
|
39
|
-
|
69
|
+
version_requirements: *id002
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec
|
72
|
+
prerelease: false
|
73
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
40
75
|
requirements:
|
41
76
|
- - ">="
|
42
77
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
78
|
+
segments:
|
79
|
+
- 1
|
80
|
+
- 3
|
81
|
+
- 0
|
82
|
+
version: 1.3.0
|
83
|
+
type: :development
|
84
|
+
version_requirements: *id003
|
45
85
|
- !ruby/object:Gem::Dependency
|
46
86
|
name: facets
|
47
|
-
|
48
|
-
|
49
|
-
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
50
90
|
requirements:
|
51
91
|
- - ">="
|
52
92
|
- !ruby/object:Gem::Version
|
53
|
-
|
54
|
-
|
93
|
+
segments:
|
94
|
+
- 2
|
95
|
+
- 8
|
96
|
+
- 4
|
97
|
+
version: 2.8.4
|
98
|
+
type: :development
|
99
|
+
version_requirements: *id004
|
55
100
|
- !ruby/object:Gem::Dependency
|
56
101
|
name: hoe
|
57
|
-
|
58
|
-
|
59
|
-
|
102
|
+
prerelease: false
|
103
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
60
105
|
requirements:
|
61
106
|
- - ">="
|
62
107
|
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
|
108
|
+
segments:
|
109
|
+
- 2
|
110
|
+
- 6
|
111
|
+
- 2
|
112
|
+
version: 2.6.2
|
113
|
+
type: :development
|
114
|
+
version_requirements: *id005
|
65
115
|
description: Clean and simple *nix init scripts with Ruby
|
66
116
|
email:
|
67
117
|
- aef@raxys.net
|
@@ -70,24 +120,30 @@ executables: []
|
|
70
120
|
extensions: []
|
71
121
|
|
72
122
|
extra_rdoc_files:
|
123
|
+
- COPYING.txt
|
73
124
|
- History.txt
|
74
125
|
- Manifest.txt
|
75
|
-
- COPYING.txt
|
76
126
|
- README.rdoc
|
77
127
|
files:
|
128
|
+
- .semver
|
129
|
+
- COPYING.txt
|
78
130
|
- History.txt
|
79
131
|
- Manifest.txt
|
80
132
|
- README.rdoc
|
81
|
-
- COPYING.txt
|
82
133
|
- Rakefile
|
83
|
-
-
|
84
|
-
- lib/init/init.rb
|
134
|
+
- examples/mongrel.rb
|
85
135
|
- examples/murmur.rb
|
86
|
-
-
|
136
|
+
- init.gemspec
|
137
|
+
- lib/aef/init.rb
|
138
|
+
- lib/aef/init/init.rb
|
87
139
|
- spec/bin/mock_daemon.rb
|
88
140
|
- spec/bin/simple_init.rb
|
141
|
+
- spec/init_spec.rb
|
142
|
+
- spec/spec_helper.rb
|
89
143
|
has_rdoc: true
|
90
144
|
homepage: https://rubyforge.org/projects/aef/
|
145
|
+
licenses: []
|
146
|
+
|
91
147
|
post_install_message:
|
92
148
|
rdoc_options:
|
93
149
|
- --main
|
@@ -99,23 +155,27 @@ rdoc_options:
|
|
99
155
|
require_paths:
|
100
156
|
- lib
|
101
157
|
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
102
159
|
requirements:
|
103
160
|
- - ">="
|
104
161
|
- !ruby/object:Gem::Version
|
162
|
+
segments:
|
163
|
+
- 0
|
105
164
|
version: "0"
|
106
|
-
version:
|
107
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
none: false
|
108
167
|
requirements:
|
109
168
|
- - ">="
|
110
169
|
- !ruby/object:Gem::Version
|
170
|
+
segments:
|
171
|
+
- 0
|
111
172
|
version: "0"
|
112
|
-
version:
|
113
173
|
requirements: []
|
114
174
|
|
115
175
|
rubyforge_project: aef
|
116
|
-
rubygems_version: 1.3.
|
176
|
+
rubygems_version: 1.3.7
|
117
177
|
signing_key:
|
118
|
-
specification_version:
|
178
|
+
specification_version: 3
|
119
179
|
summary: Clean and simple *nix init scripts with Ruby
|
120
180
|
test_files: []
|
121
181
|
|
metadata.gz.sig
CHANGED
Binary file
|