auser-skelerl 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +17 -0
- data/README.txt +44 -0
- data/Rakefile +5 -0
- data/bin/build-app +22 -0
- data/config/hoe.rb +73 -0
- data/config/requirements.rb +15 -0
- data/ebin/packager.app +19 -0
- data/include/empty +0 -0
- data/lib/skelerl.rb +10 -0
- data/setup.rb +1585 -0
- data/skelerl.gemspec +35 -0
- data/src/packager.erl +75 -0
- data/tasks/deployment.rake +43 -0
- data/tasks/environment.rake +7 -0
- data/tasks/skelerl.rake +74 -0
- data/tasks/website.rake +17 -0
- metadata +81 -0
data/skelerl.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{skelerl}
|
3
|
+
s.version = "0.0.1"
|
4
|
+
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.authors = ["Ari Lerner"]
|
7
|
+
s.date = %q{2009-01-21}
|
8
|
+
s.default_executable = %q{build-app}
|
9
|
+
s.description = %q{This skeleton app takes care of everything you'd need in an erlang application, but don't want to do yourself... hopefully.}
|
10
|
+
s.email = ["arilerner@mac.com"]
|
11
|
+
s.executables = ["build-app"]
|
12
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
13
|
+
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/build-app", "config/hoe.rb", "config/requirements.rb", "ebin/packager.app", "include/empty", "lib/skelerl.rb", "setup.rb", "skelerl.gemspec", "src/packager.erl", "tasks/deployment.rake", "tasks/environment.rake", "tasks/skelerl.rake", "tasks/website.rake"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://skelerl.rubyforge.org}
|
16
|
+
s.post_install_message = %q{}
|
17
|
+
s.rdoc_options = ["--main", "README.txt"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{skelerl}
|
20
|
+
s.rubygems_version = %q{1.2.0}
|
21
|
+
s.summary = %q{This skeleton app takes care of everything you'd need in an erlang application, but don't want to do yourself... hopefully.}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 2
|
26
|
+
|
27
|
+
if current_version >= 3 then
|
28
|
+
s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
|
29
|
+
else
|
30
|
+
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
31
|
+
end
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
34
|
+
end
|
35
|
+
end
|
data/src/packager.erl
ADDED
@@ -0,0 +1,75 @@
|
|
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
|
@@ -0,0 +1,43 @@
|
|
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", :package] 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
|
data/tasks/skelerl.rake
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
|
3
|
+
INCLUDE = "include"
|
4
|
+
ERLC_FLAGS = "-I#{INCLUDE} +warn_unused_vars +warn_unused_import"
|
5
|
+
|
6
|
+
SRC = FileList['src/*.erl']
|
7
|
+
OBJ = SRC.pathmap("%{src,ebin}X.beam")
|
8
|
+
CLEAN.include("ebin/*.beam")
|
9
|
+
|
10
|
+
directory 'ebin'
|
11
|
+
|
12
|
+
rule ".beam" => ["%{ebin,src}X.erl"] do |t|
|
13
|
+
sh "erlc -pa ebin -W #{ERLC_FLAGS} -o ebin #{t.source}"
|
14
|
+
end
|
15
|
+
|
16
|
+
task :default => :compile
|
17
|
+
|
18
|
+
desc "Run the tests"
|
19
|
+
task :run_tests => [:compile] do
|
20
|
+
OBJ.each do |obj|
|
21
|
+
obj[%r{.*/(.*).beam}]
|
22
|
+
mod = $1
|
23
|
+
test_output = `erl -pa ebin -run #{mod} test -run init stop`
|
24
|
+
|
25
|
+
if /\*failed\*/ =~ test_output
|
26
|
+
test_output[/(Failed.*Aborted.*Skipped.*Succeeded.*$)/]
|
27
|
+
else
|
28
|
+
test_output[/1>\s*(.*)\n/]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Clean the beams from the ebin directory"
|
34
|
+
task :clean do
|
35
|
+
# cmd = "rm #{::File.dirname(__FILE__)}/ebin/*.beam"
|
36
|
+
# Kernel.system cmd
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Recompile the sources"
|
40
|
+
task :recompile => [:clean, :compile]
|
41
|
+
|
42
|
+
desc "Compile all the sources"
|
43
|
+
task :compile => ['ebin'] + OBJ
|
44
|
+
|
45
|
+
desc "Compile with the DEBUG flag set to true"
|
46
|
+
task :compile_debug do
|
47
|
+
Dir["#{::File.dirname(__FILE__)}/src/*.erl"].each do |t|
|
48
|
+
Kernel.system "erlc -pa ebin -W #{ERLC_FLAGS} -Ddebug -o ebin #{t}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Rebuild the boot scripts"
|
53
|
+
task :build_boot_scripts => [:recompile] do
|
54
|
+
puts "Rebuilding boot scripts"
|
55
|
+
|
56
|
+
root_dir = ::File.expand_path( ::File.join(::File.dirname(__FILE__)) )
|
57
|
+
@version = ENV["VERSION"] || ENV["V"] || "0.1"
|
58
|
+
@name = ENV["NAME"] || ::File.basename(::File.dirname( root_dir ))
|
59
|
+
|
60
|
+
cmd = "erl -pa ./ebin/ -run packager start #{@name} #{@version} -run init stop -noshell"
|
61
|
+
Kernel.system cmd
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Rebuild and repackage"
|
65
|
+
task :repackage => [:build_boot_scripts] do
|
66
|
+
cmd = "erl -pa ./ebin -s packager start -s init stop"
|
67
|
+
Kernel.system cmd
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Install messenger"
|
71
|
+
task :install_messenger do
|
72
|
+
cmd = "erl -pa ./ebin/ -run packager install_messenger #{@version} -run init stop -noshell"
|
73
|
+
Kernel.system cmd
|
74
|
+
end
|
data/tasks/website.rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
desc 'Generate website files'
|
2
|
+
task :website_generate => :ruby_env do
|
3
|
+
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
|
+
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'Upload website files to rubyforge'
|
9
|
+
task :website_upload do
|
10
|
+
host = "#{rubyforge_username}@rubyforge.org"
|
11
|
+
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
12
|
+
local_dir = 'website'
|
13
|
+
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate and upload website files'
|
17
|
+
task :website => [:website_generate, :website_upload, :publish_docs]
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: auser-skelerl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ari Lerner
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-01-21 00:00:00 -08:00
|
13
|
+
default_executable: build-app
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.8.2
|
23
|
+
version:
|
24
|
+
description: This skeleton app takes care of everything you'd need in an erlang application, but don't want to do yourself... hopefully.
|
25
|
+
email:
|
26
|
+
- arilerner@mac.com
|
27
|
+
executables:
|
28
|
+
- build-app
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- History.txt
|
33
|
+
- Manifest.txt
|
34
|
+
- README.txt
|
35
|
+
files:
|
36
|
+
- History.txt
|
37
|
+
- Manifest.txt
|
38
|
+
- README.txt
|
39
|
+
- Rakefile
|
40
|
+
- bin/build-app
|
41
|
+
- config/hoe.rb
|
42
|
+
- config/requirements.rb
|
43
|
+
- ebin/packager.app
|
44
|
+
- include/empty
|
45
|
+
- lib/skelerl.rb
|
46
|
+
- setup.rb
|
47
|
+
- skelerl.gemspec
|
48
|
+
- src/packager.erl
|
49
|
+
- tasks/deployment.rake
|
50
|
+
- tasks/environment.rake
|
51
|
+
- tasks/skelerl.rake
|
52
|
+
- tasks/website.rake
|
53
|
+
has_rdoc: true
|
54
|
+
homepage: http://skelerl.rubyforge.org
|
55
|
+
post_install_message: ""
|
56
|
+
rdoc_options:
|
57
|
+
- --main
|
58
|
+
- README.txt
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project: skelerl
|
76
|
+
rubygems_version: 1.2.0
|
77
|
+
signing_key:
|
78
|
+
specification_version: 2
|
79
|
+
summary: This skeleton app takes care of everything you'd need in an erlang application, but don't want to do yourself... hopefully.
|
80
|
+
test_files: []
|
81
|
+
|