otp_kickoff 0.0.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.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +46 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/bin/otp_kickoff +5 -0
- data/lib/otp_kickoff.rb +103 -0
- data/otp_kickoff.gemspec +65 -0
- data/resources/template_app.app +21 -0
- data/resources/template_app.erl +36 -0
- data/resources/template_appstart.erl +26 -0
- data/resources/template_handler.erl +35 -0
- data/resources/template_include.hrl +11 -0
- data/resources/template_server.erl +77 -0
- data/resources/template_sup.erl +47 -0
- data/spec/otp-kickoff_spec.rb +7 -0
- data/spec/spec_helper.rb +9 -0
- metadata +93 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Leandro Silva
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
= otp_kickoff
|
2
|
+
|
3
|
+
Simple generator to kick off Erlang/OTP projects.
|
4
|
+
|
5
|
+
== Install and configuration
|
6
|
+
|
7
|
+
Install the gemcutter (a awesome gem hosting) support:
|
8
|
+
|
9
|
+
sudo gem install gemcutter
|
10
|
+
|
11
|
+
More about gemcutter here http://gemcutter.org.
|
12
|
+
|
13
|
+
Next, install the otp_kickoff:
|
14
|
+
|
15
|
+
sudo gem install otp_kickoff
|
16
|
+
|
17
|
+
Finally, configure your preferences:
|
18
|
+
|
19
|
+
otp_kickoff configure --name=leandro --email=leandrodoze@gmail.com
|
20
|
+
|
21
|
+
== Usage
|
22
|
+
|
23
|
+
Type:
|
24
|
+
|
25
|
+
otp_kickoff new_application --name=amazingapp
|
26
|
+
|
27
|
+
That will generate:
|
28
|
+
|
29
|
+
create amazingapp/src
|
30
|
+
create amazingapp/ebin
|
31
|
+
create amazingapp/deps
|
32
|
+
create amazingapp/src/amazingapp_app.app
|
33
|
+
create amazingapp/src/amazingapp_app.erl
|
34
|
+
create amazingapp/src/amazingapp_sup.erl
|
35
|
+
create amazingapp/src/amazingapp_server.erl
|
36
|
+
create amazingapp/src/amazingapp_handler.erl
|
37
|
+
create amazingapp/src/amazingapp.erl
|
38
|
+
create amazingapp/src/amazingapp.hrl
|
39
|
+
|
40
|
+
== Next
|
41
|
+
|
42
|
+
Enjoy a lot with Erlang/OTP programming!
|
43
|
+
|
44
|
+
== Copyright
|
45
|
+
|
46
|
+
Copyright (c) 2009 Leandro Silva. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "otp_kickoff"
|
8
|
+
gem.summary = %Q{Simple generator to kick off Erlang/OTP projects}
|
9
|
+
gem.email = "leandrodoze@gmail.com"
|
10
|
+
gem.homepage = "http://github.com/leandrosilva/otp_kickoff"
|
11
|
+
gem.authors = ["Leandro Silva"]
|
12
|
+
gem.add_development_dependency "rspec"
|
13
|
+
gem.add_dependency "thor"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'spec/rake/spectask'
|
21
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
22
|
+
spec.libs << 'lib' << 'spec'
|
23
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
24
|
+
end
|
25
|
+
|
26
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
27
|
+
spec.libs << 'lib' << 'spec'
|
28
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
29
|
+
spec.rcov = true
|
30
|
+
end
|
31
|
+
|
32
|
+
task :spec => :check_dependencies
|
33
|
+
|
34
|
+
task :default => :spec
|
35
|
+
|
36
|
+
require 'rake/rdoctask'
|
37
|
+
Rake::RDocTask.new do |rdoc|
|
38
|
+
if File.exist?('VERSION')
|
39
|
+
version = File.read('VERSION')
|
40
|
+
else
|
41
|
+
version = ""
|
42
|
+
end
|
43
|
+
|
44
|
+
rdoc.rdoc_dir = 'rdoc'
|
45
|
+
rdoc.title = "otp_kickoff #{version}"
|
46
|
+
rdoc.rdoc_files.include('README*')
|
47
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
48
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.4
|
data/bin/otp_kickoff
ADDED
data/lib/otp_kickoff.rb
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'thor'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Path to configuration file
|
7
|
+
#
|
8
|
+
CONFIGURATION_FILE = '~/.otp_kickoff'
|
9
|
+
|
10
|
+
#
|
11
|
+
# Thor classes, the magic of tasks!
|
12
|
+
#
|
13
|
+
class OTPKickOff < Thor
|
14
|
+
include Thor::Actions
|
15
|
+
|
16
|
+
#
|
17
|
+
# Setup
|
18
|
+
#
|
19
|
+
|
20
|
+
def self.source_root
|
21
|
+
File.expand_path(File.dirname(__FILE__) + '/..')
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.destination_root
|
25
|
+
File.expand_path(File.dirname('.'))
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Tasks
|
30
|
+
#
|
31
|
+
|
32
|
+
no_tasks { attr_accessor :application_name, :author_name, :author_email, :today }
|
33
|
+
|
34
|
+
# task: configure
|
35
|
+
|
36
|
+
desc 'configure --author=AUTHOR --email=AUTHOR_EMAIL', 'configure informations about author'
|
37
|
+
method_options :author => :string, :email => :string
|
38
|
+
|
39
|
+
def configure
|
40
|
+
#set data about author
|
41
|
+
@author_name = options[:author]
|
42
|
+
@author_email = options[:email]
|
43
|
+
|
44
|
+
create_file CONFIGURATION_FILE do
|
45
|
+
%Q{
|
46
|
+
author_name: #{author_name}
|
47
|
+
author_email: #{author_email}
|
48
|
+
}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# task: new_application
|
53
|
+
|
54
|
+
desc 'new_application --name=APPLICATION_NAME', 'generate a new Erlang/OTP application stub'
|
55
|
+
method_options :name => :string
|
56
|
+
|
57
|
+
def new_application
|
58
|
+
# set data to templates
|
59
|
+
@application_name = options[:name]
|
60
|
+
|
61
|
+
config_info = ConfigInfo.new
|
62
|
+
@author_name = config_info.author_name
|
63
|
+
@author_email = config_info.author_email
|
64
|
+
|
65
|
+
@today = Date.today
|
66
|
+
|
67
|
+
# generate templates
|
68
|
+
template 'resources/template_app.app', "#{application_name}/src/#{application_name}_app.app"
|
69
|
+
template 'resources/template_app.erl', "#{application_name}/src/#{application_name}_app.erl"
|
70
|
+
template 'resources/template_sup.erl', "#{application_name}/src/#{application_name}_sup.erl"
|
71
|
+
template 'resources/template_server.erl', "#{application_name}/src/#{application_name}_server.erl"
|
72
|
+
template 'resources/template_handler.erl', "#{application_name}/src/#{application_name}_handler.erl"
|
73
|
+
template 'resources/template_appstart.erl', "#{application_name}/src/#{application_name}.erl"
|
74
|
+
template 'resources/template_include.hrl', "#{application_name}/src/#{application_name}.hrl"
|
75
|
+
|
76
|
+
# create required directories
|
77
|
+
empty_directory "#{application_name}/ebin"
|
78
|
+
empty_directory "#{application_name}/deps"
|
79
|
+
empty_directory "#{application_name}/priv"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# Helper class to get informations from configuration file (~/.otp_kickoff)
|
85
|
+
#
|
86
|
+
class ConfigInfo
|
87
|
+
attr_accessor :author_name, :author_email
|
88
|
+
|
89
|
+
def initialize
|
90
|
+
begin
|
91
|
+
info = YAML.load_file(File.expand_path(CONFIGURATION_FILE))
|
92
|
+
rescue
|
93
|
+
puts "I'm sorry but the configuration file doesn't exists."
|
94
|
+
puts "Please run the command below:"
|
95
|
+
puts " otp_kickoff configure --author=YOUR_NAME --email=YOUR_EMAIL"
|
96
|
+
|
97
|
+
exit 0
|
98
|
+
end
|
99
|
+
|
100
|
+
@author_name = info["author_name"]
|
101
|
+
@author_email = info["author_email"]
|
102
|
+
end
|
103
|
+
end
|
data/otp_kickoff.gemspec
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{otp_kickoff}
|
8
|
+
s.version = "0.0.4"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Leandro Silva"]
|
12
|
+
s.date = %q{2009-10-19}
|
13
|
+
s.default_executable = %q{otp_kickoff}
|
14
|
+
s.email = %q{leandrodoze@gmail.com}
|
15
|
+
s.executables = ["otp_kickoff"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".gitignore",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"bin/otp_kickoff",
|
28
|
+
"lib/otp_kickoff.rb",
|
29
|
+
"otp_kickoff.gemspec",
|
30
|
+
"resources/template_app.app",
|
31
|
+
"resources/template_app.erl",
|
32
|
+
"resources/template_appstart.erl",
|
33
|
+
"resources/template_handler.erl",
|
34
|
+
"resources/template_include.hrl",
|
35
|
+
"resources/template_server.erl",
|
36
|
+
"resources/template_sup.erl",
|
37
|
+
"spec/otp-kickoff_spec.rb",
|
38
|
+
"spec/spec_helper.rb"
|
39
|
+
]
|
40
|
+
s.homepage = %q{http://github.com/leandrosilva/otp_kickoff}
|
41
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
42
|
+
s.require_paths = ["lib"]
|
43
|
+
s.rubygems_version = %q{1.3.5}
|
44
|
+
s.summary = %q{Simple generator to kick off Erlang/OTP projects}
|
45
|
+
s.test_files = [
|
46
|
+
"spec/otp-kickoff_spec.rb",
|
47
|
+
"spec/spec_helper.rb"
|
48
|
+
]
|
49
|
+
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
55
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
56
|
+
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
59
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
60
|
+
end
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
63
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
%%
|
2
|
+
%% Resource application file
|
3
|
+
%%
|
4
|
+
%% File : <%=application_name%>_handler.erl
|
5
|
+
%% Created: <%=Date.today%>
|
6
|
+
%%
|
7
|
+
%% @author <%=author_name%> <<%=author_email%>>
|
8
|
+
%% @copyright <%=today.year%> <%=author_name%>
|
9
|
+
%%
|
10
|
+
%% @doc TODO make nice description
|
11
|
+
%%
|
12
|
+
|
13
|
+
{application, <%=application_name%>_app,
|
14
|
+
[{description, "<%=application_name.capitalize%> application version 1.0"},
|
15
|
+
{vsn, "1.0"},
|
16
|
+
{modules, [<%=application_name%>_sup, <%=application_name%>_app, <%=application_name%>_server]},
|
17
|
+
{registered, [<%=application_name%>_sup]},
|
18
|
+
{applications, [kernel, stdlib, sasl]},
|
19
|
+
{env, [{var1, "Value of environment variable 1"}]}
|
20
|
+
{mod, {<%=application_name%>_app, []}}
|
21
|
+
]}.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
%%
|
2
|
+
%% Application module
|
3
|
+
%%
|
4
|
+
%% File : <%=application_name%>_handler.erl
|
5
|
+
%% Created: <%=Date.today%>
|
6
|
+
%%
|
7
|
+
%% @author <%=author_name%> <<%=author_email%>>
|
8
|
+
%% @copyright <%=today.year%> <%=author_name%>
|
9
|
+
%%
|
10
|
+
%% @doc TODO make nice description
|
11
|
+
%%
|
12
|
+
|
13
|
+
-module(<%=application_name%>_app).
|
14
|
+
-author('<%=author_name%> <<%=author_email%>>').
|
15
|
+
|
16
|
+
-behaviour(application).
|
17
|
+
|
18
|
+
-export([start/2, stop/1]).
|
19
|
+
|
20
|
+
%% @spec start(_Type, _StartArgs) -> {ok, Pid}
|
21
|
+
%% @doc Application start callback <%=application_name%>
|
22
|
+
start(_Type, _StartArgs) ->
|
23
|
+
case <%=application_name%>_sup:start_link() of
|
24
|
+
{ok, Pid} ->
|
25
|
+
alarm_handler:clear_alarm({application_stopped, ?MODULE}),
|
26
|
+
{ok, Pid};
|
27
|
+
Error ->
|
28
|
+
alarm_handler:set_alarm({{application_stopped, ?MODULE}, []}),
|
29
|
+
Error
|
30
|
+
end.
|
31
|
+
|
32
|
+
%% @spec stop(_State) -> ok
|
33
|
+
%% @doc Application stop callback for <%=application_name%>
|
34
|
+
stop(_State) ->
|
35
|
+
alarm_handler:set_alarm({{application_stopped, ?MODULE}, []}),
|
36
|
+
ok.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
%%
|
2
|
+
%% Start application module
|
3
|
+
%%
|
4
|
+
%% File : <%=application_name%>_handler.erl
|
5
|
+
%% Created: <%=Date.today%>
|
6
|
+
%%
|
7
|
+
%% @author <%=author_name%> <<%=author_email%>>
|
8
|
+
%% @copyright <%=today.year%> <%=author_name%>
|
9
|
+
%%
|
10
|
+
%% @doc TODO make nice description
|
11
|
+
%%
|
12
|
+
|
13
|
+
-module(<%=application_name%>).
|
14
|
+
-author('<%=author_name%> <<%=author_email%>>').
|
15
|
+
|
16
|
+
-export ([start/0, stop/0]).
|
17
|
+
|
18
|
+
%% @spec start() -> ok
|
19
|
+
%% @doc Start the <%=application_name%> application
|
20
|
+
start() ->
|
21
|
+
application:start(<%=application_name%>).
|
22
|
+
|
23
|
+
%% @spec stop() -> ok
|
24
|
+
%% @doc Stop the <%=application_name%> application
|
25
|
+
stop() ->
|
26
|
+
application:stop(%=application_name%>).
|
@@ -0,0 +1,35 @@
|
|
1
|
+
%%
|
2
|
+
%% Handler module that can be used by server to catch and handle events
|
3
|
+
%%
|
4
|
+
%% File : <%=application_name%>_handler.erl
|
5
|
+
%% Created: <%=Date.today%>
|
6
|
+
%%
|
7
|
+
%% @author <%=author_name%> <<%=author_email%>>
|
8
|
+
%% @copyright <%=today.year%> <%=author_name%>
|
9
|
+
%%
|
10
|
+
%% @doc TODO make nice description
|
11
|
+
%%
|
12
|
+
|
13
|
+
-module(<%=application_name%>_handler).
|
14
|
+
-author('<%=author_name%> <<%=author_email%>>').
|
15
|
+
|
16
|
+
-export([init/1, terminate/1, handle_event/2]).
|
17
|
+
|
18
|
+
%% @spec init(State) -> State
|
19
|
+
%% @doc Handler init callback
|
20
|
+
init(State) -> State.
|
21
|
+
|
22
|
+
%% @spec terminate(State) -> State
|
23
|
+
%% @doc Handler terminate callback
|
24
|
+
terminate(State) ->
|
25
|
+
{ok, State}.
|
26
|
+
|
27
|
+
%% @spec handle_event({event, _Event}, State) -> {ok, State}
|
28
|
+
%% @doc Handle event function
|
29
|
+
handle_event({event, _Event}, State) ->
|
30
|
+
{ok, State};
|
31
|
+
|
32
|
+
%% @spec handle_event(_Event, State) -> State
|
33
|
+
%% @doc Handle event "catch" function
|
34
|
+
handle_event(_Event, State) ->
|
35
|
+
State.
|
@@ -0,0 +1,77 @@
|
|
1
|
+
%%
|
2
|
+
%% Supervised worker process module
|
3
|
+
%%
|
4
|
+
%% File : <%=application_name%>_handler.erl
|
5
|
+
%% Created: <%=Date.today%>
|
6
|
+
%%
|
7
|
+
%% @author <%=author_name%> <<%=author_email%>>
|
8
|
+
%% @copyright <%=today.year%> <%=author_name%>
|
9
|
+
%%
|
10
|
+
%% @doc TODO make nice description
|
11
|
+
%%
|
12
|
+
|
13
|
+
-module(<%=application_name%>_server).
|
14
|
+
-author('<%=author_name%> <<%=author_email%>>').
|
15
|
+
|
16
|
+
-behaviour(gen_server).
|
17
|
+
|
18
|
+
%% operation & maintenance api
|
19
|
+
-export([start_link/0]).
|
20
|
+
|
21
|
+
%% gen_server callbacks
|
22
|
+
-export([init/1, handle_call/3, handle_cast/2,
|
23
|
+
handle_info/2, terminate/2, code_change/3]).
|
24
|
+
|
25
|
+
%%
|
26
|
+
%% Operation & Maintenance API
|
27
|
+
%%
|
28
|
+
|
29
|
+
%% @spec start_link() -> ServerReturn
|
30
|
+
%% @doc Start the server for <%=application_name%>
|
31
|
+
start_link() ->
|
32
|
+
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
|
33
|
+
|
34
|
+
%% @spec stop() -> ServerReturn
|
35
|
+
%% @doc Stopt the server for <%=application_name%>
|
36
|
+
stop() ->
|
37
|
+
gen_server:cast(?MODULE, stop).
|
38
|
+
|
39
|
+
%%
|
40
|
+
%% Genserver callback functions
|
41
|
+
%%
|
42
|
+
|
43
|
+
%% @spec init(State) -> {ok, State}
|
44
|
+
%% @doc Callback for initialize the server
|
45
|
+
init(State) ->
|
46
|
+
{ok, State}.
|
47
|
+
|
48
|
+
%% @spec handle_call(_Request, _From, State) -> {reply, Reply, State}
|
49
|
+
%% @doc Callback for synchronous requests
|
50
|
+
handle_call(_Request, _From, State) ->
|
51
|
+
Reply = ok,
|
52
|
+
{reply, Reply, State}.
|
53
|
+
|
54
|
+
%% @spec handle_cast(stop, State) -> {stop, normal, State}
|
55
|
+
%% @doc Callback for assynchronous messages
|
56
|
+
handle_cast(stop, State) ->
|
57
|
+
{stop, normal, State};
|
58
|
+
|
59
|
+
%% @spec handle_cast(_Msg, State) -> {noreply, State}
|
60
|
+
%% @doc Callback for assynchronous messages
|
61
|
+
handle_cast(_Msg, State) ->
|
62
|
+
{noreply, State}.
|
63
|
+
|
64
|
+
%% @spec handle_info(_Info, State) -> {noreply, State}
|
65
|
+
%% @doc Callback for give informations about server
|
66
|
+
handle_info(_Info, State) ->
|
67
|
+
{noreply, State}.
|
68
|
+
|
69
|
+
%% @spec terminate(_Reason, _State) -> ok
|
70
|
+
%% @doc Callback for free resources used by the server
|
71
|
+
terminate(_Reason, _State) ->
|
72
|
+
ok.
|
73
|
+
|
74
|
+
%% @spec code_change(_OldVsn, State, _Extra) -> {ok, State}
|
75
|
+
%% @doc Callback for upgrade source code
|
76
|
+
code_change(_OldVsn, State, _Extra) ->
|
77
|
+
{ok, State}.
|
@@ -0,0 +1,47 @@
|
|
1
|
+
%%
|
2
|
+
%% Supervisor module
|
3
|
+
%%
|
4
|
+
%% File : <%=application_name%>_handler.erl
|
5
|
+
%% Created: <%=Date.today%>
|
6
|
+
%%
|
7
|
+
%% @author <%=author_name%> <<%=author_email%>>
|
8
|
+
%% @copyright <%=today.year%> <%=author_name%>
|
9
|
+
%%
|
10
|
+
%% @doc TODO make nice description
|
11
|
+
%%
|
12
|
+
|
13
|
+
-module(<%=application_name%>_sup).
|
14
|
+
-author('<%=author_name%> <<%=author_email%>>').
|
15
|
+
|
16
|
+
-behaviour(supervisor).
|
17
|
+
|
18
|
+
%% operation & maintenance api
|
19
|
+
-export([start_link/0]).
|
20
|
+
|
21
|
+
%% supervisor callback
|
22
|
+
-export([init/1]).
|
23
|
+
|
24
|
+
-define(SERVER, ?MODULE).
|
25
|
+
|
26
|
+
%%
|
27
|
+
%% Operation & Maintenance API
|
28
|
+
%%
|
29
|
+
|
30
|
+
%% @spec start_link() -> SupervisorReturn
|
31
|
+
%% @doc Start the supervisor for <%=application_name%>
|
32
|
+
start_link() ->
|
33
|
+
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
|
34
|
+
|
35
|
+
%%
|
36
|
+
%% Supervisor callback function
|
37
|
+
%%
|
38
|
+
|
39
|
+
%% @spec init([]) -> SupervisorSpec
|
40
|
+
%% @doc Callback for initialize the supervisor for <%=application_name%>
|
41
|
+
init([]) ->
|
42
|
+
%% <%=application_name%>_server is a supervisioned child process
|
43
|
+
Server = {<%=application_name%>_server_child,
|
44
|
+
{<%=application_name%>_server, start_link, []},permanent, 2000, worker, [<%=application_name%>_server]},
|
45
|
+
|
46
|
+
%% Restart strategies for childs
|
47
|
+
{ok, {{one_for_one, 10, 1}, [Server]}}.
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: otp_kickoff
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Leandro Silva
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-19 00:00:00 -07:00
|
13
|
+
default_executable: otp_kickoff
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: thor
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description:
|
36
|
+
email: leandrodoze@gmail.com
|
37
|
+
executables:
|
38
|
+
- otp_kickoff
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- LICENSE
|
43
|
+
- README.rdoc
|
44
|
+
files:
|
45
|
+
- .document
|
46
|
+
- .gitignore
|
47
|
+
- LICENSE
|
48
|
+
- README.rdoc
|
49
|
+
- Rakefile
|
50
|
+
- VERSION
|
51
|
+
- bin/otp_kickoff
|
52
|
+
- lib/otp_kickoff.rb
|
53
|
+
- otp_kickoff.gemspec
|
54
|
+
- resources/template_app.app
|
55
|
+
- resources/template_app.erl
|
56
|
+
- resources/template_appstart.erl
|
57
|
+
- resources/template_handler.erl
|
58
|
+
- resources/template_include.hrl
|
59
|
+
- resources/template_server.erl
|
60
|
+
- resources/template_sup.erl
|
61
|
+
- spec/otp-kickoff_spec.rb
|
62
|
+
- spec/spec_helper.rb
|
63
|
+
has_rdoc: true
|
64
|
+
homepage: http://github.com/leandrosilva/otp_kickoff
|
65
|
+
licenses: []
|
66
|
+
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options:
|
69
|
+
- --charset=UTF-8
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: "0"
|
77
|
+
version:
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: "0"
|
83
|
+
version:
|
84
|
+
requirements: []
|
85
|
+
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 1.3.5
|
88
|
+
signing_key:
|
89
|
+
specification_version: 3
|
90
|
+
summary: Simple generator to kick off Erlang/OTP projects
|
91
|
+
test_files:
|
92
|
+
- spec/otp-kickoff_spec.rb
|
93
|
+
- spec/spec_helper.rb
|