From f5c07a46377b54755e3fbf94953cdcfc62d1401b Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Sun, 18 Dec 2011 14:15:34 -0500 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- .gitignore | 50 ++++++++++++++++++++++++ README | 10 ++--- lib/sample_rake/mibs/EX1-MIB.mib | 16 ++++---- lib/sample_rake/src/sample.erl | 2 +- lib/sample_rake/src/sample_rake.rel.src | 2 +- lib/sample_rake/src/sample_rake_app.erl | 2 +- rakelib/erlang.rake | 52 ++++++++++++------------- rakelib/escripts/make_doc | 2 +- rakelib/escripts/make_release | 2 +- rakelib/escripts/make_release_file | 2 +- rakelib/escripts/make_script | 2 +- rakelib/escripts/make_target | 16 ++++---- rakelib/escripts/run_test | 10 ++--- rakelib/otp_templates/generic_app.erl | 4 +- rakelib/otp_templates/generic_sup.erl | 6 +-- rakelib/otp_tools.rake | 22 +++++------ 16 files changed, 125 insertions(+), 75 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c091839 --- /dev/null +++ b/.gitignore @@ -0,0 +1,50 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc + +# Numerous always-ignore extensions +################### +*.diff +*.err +*.orig +*.log +*.rej +*.swo +*.swp +*.vi +*~ + +*.sass-cache +# Folders to ignore +################### +.hg +.svn +.CVS +# OS or Editor folders +################### +.DS_Store +Icon? +Thumbs.db +ehthumbs.db +nbproject +.cache +.project +.settings +.tmproj +*.esproj +*.sublime-project +*.sublime-workspace +# Dreamweaver added files +################### +_notes +dwsync.xml +# Komodo +################### +*.komodoproject +.komodotools diff --git a/README b/README index fe0e1d0..9a3316a 100644 --- a/README +++ b/README @@ -1,11 +1,11 @@ Sample erlang application to demonstrate the use of rake tasks dedicated to erlang. -= Installation = += Installation = Put in your project the directory 'rakelib' it contains all '.rake' files and some escript needed by tasks. -= Usage = += Usage = rake --tasks : to know all tasks You'll need a configuration in which you'll have to put things specific to your installation. @@ -14,7 +14,7 @@ A template of file is generated the first time you launch 'rake' Here is some useful tasks: rake erlang:modules: Compile all erlang source files (test included) rake erlang:releases: Build a tarball for each rel file found in the directory tree -rake erlang:tests[name]: Run the eunit test for the application "name". If no name is given, +rake erlang:tests[name]: Run the eunit test for the application "name". If no name is given, all applications are tested. If a file test.desc is find in the "app_name/test" directory, eunit will use it as eunit test description. rake erlang:edoc[name]: Build the document for an application or all if 'name' is omitted @@ -25,12 +25,12 @@ rake otp:initial_targer[name,version]: Create a tarball with a 'ready' to deploy an erlang system running the release. To use the system, you have to provide 2 startup files in a directory named 'release_config'. Look at the sample in the application sample_rake. -= Author = += Author = Nicolas Charpentier = Quick Start = -Create the a default erlang_config.rb file +Create the a default erlang_config.rb file % rake Edit the erlang_config.rb and add the path to your erlang installation diff --git a/lib/sample_rake/mibs/EX1-MIB.mib b/lib/sample_rake/mibs/EX1-MIB.mib index 5d9979d..238f7b9 100644 --- a/lib/sample_rake/mibs/EX1-MIB.mib +++ b/lib/sample_rake/mibs/EX1-MIB.mib @@ -1,14 +1,14 @@ EX1-MIB DEFINITIONS ::= BEGIN - + IMPORTS experimental FROM RFC1155-SMI RowStatus FROM STANDARD-MIB DisplayString FROM RFC1213-MIB OBJECT-TYPE FROM RFC-1212 ; - + example1 OBJECT IDENTIFIER ::= { experimental 7 } - + myName OBJECT-TYPE SYNTAX DisplayString (SIZE (0..255)) @@ -17,7 +17,7 @@ DESCRIPTION "My own name" ::= { example1 1 } - + friendsTable OBJECT-TYPE SYNTAX SEQUENCE OF FriendsEntry ACCESS not-accessible @@ -25,7 +25,7 @@ DESCRIPTION "A list of friends." ::= { example1 4 } - + friendsEntry OBJECT-TYPE SYNTAX FriendsEntry ACCESS not-accessible @@ -34,7 +34,7 @@ "" INDEX { fIndex } ::= { friendsTable 1 } - + FriendsEntry ::= SEQUENCE { fIndex @@ -45,7 +45,7 @@ DisplayString, fStatus RowStatus } - + fIndex OBJECT-TYPE SYNTAX INTEGER ACCESS not-accessible @@ -53,7 +53,7 @@ DESCRIPTION "number of friend" ::= { friendsEntry 1 } - + fName OBJECT-TYPE SYNTAX DisplayString (SIZE (0..255)) ACCESS read-write diff --git a/lib/sample_rake/src/sample.erl b/lib/sample_rake/src/sample.erl index 267bba3..8b7e910 100644 --- a/lib/sample_rake/src/sample.erl +++ b/lib/sample_rake/src/sample.erl @@ -10,7 +10,7 @@ -export([atoms/0]). -export([breaks_xref/0]). -atoms() -> +atoms() -> lists:foldl(fun(X,Acc) -> [X|Acc] end, [], [foobar, bar, baz]). diff --git a/lib/sample_rake/src/sample_rake.rel.src b/lib/sample_rake/src/sample_rake.rel.src index 3d13eb3..eb2ae80 100644 --- a/lib/sample_rake/src/sample_rake.rel.src +++ b/lib/sample_rake/src/sample_rake.rel.src @@ -1,4 +1,4 @@ -%% -*-erlang-*- ; +%% -*-erlang-*- ; {release, {"sample_rake", ""}, {erts, "_"}, diff --git a/lib/sample_rake/src/sample_rake_app.erl b/lib/sample_rake/src/sample_rake_app.erl index 155c1d1..32a9601 100644 --- a/lib/sample_rake/src/sample_rake_app.erl +++ b/lib/sample_rake/src/sample_rake_app.erl @@ -7,7 +7,7 @@ start(_Type, _StartArgs) -> case sample_rake_sup:start_link() of - {ok, Pid} -> + {ok, Pid} -> {ok, Pid}; Error -> Error diff --git a/rakelib/erlang.rake b/rakelib/erlang.rake index 309b835..6e150f3 100644 --- a/rakelib/erlang.rake +++ b/rakelib/erlang.rake @@ -4,8 +4,8 @@ # Distributed under BSD licence -if File.file?('erlang_config.rb') - require 'erlang_config' +if File.file?('erlang_config.rb') + require 'erlang_config' else puts "erlang_config.rb file is missing." puts "You need to fill it with your local configuration." @@ -25,7 +25,7 @@ require 'rake/loaders/makefile' import '.depend_erlang.mf' namespace :erlang do - + def handle_test(mode, args) directories = ERL_DIRECTORIES + ERL_DIRECTORIES.pathmap("%{ebin,test}X") if args.name @@ -46,7 +46,7 @@ namespace :erlang do end end end - + def collect_boot_files(releases) releases.collect { |elt| if elt =~ /^release/ @@ -60,26 +60,26 @@ namespace :erlang do end } end - + def collect_release_files(rel_sources) rel_sources.inject({}) do |acc,d| config_file = d.pathmap("%d/../vsn.config") vsn = extract_version_information(config_file,"release_name").gsub(/\"/,"") directory "release_local" map_expression = "%{src,ebin}X-" + vsn + ".rel" - rel_file = d.ext("").pathmap(map_expression) + rel_file = d.ext("").pathmap(map_expression) acc[rel_file] = d acc[rel_file.pathmap("release_local/%f")] = d acc end end - + def collect_generated_archives(releases) tmp = releases.delete_if { |elt| elt =~ /^release_local/ } tmp = tmp.pathmap("releases/%f").ext(".tar.gz") tmp end - + def extract_version_information(file, type) informations = [] IO.foreach(file) { |line| @@ -87,13 +87,13 @@ namespace :erlang do } informations[0] end - + def application_modules(app_file) modules = FileList.new(app_file.pathmap("%d/*.beam")).pathmap("%f").ext("") modules = modules.map {|item| item.gsub(/^([A-Z].*)/, '\'\1\'')} modules = modules.join(', ') end - + def check_dependencies (file) dependencies = [] IO.foreach(file) { |line| @@ -107,14 +107,14 @@ namespace :erlang do end end end - if header + if header dependencies << "#{header}" dependencies << check_dependencies(header) end } if File.file?(file) dependencies.flatten end - + def erlang_include_dependencies erlang_source_dependencies + erlang_test_dependencies end @@ -143,7 +143,7 @@ namespace :erlang do end run_script("make_script",[style, source, output] + ERL_DIRECTORIES) end - + ERL_SOURCES = FileList['lib/*/src/*.erl'] ERL_BEAM = ERL_SOURCES.pathmap("%{src,ebin}X.beam") @@ -174,7 +174,7 @@ namespace :erlang do directory "applications" CLEAN.include "release_local" - ERL_DIRECTORIES.each do |d| + ERL_DIRECTORIES.each do |d| directory d CLEAN.include d end @@ -182,51 +182,51 @@ namespace :erlang do CLEAN.include("lib/*/test/*.beam") CLEAN.include("lib/*/cover") - def beam_dependencies_with_emake(beam, file) + def beam_dependencies_with_emake(beam, file) dependencies = check_dependencies(file).uniq dependencies.collect { |dependency| ["#{beam}: #{dependency}", "Emakefile: #{dependency}"] } + ["#{beam} : #{file}", "#{beam}: Emakefile"] end - def beam_dependencies(beam, file) + def beam_dependencies(beam, file) dependencies = check_dependencies(file).uniq dependencies.collect { |dependency| ["#{beam}: #{dependency}"] } + ["#{beam} : #{file}"] end - if USE_EMAKE + if USE_EMAKE def erlang_test_dependencies FileList['lib/*/test/*.erl'].collect { |file| beam = file.pathmap("%X.beam") - beam_dependencies_with_emake(beam, file) + beam_dependencies_with_emake(beam, file) }.flatten end - + def erlang_source_dependencies FileList['lib/*/src/*.erl'].collect { |file| beam = file.pathmap("%{src,ebin}X.beam") beam_dependencies_with_emake(beam, file) }.flatten end - + file "Emakefile" => ERL_SOURCES + ERL_TESTS do |t| source_directories = t.prerequisites.collect { |elt| elt.pathmap("%d")} File.open("Emakefile",'w') do |file| - + source_directories.uniq.each do |elt| target_directory = elt.pathmap("%{src,ebin}X") options = ["{outdir,\"#{target_directory}\"}", "{i, \"lib\"}", "{i,\"lib/*/include\"}"] + EMAKE_COMPILE_OPTIONS - option_string = "[#{options.join(',')}]" + option_string = "[#{options.join(',')}]" file.write("{\"#{elt}/*\",#{option_string}}.\n") end end end CLEAN.include "Emakefile" - + desc "Compile Erlang sources" task :modules => ERL_DIRECTORIES + ERL_BEAM + ERL_BEAM_TESTS do sh "#{ERL_TOP}/bin/erl -noinput -s make all -s erlang halt " @@ -239,14 +239,14 @@ namespace :erlang do beam_dependencies(beam, file) }.flatten end - + def erlang_source_dependencies FileList['lib/*/src/*.erl'].collect { |file| beam = file.pathmap("%{src,ebin}X.beam") beam_dependencies(beam, file) }.flatten end - + rule ".beam" => ["%{ebin,src}X.erl"] do |t| output = t.name.pathmap("%d") sh "#{ERL_TOP}/bin/erlc -Ilib #{ERLC_FLAGS} -o #{output} #{t.source}" @@ -273,7 +273,7 @@ namespace :erlang do def release_to_src(a) if a =~ /^release/ [ERL_RELEASE_FILES_DEP[a], a.pathmap("%d") ] - else + else [ERL_RELEASE_FILES_DEP[a], a.pathmap("%d") ] end diff --git a/rakelib/escripts/make_doc b/rakelib/escripts/make_doc index 2e2b5e4..aab931a 100644 --- a/rakelib/escripts/make_doc +++ b/rakelib/escripts/make_doc @@ -10,7 +10,7 @@ main([Application| Paths]) -> end; main(_) -> usage(). - + usage() -> io:format("usage: make_doc \n"), halt(1). diff --git a/rakelib/escripts/make_release b/rakelib/escripts/make_release index aad707e..6e948c9 100644 --- a/rakelib/escripts/make_release +++ b/rakelib/escripts/make_release @@ -11,7 +11,7 @@ main([Script, Output | Paths]) -> end; main(_) -> usage(). - + usage() -> io:format("usage: make_release []\n"), halt(1). diff --git a/rakelib/escripts/make_release_file b/rakelib/escripts/make_release_file index f2cfddd..5f09dbc 100644 --- a/rakelib/escripts/make_release_file +++ b/rakelib/escripts/make_release_file @@ -12,7 +12,7 @@ main([File_in, File_out, VSN | Paths]) -> exit({E,R,erlang:get_stacktrace()}) end. -update_release_info({release, +update_release_info({release, {Name, _}, {erts, _}, Applications}, VSN, Erts_version) -> diff --git a/rakelib/escripts/make_script b/rakelib/escripts/make_script index 87fde4c..77490f5 100644 --- a/rakelib/escripts/make_script +++ b/rakelib/escripts/make_script @@ -19,7 +19,7 @@ main([Style, Script, Outdir|Paths]) -> end; main(_) -> usage(). - + usage() -> io:format("usage: make_script []\n"), halt(1). diff --git a/rakelib/escripts/make_target b/rakelib/escripts/make_target index 4decd55..9ef0b10 100644 --- a/rakelib/escripts/make_target +++ b/rakelib/escripts/make_target @@ -14,14 +14,14 @@ main([Script, Temporary_dir, Output, Erts_dir|Paths]) -> Options = [{outdir, Temporary_dir}, {dirs, []}, {path,Paths}, {erts,Erts_dir}], io:fwrite("Bulding release archive~n"), systools:make_tar(Script, Options), - + file:set_cwd(Temporary_dir), ok = erl_tar:extract(Archive_name, [compressed]), - + io:fwrite("Creating additional directories~n"), [file:make_dir(Dir) || Dir <- ["bin","config","log","pipes"]], - + io:fwrite("Copying binaries~n"), Names = ["run_erl","to_erl"], [copy_to_bin(Erts_version,Name) || Name <- Names], @@ -31,17 +31,17 @@ main([Script, Temporary_dir, Output, Erts_dir|Paths]) -> io:fwrite("Copying configuration scripts~n"), copy_configuration_scripts(Release_config_dir,"bin", VSN_dir), - + io:fwrite("Creating start_erl.data~n"), - file:write_file("releases/start_erl.data", + file:write_file("releases/start_erl.data", io_lib: fwrite("~s ~s",[Erts_version, VSN])), - + io:fwrite("Rebuilding archive file~n"), {ok, Tar} = erl_tar:open(Archive_name,[write,compressed]), Directories = ["bin", "config", "log", "pipes", "releases", "lib", "erts-"++ Erts_version], [erl_tar:add(Tar, Dir, [verbose]) || Dir <- Directories], - + erl_tar:close(Tar), file:set_cwd(".."), io:fwrite("Copying archive file to ~p~n",[Output]), @@ -53,7 +53,7 @@ main([Script, Temporary_dir, Output, Erts_dir|Paths]) -> end; main(_) -> usage(). - + usage() -> io:format("usage: make_target []\n"), halt(1). diff --git a/rakelib/escripts/run_test b/rakelib/escripts/run_test index 044954f..ac32ee2 100755 --- a/rakelib/escripts/run_test +++ b/rakelib/escripts/run_test @@ -26,12 +26,12 @@ execution_fun("cover", Application, Type) -> ok = application:load(list_to_atom(Application)), cover(Fun, Options) end. - + run_test(Application, "all_tests") -> eunit:test({application, list_to_atom(Application)},[]); run_test(_, File) -> eunit:test({file, File},[]). - + usage() -> io:format("usage: run_test \"test\"|\"cover\" <\"all_tests\"|test_description_file> \n"), halt(1). @@ -58,9 +58,9 @@ report(Options) -> {App, M, Analyse} end, Results = [F(M) || M <- cover:modules()], - Coverage = cover_to_xml(Results), + Coverage = cover_to_xml(Results), Export = xmerl:export_simple([{cover, Coverage}], xmerl_xml), - + Output_directory = proplists: get_value(output_directory, Options, "."), Directory_name = filename:absname(Output_directory), ok = filelib:ensure_dir(Directory_name), @@ -69,7 +69,7 @@ report(Options) -> Summary_file = filename:join(Output_directory, "cover_tool.xml"), file:write_file(Summary_file, Export), - + HTML_file = fun(M) -> filename:join(Directory_name, atom_to_list(M) ++".COVER.html") end, diff --git a/rakelib/otp_templates/generic_app.erl b/rakelib/otp_templates/generic_app.erl index 3bb55c1..c047a92 100644 --- a/rakelib/otp_templates/generic_app.erl +++ b/rakelib/otp_templates/generic_app.erl @@ -1,5 +1,5 @@ %%%------------------------------------------------------------------- -%%% @author +%%% @author %%% @doc %%% %%% Created : @@ -34,7 +34,7 @@ start(_Type, _StartArgs) -> %% Function: stop(State) -> void() %% Description: This function is called whenever an application %% has stopped. It is intended to be the opposite of Module:start/2 and -%% should do any necessary cleaning up. The return value is ignored. +%% should do any necessary cleaning up. The return value is ignored. %%-------------------------------------------------------------------- stop(_State) -> ok. diff --git a/rakelib/otp_templates/generic_sup.erl b/rakelib/otp_templates/generic_sup.erl index 50851e2..0d695c3 100644 --- a/rakelib/otp_templates/generic_sup.erl +++ b/rakelib/otp_templates/generic_sup.erl @@ -34,9 +34,9 @@ start_link() -> %% Func: init(Args) -> {ok, {SupFlags, [ChildSpec]}} | %% ignore | %% {error, Reason} -%% Description: Whenever a supervisor is started using -%% supervisor:start_link/[2,3], this function is called by the new process -%% to find out about restart strategy, maximum restart frequency and child +%% Description: Whenever a supervisor is started using +%% supervisor:start_link/[2,3], this function is called by the new process +%% to find out about restart strategy, maximum restart frequency and child %% specifications. %%-------------------------------------------------------------------- init([]) -> diff --git a/rakelib/otp_tools.rake b/rakelib/otp_tools.rake index e73ee43..113448e 100644 --- a/rakelib/otp_tools.rake +++ b/rakelib/otp_tools.rake @@ -3,7 +3,7 @@ # Distributed under BSD licence namespace :otp do - + directory "bin" directory "log" directory "pipes" @@ -77,15 +77,15 @@ namespace :otp do "bin/connect_local", "bin/start_local", "bin/start_erl_local"] do |t, args| - - opt = if args.daemon + + opt = if args.daemon "\"-daemon\"" else "\" \"" end rel = ERL_RELEASE_FILES.include("#{args.name}-*.rel").first puts rel - + boot = rel.ext("").pathmap("release_local/%f") conf = rel.pathmap("%d/../release_config/sys") sh "bin/start_local #{boot} #{conf} #{opt} #{ERL_FLAGS}" @@ -105,11 +105,11 @@ namespace :otp do mkdir root_directory + "/priv" mkdir root_directory + "/doc" mkdir root_directory + "/release_config" - File.open(root_directory + "/vsn.config", 'w') do |file| + File.open(root_directory + "/vsn.config", 'w') do |file| file.write("{vsn,\"0.1\"}.\n") file.write("{release_name,\"initial\"}.\n") end - + File.open(root_directory + "/src/" + app_file_name, 'w') do |file| lines = ["{application, " + app_name + ",\n", "[{description, \"\"},\n", @@ -140,11 +140,11 @@ namespace :otp do end # Create some deafult startup scripts - File.open(root_directory + "/release_config/startup.conf", 'w') do |file| + File.open(root_directory + "/release_config/startup.conf", 'w') do |file| file.write("ERL_FLAGS=\"-pa patches +K true -sname #{app_name} -smp auto\"\n") file.write("export ERL_FLAGS\n") end - File.open(root_directory + "/release_config/sys.config", 'w') do |file| + File.open(root_directory + "/release_config/sys.config", 'w') do |file| file.write("[].") end @@ -160,12 +160,12 @@ namespace :otp do CLEAN.include('tmp') CLEAN.include('targets') - + desc "Build an initial empty target system" task :initial_target, :name, :version, :needs => ["erlang:releases"] do |t,args| release_name = FileList.new("lib/*/ebin/"+File.join(args.name+'-'+args.version+'.rel')) release_archive = File.join('tmp',args.name+'-'+args.version+'.tar.gz') - + if release_name.empty? or !File.file?(release_name[0]) puts "The release #{args.name}-#{args.version} doesn't exist" exit(-1) @@ -175,7 +175,7 @@ namespace :otp do FileUtils.makedirs('targets') run_script("make_target", [release_name.ext(""),"tmp","targets",ERL_TOP] + ERL_DIRECTORIES) - + FileUtils.rm_r('tmp') end end