auser-skelerl 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -3
- data/VERSION.yml +4 -0
- data/bin/gen_server +0 -0
- data/bin/makefile +17 -0
- data/bin/skelerl +55 -12
- data/bin/skelerl-gen_server +29 -0
- data/bin/skelerl-makefile +29 -0
- data/config/jeweler.rb +41 -0
- data/generators/gen_server/USAGE +3 -3
- data/generators/gen_server/gen_server_generator.rb +36 -22
- data/generators/gen_server/templates/README.txt +1 -0
- data/generators/gen_server/templates/Rakefile +1 -0
- data/generators/gen_server/templates/gen_server.erl +107 -0
- data/generators/gen_server/templates/gitignore +3 -0
- data/generators/makefile/USAGE +5 -0
- data/generators/makefile/makefile_generator.rb +68 -0
- data/generators/makefile/templates/Emakefile +5 -0
- data/generators/makefile/templates/Makefile +31 -0
- data/{ebin/packager.app → generators/makefile/templates/appfile.app.erb} +6 -6
- data/generators/makefile/templates/make_boot.erl.erb +29 -0
- data/generators/makefile/templates/start.sh +4 -0
- data/generators/skeleton/skeleton_generator.rb +2 -0
- data/generators/skeleton/templates/Rakefile +2 -1
- data/generators/skeleton/templates/gitignore +15 -1
- data/script/generate +1 -1
- data/tasks/build.rake +97 -5
- metadata +41 -48
- data/Manifest.txt +0 -43
- data/config/hoe.rb +0 -73
- data/examples/example_runner.rb +0 -24
- data/include/empty +0 -0
- data/lib/skelerl.rb +0 -22
- data/lib/skelerl/core/object.rb +0 -27
- data/lib/skelerl/erlpers/core/array.rb +0 -10
- data/lib/skelerl/erlpers/core/object.rb +0 -34
- data/lib/skelerl/erlpers/erl_mapper.rb +0 -70
- data/lib/skelerl/erlpers/mappers/command.rb +0 -13
- data/lib/skelerl/erlpers/mappers/context.rb +0 -39
- data/lib/skelerl/erlpers/mappers/namespace.rb +0 -8
- data/lib/skelerl/init.rb +0 -3
- data/setup.rb +0 -1585
- data/skelerl.gemspec +0 -36
- data/src/packager.erl +0 -75
- data/tasks/deployment.rake +0 -43
- data/test/erlpers/erl_mapper_spec.rb +0 -113
- data/test/erlpers/object_spec.rb +0 -26
- data/test/helper.rb +0 -10
data/skelerl.gemspec
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{skelerl}
|
5
|
-
s.version = "0.0.4"
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Ari Lerner"]
|
9
|
-
s.date = %q{2009-02-09}
|
10
|
-
s.description = %q{This skeleton app takes care of everything you'd need in an erlang application, but don't want to do yourself... Check out the README for more! Mon Feb 09 18:49:15 -0800 2009}
|
11
|
-
s.email = ["arilerner@mac.com"]
|
12
|
-
s.executables = ["gen_server", "skelerl"]
|
13
|
-
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt", "generators/skeleton/templates/README.txt"]
|
14
|
-
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/gen_server", "bin/skelerl", "config/hoe.rb", "config/requirements.rb", "ebin/packager.app", "examples/example_runner.rb", "generators/appfile/USAGE", "generators/appfile/appfile_generator.rb", "generators/appfile/templates/appfile.app", "generators/gen_server/USAGE", "generators/gen_server/gen_server_generator.rb", "generators/gen_server/templates/gen_server.erl", "generators/skeleton/USAGE", "generators/skeleton/skeleton_generator.rb", "generators/skeleton/templates/README.txt", "generators/skeleton/templates/Rakefile", "generators/skeleton/templates/gitignore", "include/empty", "lib/skelerl.rb", "lib/skelerl/core/object.rb", "lib/skelerl/erlpers/core/array.rb", "lib/skelerl/erlpers/core/object.rb", "lib/skelerl/erlpers/erl_mapper.rb", "lib/skelerl/erlpers/mappers/command.rb", "lib/skelerl/erlpers/mappers/context.rb", "lib/skelerl/erlpers/mappers/namespace.rb", "lib/skelerl/init.rb", "script/generate", "setup.rb", "skelerl.gemspec", "src/packager.erl", "tasks/build.rake", "tasks/deployment.rake", "tasks/environment.rake", "tasks/generate.rake", "tasks/website.rake", "test/erlpers/erl_mapper_spec.rb", "test/erlpers/object_spec.rb", "test/helper.rb"]
|
15
|
-
s.has_rdoc = true
|
16
|
-
s.homepage = %q{http://skelerl.rubyforge.org}
|
17
|
-
s.post_install_message = %q{}
|
18
|
-
s.rdoc_options = ["--main", "README.txt"]
|
19
|
-
s.require_paths = ["lib"]
|
20
|
-
s.rubyforge_project = %q{skelerl}
|
21
|
-
s.rubygems_version = %q{1.3.1}
|
22
|
-
s.summary = %q{This skeleton app takes care of everything you'd need in an erlang application, but don't want to do yourself... Check out the README for more! Mon Feb 09 18:49:15 -0800 2009}
|
23
|
-
|
24
|
-
if s.respond_to? :specification_version then
|
25
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
26
|
-
s.specification_version = 2
|
27
|
-
|
28
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
29
|
-
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
30
|
-
else
|
31
|
-
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
32
|
-
end
|
33
|
-
else
|
34
|
-
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
35
|
-
end
|
36
|
-
end
|
data/src/packager.erl
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
-module (packager).
|
2
|
-
-compile(export_all).
|
3
|
-
-behaviour(application).
|
4
|
-
|
5
|
-
%% Application callbacks
|
6
|
-
-export([start/1, start/2, stop/1]).
|
7
|
-
|
8
|
-
start(Name) ->
|
9
|
-
[N,V] = Name,
|
10
|
-
start(N, V).
|
11
|
-
%%====================================================================
|
12
|
-
%% Application callbacks
|
13
|
-
%%====================================================================
|
14
|
-
%%--------------------------------------------------------------------
|
15
|
-
%% Function: start(Type, StartArgs) -> {ok, Pid} |
|
16
|
-
%% {ok, Pid, State} |
|
17
|
-
%% {error, Reason}
|
18
|
-
%% Description: This function is called whenever an application
|
19
|
-
%% is started using application:start/1,2, and should start the processes
|
20
|
-
%% of the application. If the application is structured according to the
|
21
|
-
%% OTP design principles as a supervision tree, this means starting the
|
22
|
-
%% top supervisor of the tree.
|
23
|
-
%%--------------------------------------------------------------------
|
24
|
-
start(Name, Version) ->
|
25
|
-
recompile_scripts(Name, Version).
|
26
|
-
|
27
|
-
%%--------------------------------------------------------------------
|
28
|
-
%% Function: stop(State) -> void()
|
29
|
-
%% Description: This function is called whenever an application
|
30
|
-
%% has stopped. It is intended to be the opposite of Module:start/2 and
|
31
|
-
%% should do any necessary cleaning up. The return value is ignored.
|
32
|
-
%%--------------------------------------------------------------------
|
33
|
-
stop(_State) ->
|
34
|
-
ok.
|
35
|
-
|
36
|
-
%%====================================================================
|
37
|
-
%% Internal functions
|
38
|
-
%%====================================================================
|
39
|
-
|
40
|
-
gen_rel(Name, Vers) ->
|
41
|
-
RelName = gen_rel_name(Name, Vers),
|
42
|
-
F = lists:append(["{release, {\"",Name,"\",\"",Vers,"\"}, ",
|
43
|
-
"{erts,\"",erlang:system_info(version),"\"},"
|
44
|
-
"[{kernel,\"",get_vsn(kernel),"\"},",
|
45
|
-
"{stdlib,\"",get_vsn(stdlib),"\"},",
|
46
|
-
"{inets,\"",get_vsn(inets),"\"},",
|
47
|
-
"{crypto,\"",get_vsn(crypto),"\"},",
|
48
|
-
"{sasl,\"",get_vsn(sasl),"\"},",
|
49
|
-
"{",Name,",\"",Vers,"\"}]}."]),
|
50
|
-
file:write_file( lists:append(["ebin/", RelName, ".rel"]),F).
|
51
|
-
|
52
|
-
% Recompiles the boot scripts
|
53
|
-
recompile_scripts(Name, Vers) ->
|
54
|
-
gen_rel(Name, Vers),
|
55
|
-
ScriptName = gen_rel_name(Name, Vers),
|
56
|
-
systools:make_script(ScriptName, [local,{path,["ebin"]}]).
|
57
|
-
|
58
|
-
package_scripts(Name, Vers) ->
|
59
|
-
ScriptName = lists:append(["ebin/", gen_rel_name(Name, Vers)]),
|
60
|
-
systools:make_tar(ScriptName).
|
61
|
-
|
62
|
-
get_vsn(Module) ->
|
63
|
-
AppFile = code:lib_dir(Module)++"/ebin/"++atom_to_list(Module)++".app",
|
64
|
-
{ok,[{application,_App,Attrs}]} = file:consult(AppFile),
|
65
|
-
{value,{vsn,Vsn}} = lists:keysearch(vsn,1,Attrs),
|
66
|
-
Vsn.
|
67
|
-
|
68
|
-
gen_rel_name(Name, Vers) -> lists:append([Name,"_rel-",Vers]).
|
69
|
-
|
70
|
-
install_messenger(Vers) ->
|
71
|
-
Root = code:root_dir(),
|
72
|
-
io:format("~p root: "++Root, [Vers]),
|
73
|
-
ok.
|
74
|
-
|
75
|
-
% Tests
|
data/tasks/deployment.rake
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
desc 'Release the website and new gem version'
|
2
|
-
task :deploy => [:check_version, :website, :release] do
|
3
|
-
puts "Remember to create SVN tag:"
|
4
|
-
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
-
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
-
puts "Suggested comment:"
|
7
|
-
puts "Tagging release #{CHANGES}"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
-
task :local_deploy => [:website_generate, :install_gem]
|
12
|
-
|
13
|
-
task :check_version do
|
14
|
-
unless ENV['VERSION']
|
15
|
-
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
unless ENV['VERSION'] == VERS
|
19
|
-
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
-
task :install_gem_no_doc => [:clean, :package] do
|
26
|
-
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
-
end
|
28
|
-
|
29
|
-
namespace :manifest do
|
30
|
-
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
-
task :refresh do
|
32
|
-
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
desc "Generate gemspec"
|
37
|
-
task :gemspec => [:"manifest:refresh"] do |t|
|
38
|
-
res = %x[rake debug_gem]
|
39
|
-
res = res.split("\n")[1..-1].join("\n")
|
40
|
-
::File.open("#{GEM_NAME.downcase}.gemspec", "w+") do |f|
|
41
|
-
f << res
|
42
|
-
end
|
43
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../helper"
|
2
|
-
|
3
|
-
class ErlMapperTest < Test::Unit::TestCase
|
4
|
-
context "ErlMapper" do
|
5
|
-
context "methods" do
|
6
|
-
|
7
|
-
context "options" do
|
8
|
-
|
9
|
-
setup do;@mapper = ErlMapper.new do;a "a";b = nil;end;end
|
10
|
-
describe "passed in with a hash" do
|
11
|
-
it "should set the option on the ErlMapper" do;@mapper.a.should == "a";end
|
12
|
-
it "should not set the option when passed a nil value" do;@mapper.b.should == nil;end
|
13
|
-
end
|
14
|
-
describe "passed in on the block" do
|
15
|
-
it "should set the option on the ErlMapper" do;@mapper.a.should == "a";end
|
16
|
-
it "should not set the option when passed a nil value" do;@mapper.b.should == nil;end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context "with_node" do
|
21
|
-
setup do;@mapper = ErlMapper.new do;with_node(:node0) do; "hi";end;end;end
|
22
|
-
describe "on call" do
|
23
|
-
it "should create a MappingContext" do
|
24
|
-
assert_equal @mapper.with_node(:node0).class, MappingContext
|
25
|
-
end
|
26
|
-
it "should store the MappingContext's name" do
|
27
|
-
assert_equal @mapper.with_node(:node0).sname, :node0
|
28
|
-
end
|
29
|
-
it "should append the name to the MappingContext's string" do
|
30
|
-
assert_equal @mapper.with_node(:node0).build_string.strip, "erl -sname node0 -pa ./ebin"
|
31
|
-
end
|
32
|
-
|
33
|
-
context "context" do
|
34
|
-
setup do;@context = @mapper.with_node(:node0) do;start;end;end
|
35
|
-
|
36
|
-
describe "with start_commands" do
|
37
|
-
it "should have the start_commands on the MappingContext" do
|
38
|
-
assert_equal @context.commands.flatten, ["start"]
|
39
|
-
end
|
40
|
-
it "should have multiple when multiple are called" do
|
41
|
-
@context.instance_eval do
|
42
|
-
chordjerl_srv.start_link
|
43
|
-
end
|
44
|
-
assert_equal ["start","chordjerl_srv","start_link"], @context.commands.flatten
|
45
|
-
end
|
46
|
-
it "should include arguments" do
|
47
|
-
@context = @mapper.with_node(:node0) do
|
48
|
-
dark.and_stormy "night"
|
49
|
-
end
|
50
|
-
assert_equal [["dark",["and_stormy","night"]]], @context.commands
|
51
|
-
end
|
52
|
-
it "should build the commands with 1 -s" do
|
53
|
-
@context = @mapper.with_node(:node0, :stop => false) do
|
54
|
-
everything.but_the "sink"
|
55
|
-
end
|
56
|
-
assert_equal "erl -sname node0 -pa ./ebin -s everything but_the sink", @context.string
|
57
|
-
end
|
58
|
-
it "should build the commands without an argument" do
|
59
|
-
@context = @mapper.with_node(:node0, :stop => false) do
|
60
|
-
once.in_a_lifetime
|
61
|
-
end
|
62
|
-
assert_equal "erl -sname node0 -pa ./ebin -s once in_a_lifetime", @context.string
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "with final_commands" do
|
67
|
-
it "should have the default final_commands as -s init stop" do
|
68
|
-
assert_equal @context.final_commands, "-s init stop"
|
69
|
-
end
|
70
|
-
it "should not have the final_commands with stop if stop is false" do
|
71
|
-
cont = MappingContext.new :node1, {:stop => false} do
|
72
|
-
end
|
73
|
-
assert_equal cont.final_commands, ""
|
74
|
-
end
|
75
|
-
it "with stop if stop is true" do
|
76
|
-
cont = MappingContext.new :node2, {:stop => true} do
|
77
|
-
end
|
78
|
-
assert_equal cont.final_commands, "-s init stop"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
context "Namespace" do
|
89
|
-
setup do
|
90
|
-
@namespace = Namespace.new("chordjerl_srv") do
|
91
|
-
start
|
92
|
-
end
|
93
|
-
end
|
94
|
-
it "should keep the namespace on the command" do
|
95
|
-
assert_equal "erl -s chordjerl_srv:start", @namespace.string
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
describe "Called from an object" do
|
100
|
-
setup do
|
101
|
-
@o = Object.new
|
102
|
-
end
|
103
|
-
|
104
|
-
it "should not fail" do
|
105
|
-
blk = Proc.new {}
|
106
|
-
lambda {@o.erlang(&blk)}.should_not raise_error
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
data/test/erlpers/object_spec.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../helper"
|
2
|
-
|
3
|
-
class ObjectTest < Test::Unit::TestCase
|
4
|
-
context "Object" do
|
5
|
-
setup do
|
6
|
-
@o = Object.new
|
7
|
-
end
|
8
|
-
|
9
|
-
context "for method erlang" do
|
10
|
-
should "respond to :erlang" do
|
11
|
-
assert_respond_to @o, :erlang
|
12
|
-
end
|
13
|
-
|
14
|
-
should "create a new ErlMapper" do
|
15
|
-
blk = Proc.new {}
|
16
|
-
assert_equal ErlMapper, @o.erlang(&blk).class
|
17
|
-
end
|
18
|
-
|
19
|
-
should "not create a new ErlMapper if there is no block passed" do
|
20
|
-
assert_equal @o.erlang, nil
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|