From db44468bff47bf98b5a0fde9620c460424683ecb Mon Sep 17 00:00:00 2001 From: ellemenno Date: Fri, 6 Feb 2015 00:13:47 -0500 Subject: [PATCH 01/26] specify versioning at the module level --- Rakefile | 3 +-- lib/tasks/loomlib.rake | 4 +--- lib/tasks/support.rb | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Rakefile b/Rakefile index 0bc77e5..3ab6db2 100644 --- a/Rakefile +++ b/Rakefile @@ -12,11 +12,10 @@ def installed_tasks_dir() File.join(Dir.home, '.loom', 'tasks') end - task :default => :list_targets task :list_targets do |t, args| - a = "#{File.basename(File.dirname(__FILE__))} Rakefile" + a = "LoomTasks v#{VERSION} Rakefile" b = "running on Ruby #{RUBY_VERSION}" puts "#{a} #{b}" system("rake -T") diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 143f76c..7f294dc 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -8,8 +8,6 @@ # # load(File.join(ENV['HOME'], '.loom', 'tasks', 'loomlib.rake')) -LOOMLIB_VERSION = '1.0.0' - require 'etc' require 'fileutils' require 'json' @@ -81,7 +79,7 @@ task :list_targets => :check_consts do |t, args| d = "test=#{test_config['sdk_version']}" puts "#{a} #{b} (#{c}, #{d})" system("rake -T") - puts "(using #{File.basename(__FILE__)} v#{LOOMLIB_VERSION})" + puts "(using #{File.basename(__FILE__)} v#{LoomTasks::VERSION})" puts '' end diff --git a/lib/tasks/support.rb b/lib/tasks/support.rb index d873a06..27ce529 100644 --- a/lib/tasks/support.rb +++ b/lib/tasks/support.rb @@ -1,6 +1,8 @@ module LoomTasks + VERSION = '1.0.1' + EXIT_OK = 0 def exec_with_echo(cmd) From 0f5a88f0eef1ba137ea027c5476abcf5ddf6647a Mon Sep 17 00:00:00 2001 From: ellemenno Date: Fri, 6 Feb 2015 00:15:10 -0500 Subject: [PATCH 02/26] improve log statements; mention that README is being touched --- Rakefile | 6 +++--- lib/tasks/loomlib.rake | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 3ab6db2..747b4d8 100644 --- a/Rakefile +++ b/Rakefile @@ -22,7 +22,7 @@ task :list_targets do |t, args| puts '' end -desc "installs rake tasks for Loom" +desc "installs rake task files for Loom" task :install do |t, args| Dir.mkdir(installed_tasks_dir) unless Dir.exists?(installed_tasks_dir) @@ -35,7 +35,7 @@ end namespace :list do - desc "lists tasks available to install" + desc "lists task files available to install" task :available do |t, args| if Dir.exists?(available_tasks_dir) cmd = "ls -1 #{available_tasks_dir}/" @@ -47,7 +47,7 @@ namespace :list do puts '' end - desc "lists currently installed tasks" + desc "lists currently installed task files" task :installed do |t, args| if Dir.exists?(installed_tasks_dir) cmd = "ls -1 #{installed_tasks_dir}/" diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 7f294dc..2f208e0 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -164,6 +164,7 @@ namespace :lib do ext = '.loomlib' release_dir = 'releases' + puts "[#{t.name}] updating README to reference version #{lib_version}" update_readme_version() Dir.mkdir(release_dir) unless Dir.exists?(release_dir) From 570c96d804524852621b2e40ad9ba474581fffcd Mon Sep 17 00:00:00 2001 From: ellemenno Date: Fri, 6 Feb 2015 00:16:01 -0500 Subject: [PATCH 03/26] raise error when loom lib version cannot be found in source file --- lib/tasks/support.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tasks/support.rb b/lib/tasks/support.rb index 27ce529..f176cd1 100644 --- a/lib/tasks/support.rb +++ b/lib/tasks/support.rb @@ -37,7 +37,11 @@ def lib_version_regex() end def lib_version() - File.open(lib_version_file, 'r') { |f| f.read.scan(lib_version_regex).first[0] } + File.open(lib_version_file, 'r') do |f| + matches = f.read.scan(lib_version_regex) + raise("No version const defined in #{lib_version_file}") if matches.empty? + matches.first[0] + end end def readme_version_regex() From 289e7dc609a42d9c642bd206e312bbb2843e3483 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Fri, 6 Feb 2015 04:19:47 -0500 Subject: [PATCH 04/26] move utf-8 encoding specifier to correct file --- lib/tasks/loomlib.rake | 1 - lib/tasks/support.rb | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 2f208e0..58701d5 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -1,4 +1,3 @@ -# encoding: utf-8 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # loomlib.rake - common Rake tasks for loomlib projects diff --git a/lib/tasks/support.rb b/lib/tasks/support.rb index f176cd1..000ca5b 100644 --- a/lib/tasks/support.rb +++ b/lib/tasks/support.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 module LoomTasks From 9938950492a0a2ffe57d0a8d163d8a7766896641 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Sat, 7 Feb 2015 23:47:41 -0500 Subject: [PATCH 05/26] add helper methods for determining OS --- lib/tasks/support.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/tasks/support.rb b/lib/tasks/support.rb index 000ca5b..798c181 100644 --- a/lib/tasks/support.rb +++ b/lib/tasks/support.rb @@ -1,5 +1,7 @@ # encoding: utf-8 +require 'rbconfig' + module LoomTasks VERSION = '1.0.1' @@ -60,4 +62,15 @@ def update_readme_version() ) end + def windows? + return false if RUBY_PLATFORM =~ /cygwin/ # i386-cygwin + return true if ENV['OS'] == 'Windows_NT' + false + end + + def osx? + return true if RUBY_PLATFORM =~ /darwin/ + false + end + end From 18596681f5c340892a4bdcf5760f10dace3482a9 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Sat, 7 Feb 2015 23:54:37 -0500 Subject: [PATCH 06/26] add convenience methods for the loom sdks tools --- lib/tasks/support.rb | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/lib/tasks/support.rb b/lib/tasks/support.rb index 798c181..28b1fec 100644 --- a/lib/tasks/support.rb +++ b/lib/tasks/support.rb @@ -4,7 +4,7 @@ module LoomTasks - VERSION = '1.0.1' + VERSION = '1.1.0' EXIT_OK = 0 @@ -19,14 +19,39 @@ def fail(message) abort("✘ #{message}") end - def sdk_root() - File.join(Dir.home, '.loom', 'sdks') - end - def try(cmd, failure_message) fail(failure_message) if (exec_with_echo(cmd) != EXIT_OK) end + def loomexec(sdk_version) + "#{sdk_root}/#{sdk_version}/tools/loomexec" + end + + def loomlaunch_win(sdk_version) + exe = File.join(sdk_root, sdk_version, 'bin', 'LoomDemo.exe') + %(start "Loom" #{exe} ProcessID #{Process.pid}) + end + + def loomlaunch_osx(sdk_version) + File.join(sdk_root, sdk_version, 'bin', 'LoomDemo.app', 'Contents', 'MacOS', 'LoomDemo') + end + + def loomlaunch(sdk_version) + # needs to be run in the project root + # magically, the launcher loads bin/Main.loom from the current working directory + return loomlaunch_osx if osx? + return loomlaunch_win if windows? + end + + def lsc(sdk_version) + # needs to be run in the project root + "#{sdk_root}/#{sdk_version}/tools/lsc" + end + + def sdk_root() + File.join(Dir.home, '.loom', 'sdks') + end + def parse_loom_config(file) JSON.parse(File.read(file)) end From 576f5475b1cd19ecbc1e9c8dbd5f9c69cb422c3b Mon Sep 17 00:00:00 2001 From: ellemenno Date: Sat, 7 Feb 2015 23:56:21 -0500 Subject: [PATCH 07/26] use the sdk tools convenience methods from support.rb --- lib/tasks/loomlib.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 58701d5..687de49 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -101,7 +101,7 @@ file LIBRARY do |t, args| Dir.chdir('lib') do Dir.mkdir('build') unless Dir.exists?('build') - cmd = "#{sdk_root}/#{sdk_version}/tools/lsc #{const_lib_name}.build" + cmd = "#{lsc(sdk_version)} #{const_lib_name}.build" try(cmd, "failed to compile .loomlib") end @@ -125,7 +125,7 @@ file APP => LIBRARY do |t, args| Dir.chdir('test') do Dir.mkdir('bin') unless Dir.exists?('bin') - cmd = "#{sdk_root}/#{sdk_version}/tools/lsc #{const_lib_name}Test.build" + cmd = "#{lsc(sdk_version)} #{const_lib_name}Test.build" try(cmd, "failed to compile .loom") end @@ -228,7 +228,7 @@ namespace :test do puts "[#{t.name}] running #{t.prerequisites[0]}..." sdk_version = test_config['sdk_version'] - cmd = "#{sdk_root}/#{sdk_version}/tools/loomexec test/bin/#{const_lib_name}Test.loom --format ansi" + cmd = "#{loomexec(sdk_version)} test/bin/#{const_lib_name}Test.loom --format ansi" try(cmd, "failed to run .loom") puts '' @@ -239,7 +239,7 @@ namespace :test do puts "[#{t.name}] running #{t.prerequisites[0]}..." sdk_version = test_config['sdk_version'] - cmd = "#{sdk_root}/#{sdk_version}/tools/loomexec test/bin/#{const_lib_name}Test.loom --format junit --format console" + cmd = "#{loomexec(sdk_version)} test/bin/#{const_lib_name}Test.loom --format junit --format console" try(cmd, "failed to run .loom") puts '' From 0dff7eff7c9b28c49540fc43a2f48d6fdca377ac Mon Sep 17 00:00:00 2001 From: ellemenno Date: Sun, 8 Feb 2015 00:06:36 -0500 Subject: [PATCH 08/26] add loomlib_demo for launching a gui or cli demo of the loomlib --- README.md | 23 ++++++++++- lib/tasks/loomlib.rake | 6 ++- lib/tasks/loomlib_demo.rake | 79 +++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 lib/tasks/loomlib_demo.rake diff --git a/README.md b/README.md index e020537..e8d87d4 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,26 @@ This is used to name the loomlib that gets compiled (and anticipates a correspon * the test application source code is under `test/src/app/` * the specification source code is under `test/src/spec/` +##### demo + +`demo/` is for a functional demonstration app. It may be GUI or commandline.
+Support for demo tasks comes from `loomlib_demo.rake`. + + └─test + ├─assets + ├─bin + │ └─FooTest.loom + ├─loom.config + └─src + ├─demo + │ └─FooDemo.ls + └─FooDemo.build + +* the demo application wil be built into `test/bin/` +* the demo shares its loom config file with the test app at `test/loom.config` +* the demo has its own loom build file at `test/src/FooDemo.build` +* the demo source code is under `test/src/demo/` + ## installation @@ -104,9 +124,10 @@ Then load the tasks: ```ruby load(File.join(ENV['HOME'], '.loom', 'tasks', 'loomlib.rake')) +load(File.join(ENV['HOME'], '.loom', 'tasks', 'loomlib_demo.rake')) # optional ``` -> Note: your whole Rakefile may be just those three lines if there isn't anything else you need to do +> Note: your whole Rakefile may be just those three or four lines if there isn't anything else you need to do Now run `rake` to execute the default task, which will print the list of available tasks and some useful info: diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 687de49..8357424 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -111,7 +111,11 @@ end APP = "test/bin/#{const_lib_name}Test.loom" -FileList['test/src/**/*.ls'].each do |src| +FileList['test/src/app/*.ls'].each do |src| + file APP => src +end + +FileList['test/src/spec/*.ls'].each do |src| file APP => src end diff --git a/lib/tasks/loomlib_demo.rake b/lib/tasks/loomlib_demo.rake new file mode 100644 index 0000000..1233d42 --- /dev/null +++ b/lib/tasks/loomlib_demo.rake @@ -0,0 +1,79 @@ + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# loomlib_demo.rake - adds support for a GUI demo of the loomlib +# +# usage +# add the following to your project's Rakefile: +# +# load(File.join(ENV['HOME'], '.loom', 'tasks', 'loomlib_demo.rake')) + +require 'fileutils' + +require File.join(File.dirname(__FILE__), 'support') +include LoomTasks + +DEMO = "test/bin/#{const_lib_name}Demo.loom" + +FileList['test/src/demo/*.ls'].each do |src| + file DEMO => src +end + +file DEMO => LIBRARY do |t, args| + puts "[file] creating #{t.name}..." + + sdk_version = test_config['sdk_version'] + file_installed = "#{sdk_root}/#{sdk_version}/libs/#{const_lib_name}.loomlib" + + Rake::Task['lib:install'].invoke unless FileUtils.uptodate?(file_installed, [LIBRARY]) + + Dir.chdir('test') do + Dir.mkdir('bin') unless Dir.exists?('bin') + cmd = "#{lsc(sdk_version)} #{const_lib_name}Demo.build" + try(cmd, "failed to compile .loom") + end + + puts '' +end + +namespace :demo do + + desc "builds #{const_lib_name}Demo.loom with the SDK specified in test/loom.config" + task :build => DEMO do |t, args| + puts "[#{t.name}] task completed, find .loom in test/bin/" + puts '' + end + + desc "launches #{const_lib_name}Demo.loom as a GUI app" + task :gui => DEMO do |t, args| + puts "[#{t.name}] launching #{t.prerequisites[0]}..." + + sdk_version = test_config['sdk_version'] + + Dir.chdir('test') do + loomlib = "bin/#{const_lib_name}Demo.loom" + abort("could not find '#{loomlib}'' to launch") unless File.exists?(loomlib) + + # loomlaunch expects to find Main.loom, so we make a launchable copy here + FileUtils.cp("bin/#{loomlib}", 'bin/Main.loom') + + cmd = loomlaunch(sdk_version) + try(cmd, "failed to launch .loom") + end + + puts '' + end + + desc "executes #{const_lib_name}Demo.loom as a commandline app, with options" + task :cli, [:options] => DEMO do |t, args| + args.with_defaults(:options => '') + puts "[#{t.name}] executing #{t.prerequisites[0]}..." + + sdk_version = test_config['sdk_version'] + + cmd = "#{loomexec(sdk_version)} test/bin/#{const_lib_name}Demo.loom #{args.options}" + try(cmd, "failed to run .loom") + + puts '' + end + +end From 7a7ab0d87a8ae0c00095bd1e9a56f82d95d7bfb4 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Sun, 8 Feb 2015 00:09:36 -0500 Subject: [PATCH 09/26] replace OS-specific shell commands with cross-platform ruby equivalents --- Rakefile | 12 ++++++------ lib/tasks/loomlib.rake | 13 ++++++------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Rakefile b/Rakefile index 747b4d8..d710a23 100644 --- a/Rakefile +++ b/Rakefile @@ -26,8 +26,8 @@ desc "installs rake task files for Loom" task :install do |t, args| Dir.mkdir(installed_tasks_dir) unless Dir.exists?(installed_tasks_dir) - cmd = "cp lib/tasks/*.rake lib/tasks/*.rb #{installed_tasks_dir}" - try(cmd, "failed to install tasks") + FileUtils.cp_r(Dir.glob(File.join('lib', 'tasks', '*.rake')), installed_tasks_dir) + FileUtils.cp_r(Dir.glob(File.join('lib', 'tasks', '*.rb')), installed_tasks_dir) puts "[#{t.name}] task completed, tasks installed to #{installed_tasks_dir}" puts '' @@ -38,8 +38,8 @@ namespace :list do desc "lists task files available to install" task :available do |t, args| if Dir.exists?(available_tasks_dir) - cmd = "ls -1 #{available_tasks_dir}/" - try(cmd, "failed to list contents of #{available_tasks_dir} directory") + puts("available tasks in #{available_tasks_dir}") + Dir.glob("#{available_tasks_dir}/*").each { |f| puts(File.basename(f)) } else puts "[#{t.name}] no tasks are installed at #{available_tasks_dir}" end @@ -50,8 +50,8 @@ namespace :list do desc "lists currently installed task files" task :installed do |t, args| if Dir.exists?(installed_tasks_dir) - cmd = "ls -1 #{installed_tasks_dir}/" - try(cmd, "failed to list contents of #{installed_tasks_dir} directory") + puts("installed tasks in #{installed_tasks_dir}") + Dir.glob("#{installed_tasks_dir}/*").each { |f| puts(File.basename(f)) } else puts "[#{t.name}] no tasks are installed at #{installed_tasks_dir}" end diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 8357424..715bc24 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -181,12 +181,11 @@ namespace :lib do desc "installs #{const_lib_name}.loomlib into the SDK specified in lib/loom.config" task :install => LIBRARY do |t, args| - lib = "lib/build/#{const_lib_name}.loomlib" sdk_version = lib_config['sdk_version'] + lib = "lib/build/#{const_lib_name}.loomlib" libs_path = "#{sdk_root}/#{sdk_version}/libs" - cmd = "cp #{lib} #{libs_path}" - try(cmd, "failed to install lib") + FileUtils.cp(lib, libs_path) puts "[#{t.name}] task completed, #{const_lib_name}.loomlib installed for #{sdk_version}" puts '' @@ -198,8 +197,7 @@ namespace :lib do lib = "#{sdk_root}/#{sdk_version}/libs/#{const_lib_name}.loomlib" if (File.exists?(lib)) - cmd = "rm -f #{lib}" - try(cmd, "failed to remove lib") + FileUtils.rm_r(lib) puts "[#{t.name}] task completed, #{const_lib_name}.loomlib removed from #{sdk_version}" else puts "[#{t.name}] nothing to do; no #{const_lib_name}.loomlib found in #{sdk_version} sdk" @@ -211,8 +209,9 @@ namespace :lib do task :show do |t, args| sdk_version = lib_config['sdk_version'] - cmd = "ls -1 #{sdk_root}/#{sdk_version}/libs" - try(cmd, "failed to list contents of #{sdk_version} libs directory") + libs_dir = File.join(sdk_root, sdk_version, 'libs') + puts("installed libs in #{libs_dir}") + Dir.glob("#{libs_dir}/*").each { |f| puts(File.basename(f)) } puts '' end From aad5ca68ef7d2ae6f5f8e0e6a573aaf992911bc6 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Sun, 8 Feb 2015 00:10:45 -0500 Subject: [PATCH 10/26] add verbose detail to task descriptions, for viewing with rake -D --- Rakefile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index d710a23..8bb253a 100644 --- a/Rakefile +++ b/Rakefile @@ -20,9 +20,14 @@ task :list_targets do |t, args| puts "#{a} #{b}" system("rake -T") puts '' + puts 'use `rake -D` for more detailed task descriptions' + puts '' end -desc "installs rake task files for Loom" +desc [ + "installs rake task files for Loom", + "task files are installed to #{installed_tasks_dir}" +].join("\n") task :install do |t, args| Dir.mkdir(installed_tasks_dir) unless Dir.exists?(installed_tasks_dir) @@ -35,7 +40,10 @@ end namespace :list do - desc "lists task files available to install" + desc [ + "lists task files available to install", + "task files from this project are in #{available_tasks_dir}" + ].join("\n") task :available do |t, args| if Dir.exists?(available_tasks_dir) puts("available tasks in #{available_tasks_dir}") @@ -47,7 +55,10 @@ namespace :list do puts '' end - desc "lists currently installed task files" + desc [ + "lists currently installed task files", + "installed task files are in #{installed_tasks_dir}" + ].join("\n") task :installed do |t, args| if Dir.exists?(installed_tasks_dir) puts("installed tasks in #{installed_tasks_dir}") @@ -61,7 +72,11 @@ namespace :list do end -desc "removes the tasks folder from the Loom SDK" +desc [ + "removes the tasks folder from the Loom home directory", + "the task folder is #{installed_tasks_dir}", + "the entire tasks folder is removed, so use with caution if you happened to put anything in there", +].join("\n") task :uninstall do |t, args| FileUtils.rm_r(installed_tasks_dir) if Dir.exists?(installed_tasks_dir) From 8c1f7d31cd4c4cd6b80b4cdf17e3faaa3d27ccf0 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Sun, 8 Feb 2015 00:11:26 -0500 Subject: [PATCH 11/26] add descriptions for sub directories of expected folder layout --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e8d87d4..c9544ae 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,9 @@ The loomlib rake tasks make the following assumptions about the layout of a proj #### lib +`lib/` is for the library code, which will be packaged into a `.loomlib` file for installation into a LoomSDK.
+Support for test tasks comes from `loomlib.rake`. + ├─lib │ ├─assets │ ├─bin @@ -60,6 +63,9 @@ This is used to name the loomlib that gets compiled (and anticipates a correspon #### test +`test/` is for unit tests of the library code. The tests are not packaged with the loomlib; they are run from a separate test runner app.
+Support for test tasks comes from `loomlib.rake`. + └─test ├─assets ├─bin @@ -74,7 +80,7 @@ This is used to name the loomlib that gets compiled (and anticipates a correspon * the test application wil be built into `test/bin/` * the tests have their own loom config file at `test/loom.config` -* the tests have their own loom build file at `test/src/Foo.build` +* the tests have their own loom build file at `test/src/FooTest.build` * the test application source code is under `test/src/app/` * the specification source code is under `test/src/spec/` From cbafedef5aec6572ec91af1db245dd791fdacb17 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Sun, 8 Feb 2015 21:48:12 -0500 Subject: [PATCH 12/26] add missing argument to function call --- lib/tasks/support.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/support.rb b/lib/tasks/support.rb index 28b1fec..f9fad78 100644 --- a/lib/tasks/support.rb +++ b/lib/tasks/support.rb @@ -39,8 +39,8 @@ def loomlaunch_osx(sdk_version) def loomlaunch(sdk_version) # needs to be run in the project root # magically, the launcher loads bin/Main.loom from the current working directory - return loomlaunch_osx if osx? - return loomlaunch_win if windows? + return loomlaunch_osx(sdk_version) if osx? + return loomlaunch_win(sdk_version) if windows? end def lsc(sdk_version) From 4b207ff06acc9cdbda5e6dc94c5881c0f1442f4a Mon Sep 17 00:00:00 2001 From: ellemenno Date: Sun, 8 Feb 2015 21:48:54 -0500 Subject: [PATCH 13/26] remove redundant parent directory from path already containing it --- lib/tasks/loomlib_demo.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/loomlib_demo.rake b/lib/tasks/loomlib_demo.rake index 1233d42..126bfd9 100644 --- a/lib/tasks/loomlib_demo.rake +++ b/lib/tasks/loomlib_demo.rake @@ -54,7 +54,7 @@ namespace :demo do abort("could not find '#{loomlib}'' to launch") unless File.exists?(loomlib) # loomlaunch expects to find Main.loom, so we make a launchable copy here - FileUtils.cp("bin/#{loomlib}", 'bin/Main.loom') + FileUtils.cp(loomlib, 'bin/Main.loom') cmd = loomlaunch(sdk_version) try(cmd, "failed to launch .loom") From 8cb0d16f2425897bb7525864e2f360585b874840 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Mon, 9 Feb 2015 23:01:47 -0500 Subject: [PATCH 14/26] move src dependency declarations after target declaration --- lib/tasks/loomlib.rake | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 715bc24..f08f1ab 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -90,10 +90,6 @@ end LIBRARY = "lib/build/#{const_lib_name}.loomlib" -FileList['lib/src/**/*.ls'].each do |src| - file LIBRARY => src -end - file LIBRARY do |t, args| puts "[file] creating #{t.name}..." @@ -108,16 +104,12 @@ file LIBRARY do |t, args| puts '' end - -APP = "test/bin/#{const_lib_name}Test.loom" - -FileList['test/src/app/*.ls'].each do |src| - file APP => src +FileList['lib/src/**/*.ls'].each do |src| + file LIBRARY => src end -FileList['test/src/spec/*.ls'].each do |src| - file APP => src -end + +APP = "test/bin/#{const_lib_name}Test.loom" file APP => LIBRARY do |t, args| puts "[file] creating #{t.name}..." @@ -136,6 +128,14 @@ file APP => LIBRARY do |t, args| puts '' end +FileList['test/src/app/*.ls'].each do |src| + file APP => src +end + +FileList['test/src/spec/*.ls'].each do |src| + file APP => src +end + desc "sets the provided SDK version into lib/loom.config and test/loom.config" task :set, [:sdk] => 'lib:uninstall' do |t, args| From 7bfb7e29515b6fb501f379640eeddbefc054571e Mon Sep 17 00:00:00 2001 From: ellemenno Date: Mon, 9 Feb 2015 23:03:30 -0500 Subject: [PATCH 15/26] clean up file pathing to use File.join --- lib/tasks/loomlib.rake | 9 ++++----- lib/tasks/support.rb | 8 ++++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index f08f1ab..13e523b 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -115,7 +115,7 @@ file APP => LIBRARY do |t, args| puts "[file] creating #{t.name}..." sdk_version = test_config['sdk_version'] - file_installed = "#{sdk_root}/#{sdk_version}/libs/#{const_lib_name}.loomlib" + file_installed = File.join(libs_path(sdk_version), "#{const_lib_name}.loomlib") Rake::Task['lib:install'].invoke unless FileUtils.uptodate?(file_installed, [LIBRARY]) @@ -182,10 +182,9 @@ namespace :lib do desc "installs #{const_lib_name}.loomlib into the SDK specified in lib/loom.config" task :install => LIBRARY do |t, args| sdk_version = lib_config['sdk_version'] - lib = "lib/build/#{const_lib_name}.loomlib" - libs_path = "#{sdk_root}/#{sdk_version}/libs" + lib = File.join('lib', 'build', "#{const_lib_name}.loomlib") - FileUtils.cp(lib, libs_path) + FileUtils.cp(lib, libs_path(sdk_version)) puts "[#{t.name}] task completed, #{const_lib_name}.loomlib installed for #{sdk_version}" puts '' @@ -194,7 +193,7 @@ namespace :lib do desc "removes #{const_lib_name}.loomlib from the SDK specified in lib/loom.config" task :uninstall do |t, args| sdk_version = lib_config['sdk_version'] - lib = "#{sdk_root}/#{sdk_version}/libs/#{const_lib_name}.loomlib" + lib = File.join(libs_path(sdk_version), "#{const_lib_name}.loomlib") if (File.exists?(lib)) FileUtils.rm_r(lib) diff --git a/lib/tasks/support.rb b/lib/tasks/support.rb index f9fad78..05b8784 100644 --- a/lib/tasks/support.rb +++ b/lib/tasks/support.rb @@ -24,7 +24,7 @@ def try(cmd, failure_message) end def loomexec(sdk_version) - "#{sdk_root}/#{sdk_version}/tools/loomexec" + File.join(sdk_root, sdk_version, 'tools', 'loomexec') end def loomlaunch_win(sdk_version) @@ -45,7 +45,7 @@ def loomlaunch(sdk_version) def lsc(sdk_version) # needs to be run in the project root - "#{sdk_root}/#{sdk_version}/tools/lsc" + File.join(sdk_root, sdk_version, 'tools', 'lsc') end def sdk_root() @@ -72,6 +72,10 @@ def lib_version() end end + def libs_path(sdk_version) + File.join(sdk_root, sdk_version, 'libs') + end + def readme_version_regex() Regexp.new(%q/download\/v(\d\.\d\.\d)/) end From fbe32af0f706e1c2e969f886decc18ddc0c202e0 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Mon, 9 Feb 2015 23:06:43 -0500 Subject: [PATCH 16/26] add detail to descriptions, for rendering with rake -D --- lib/tasks/loomlib.rake | 60 ++++++++++++++++++++++++++++++------- lib/tasks/loomlib_demo.rake | 16 ++++++++-- 2 files changed, 63 insertions(+), 13 deletions(-) diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 13e523b..6fab67b 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -65,8 +65,16 @@ end @test_loom_config = nil CLEAN.include ['lib/build/**', 'test/bin/**'] +Rake::Task[:clean].clear_comments() +Rake::Task[:clean].add_description("removes intermediate files to ensure a clean build") +Rake::Task[:clean].add_description("running now would delete #{CLEAN.length} files:\n #{CLEAN.join("\n ")}") + CLOBBER.include ['lib/build', 'test/bin', 'releases'] -Rake::Task[:clobber].enhance ['lib:uninstall'] +Rake::Task[:clobber].enhance(['lib:uninstall']) +Rake::Task[:clobber].clear_comments() +Rake::Task[:clobber].add_description("removes all generated artifacts to restore project to clean checkout like state") +Rake::Task[:clobber].add_description("uninstalls the library from the current lib sdk (#{lib_config['sdk_version']})") +Rake::Task[:clobber].add_description("removes the following folders:\n #{CLOBBER.join("\n ")}") task :default => :list_targets @@ -80,6 +88,8 @@ task :list_targets => :check_consts do |t, args| system("rake -T") puts "(using #{File.basename(__FILE__)} v#{LoomTasks::VERSION})" puts '' + puts 'use `rake -D` for more detailed task descriptions' + puts '' end task :check_consts do |t, args| @@ -137,7 +147,11 @@ FileList['test/src/spec/*.ls'].each do |src| end -desc "sets the provided SDK version into lib/loom.config and test/loom.config" +desc [ + "sets the provided SDK version into lib/loom.config and test/loom.config", + "lib/loom.config defines which SDK will be used to compile the loomlib, and also where to install it", + "test/loom.config defines which SDK will be used to compile the test app and demo app", +].join("\n") task :set, [:sdk] => 'lib:uninstall' do |t, args| args.with_defaults(:sdk => 'sprint33') sdk_version = args.sdk @@ -154,13 +168,21 @@ end namespace :lib do - desc "builds #{const_lib_name}.loomlib for the SDK specified in lib/loom.config" + desc [ + "builds #{const_lib_name}.loomlib for the SDK specified in lib/loom.config (#{lib_config['sdk_version']})", + "you can change the SDK with rake set[sdk]", + "the .loomlib binary is created in lib/build", + ].join("\n") task :build => LIBRARY do |t, args| puts "[#{t.name}] task completed, find .loomlib in lib/build/" puts '' end - desc "prepares sdk-specific #{const_lib_name}.loomlib for release" + desc [ + "prepares sdk-specific #{const_lib_name}.loomlib for release, and updates version in README", + "the version value will be read from #{LIB_VERSION_FILE}", + "it must match this regex: #{lib_version_regex}", + ].join("\n") task :release => LIBRARY do |t, args| lib = "lib/build/#{const_lib_name}.loomlib" sdk = lib_config['sdk_version'] @@ -179,7 +201,9 @@ namespace :lib do puts '' end - desc "installs #{const_lib_name}.loomlib into the SDK specified in lib/loom.config" + desc [ + "installs #{const_lib_name}.loomlib into the SDK specified in lib/loom.config (#{lib_config['sdk_version']})", + ].join("\n") task :install => LIBRARY do |t, args| sdk_version = lib_config['sdk_version'] lib = File.join('lib', 'build', "#{const_lib_name}.loomlib") @@ -190,7 +214,9 @@ namespace :lib do puts '' end - desc "removes #{const_lib_name}.loomlib from the SDK specified in lib/loom.config" + desc [ + "removes #{const_lib_name}.loomlib from the SDK specified in lib/loom.config (#{lib_config['sdk_version']})", + ].join("\n") task :uninstall do |t, args| sdk_version = lib_config['sdk_version'] lib = File.join(libs_path(sdk_version), "#{const_lib_name}.loomlib") @@ -204,7 +230,10 @@ namespace :lib do puts '' end - desc "lists libs installed for the SDK specified in lib/loom.config" + desc [ + "lists libs installed for #{lib_config['sdk_version']} (the SDK specified in lib/loom.config)", + "you can change the SDK with rake set[sdk]", + ].join("\n") task :show do |t, args| sdk_version = lib_config['sdk_version'] @@ -219,13 +248,20 @@ end namespace :test do - desc "builds #{const_lib_name}Test.loom with the SDK specified in test/loom.config" + desc [ + "builds #{const_lib_name}Test.loom against the SDK specified in test/loom.config (#{test_config['sdk_version']})", + "the .loom binary is created in test/bin", + "you can change the SDK with rake set[sdk]", + ].join("\n") task :build => APP do |t, args| puts "[#{t.name}] task completed, find .loom in test/bin/" puts '' end - desc "runs #{const_lib_name}Test.loom" + desc [ + "runs #{const_lib_name}Test.loom", + "the test runner will print short-form results to stdout", + ].join("\n") task :run => APP do |t, args| puts "[#{t.name}] running #{t.prerequisites[0]}..." @@ -236,7 +272,11 @@ namespace :test do puts '' end - desc "runs #{const_lib_name}Test.loom for CI" + desc [ + "runs #{const_lib_name}Test.loom for CI", + "in CI mode, the test runner will print long-form results to stdout and generate jUnit compatible reports", + "the jUnit xml report files are written to the project root, as TEST-*.xml", + ].join("\n") task :ci => APP do |t, args| puts "[#{t.name}] running #{t.prerequisites[0]}..." diff --git a/lib/tasks/loomlib_demo.rake b/lib/tasks/loomlib_demo.rake index 126bfd9..1d07649 100644 --- a/lib/tasks/loomlib_demo.rake +++ b/lib/tasks/loomlib_demo.rake @@ -37,13 +37,20 @@ end namespace :demo do - desc "builds #{const_lib_name}Demo.loom with the SDK specified in test/loom.config" + desc [ + "builds #{const_lib_name}Demo.loom with the SDK specified in test/loom.config (#{test_config['sdk_version']})", + "you can change the SDK with rake set[sdk]", + "the .loom binary is created in test/bin", + ].join("\n") task :build => DEMO do |t, args| puts "[#{t.name}] task completed, find .loom in test/bin/" puts '' end - desc "launches #{const_lib_name}Demo.loom as a GUI app" + desc [ + "launches #{const_lib_name}Demo.loom as a GUI app", + "use this launcher if your demo application class extends loom.Application", + ].join("\n") task :gui => DEMO do |t, args| puts "[#{t.name}] launching #{t.prerequisites[0]}..." @@ -63,7 +70,10 @@ namespace :demo do puts '' end - desc "executes #{const_lib_name}Demo.loom as a commandline app, with options" + desc [ + "executes #{const_lib_name}Demo.loom as a commandline app, with options", + "use this launcher if your demo application class extends system.application.ConsoleApplication", + ].join("\n") task :cli, [:options] => DEMO do |t, args| args.with_defaults(:options => '') puts "[#{t.name}] executing #{t.prerequisites[0]}..." From 69325f2a22a5d3c7b67d76da994193d380c2522c Mon Sep 17 00:00:00 2001 From: ellemenno Date: Mon, 9 Feb 2015 23:13:26 -0500 Subject: [PATCH 17/26] use single description call to prevent concatenation in list_targets --- lib/tasks/loomlib.rake | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 6fab67b..35ef3c9 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -66,15 +66,19 @@ end CLEAN.include ['lib/build/**', 'test/bin/**'] Rake::Task[:clean].clear_comments() -Rake::Task[:clean].add_description("removes intermediate files to ensure a clean build") -Rake::Task[:clean].add_description("running now would delete #{CLEAN.length} files:\n #{CLEAN.join("\n ")}") +Rake::Task[:clean].add_description([ + "removes intermediate files to ensure a clean build", + "running now would delete #{CLEAN.length} files:\n #{CLEAN.join("\n ")}", +].join("\n")) CLOBBER.include ['lib/build', 'test/bin', 'releases'] Rake::Task[:clobber].enhance(['lib:uninstall']) Rake::Task[:clobber].clear_comments() -Rake::Task[:clobber].add_description("removes all generated artifacts to restore project to clean checkout like state") -Rake::Task[:clobber].add_description("uninstalls the library from the current lib sdk (#{lib_config['sdk_version']})") -Rake::Task[:clobber].add_description("removes the following folders:\n #{CLOBBER.join("\n ")}") +Rake::Task[:clobber].add_description([ + "removes all generated artifacts to restore project to clean checkout like state", + "uninstalls the library from the current lib sdk (#{lib_config['sdk_version']})", + "removes the following folders:\n #{CLOBBER.join("\n ")}", +].join("\n")) task :default => :list_targets From d2bb6889b3729146c67b8382cb783ef32abc4c8a Mon Sep 17 00:00:00 2001 From: ellemenno Date: Mon, 9 Feb 2015 23:34:07 -0500 Subject: [PATCH 18/26] improve task descriptions --- lib/tasks/loomlib.rake | 19 +++++++++++-------- lib/tasks/loomlib_demo.rake | 3 ++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 35ef3c9..f438b8c 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -90,7 +90,7 @@ task :list_targets => :check_consts do |t, args| d = "test=#{test_config['sdk_version']}" puts "#{a} #{b} (#{c}, #{d})" system("rake -T") - puts "(using #{File.basename(__FILE__)} v#{LoomTasks::VERSION})" + puts "(using LoomTasks v#{LoomTasks::VERSION})" puts '' puts 'use `rake -D` for more detailed task descriptions' puts '' @@ -173,7 +173,8 @@ end namespace :lib do desc [ - "builds #{const_lib_name}.loomlib for the SDK specified in lib/loom.config (#{lib_config['sdk_version']})", + "builds #{const_lib_name}.loomlib for #{lib_config['sdk_version']} SDK", + "the SDK is specified in test/loom.config", "you can change the SDK with rake set[sdk]", "the .loomlib binary is created in lib/build", ].join("\n") @@ -206,7 +207,7 @@ namespace :lib do end desc [ - "installs #{const_lib_name}.loomlib into the SDK specified in lib/loom.config (#{lib_config['sdk_version']})", + "installs #{const_lib_name}.loomlib into #{lib_config['sdk_version']} SDK", ].join("\n") task :install => LIBRARY do |t, args| sdk_version = lib_config['sdk_version'] @@ -219,7 +220,7 @@ namespace :lib do end desc [ - "removes #{const_lib_name}.loomlib from the SDK specified in lib/loom.config (#{lib_config['sdk_version']})", + "removes #{const_lib_name}.loomlib from #{lib_config['sdk_version']} SDK", ].join("\n") task :uninstall do |t, args| sdk_version = lib_config['sdk_version'] @@ -235,7 +236,8 @@ namespace :lib do end desc [ - "lists libs installed for #{lib_config['sdk_version']} (the SDK specified in lib/loom.config)", + "lists libs installed for #{lib_config['sdk_version']} SDK", + "the SDK is specified in test/loom.config", "you can change the SDK with rake set[sdk]", ].join("\n") task :show do |t, args| @@ -253,9 +255,10 @@ end namespace :test do desc [ - "builds #{const_lib_name}Test.loom against the SDK specified in test/loom.config (#{test_config['sdk_version']})", - "the .loom binary is created in test/bin", + "builds #{const_lib_name}Test.loom against #{test_config['sdk_version']} SDK", + "the SDK is specified in test/loom.config", "you can change the SDK with rake set[sdk]", + "the .loom binary is created in test/bin", ].join("\n") task :build => APP do |t, args| puts "[#{t.name}] task completed, find .loom in test/bin/" @@ -263,7 +266,7 @@ namespace :test do end desc [ - "runs #{const_lib_name}Test.loom", + "runs #{const_lib_name}Test.loom for the console", "the test runner will print short-form results to stdout", ].join("\n") task :run => APP do |t, args| diff --git a/lib/tasks/loomlib_demo.rake b/lib/tasks/loomlib_demo.rake index 1d07649..ab23e69 100644 --- a/lib/tasks/loomlib_demo.rake +++ b/lib/tasks/loomlib_demo.rake @@ -38,7 +38,8 @@ end namespace :demo do desc [ - "builds #{const_lib_name}Demo.loom with the SDK specified in test/loom.config (#{test_config['sdk_version']})", + "builds #{const_lib_name}Demo.loom for #{test_config['sdk_version']} SDK", + "the SDK is specified in test/loom.config", "you can change the SDK with rake set[sdk]", "the .loom binary is created in test/bin", ].join("\n") From 060e96c9811423b2bd5c40544d4303ab00e42591 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Tue, 10 Feb 2015 00:25:28 -0500 Subject: [PATCH 19/26] add junit xml files to clean list --- lib/tasks/loomlib.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index f438b8c..e6306fe 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -64,7 +64,7 @@ end @lib_loom_config = nil @test_loom_config = nil -CLEAN.include ['lib/build/**', 'test/bin/**'] +CLEAN.include ['lib/build/**', 'test/bin/**', 'TEST-*.xml'] Rake::Task[:clean].clear_comments() Rake::Task[:clean].add_description([ "removes intermediate files to ensure a clean build", From 4e89fdcd46c2f1b9b5620f1c7c9464ccf4f1e446 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Tue, 10 Feb 2015 00:26:45 -0500 Subject: [PATCH 20/26] clean up description text a little; remove unneeded encoding directive --- Rakefile | 1 - lib/tasks/loomlib.rake | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 8bb253a..87dcab8 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,3 @@ -# encoding: utf-8 require File.join(File.dirname(__FILE__), 'lib', 'tasks', 'support') include LoomTasks diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index e6306fe..b6fda4f 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -75,7 +75,7 @@ CLOBBER.include ['lib/build', 'test/bin', 'releases'] Rake::Task[:clobber].enhance(['lib:uninstall']) Rake::Task[:clobber].clear_comments() Rake::Task[:clobber].add_description([ - "removes all generated artifacts to restore project to clean checkout like state", + "removes all generated artifacts to restore project to checkout-like state", "uninstalls the library from the current lib sdk (#{lib_config['sdk_version']})", "removes the following folders:\n #{CLOBBER.join("\n ")}", ].join("\n")) @@ -90,7 +90,7 @@ task :list_targets => :check_consts do |t, args| d = "test=#{test_config['sdk_version']}" puts "#{a} #{b} (#{c}, #{d})" system("rake -T") - puts "(using LoomTasks v#{LoomTasks::VERSION})" + puts "(using loomtasks v#{LoomTasks::VERSION})" puts '' puts 'use `rake -D` for more detailed task descriptions' puts '' From f24eabc39050db589d867ad47f15bec8b8fcbdcf Mon Sep 17 00:00:00 2001 From: ellemenno Date: Tue, 10 Feb 2015 00:27:18 -0500 Subject: [PATCH 21/26] add shortcut test task, alias for test:run --- lib/tasks/loomlib.rake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index b6fda4f..3b30080 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -295,3 +295,8 @@ namespace :test do end end + +desc [ + "shorthand for rake test:run", +].join("\n") +task :test => 'test:run' From e9114c8f87e023dbb64502308af8b75af900e5b4 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Tue, 10 Feb 2015 00:27:57 -0500 Subject: [PATCH 22/26] show new features in README --- README.md | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index c9544ae..ba36c5a 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ LIB_NAME = 'Foo' LIB_VERSION_FILE = File.join('lib', 'src', 'com', 'bar', 'Foo.ls') ``` -Then load the tasks: +Then load the tasks you want to use: ```ruby load(File.join(ENV['HOME'], '.loom', 'tasks', 'loomlib.rake')) @@ -138,20 +138,36 @@ load(File.join(ENV['HOME'], '.loom', 'tasks', 'loomlib_demo.rake')) # optional Now run `rake` to execute the default task, which will print the list of available tasks and some useful info: Foo v1.2.3 Rakefile running on Ruby 2.1.1 (lib=sprint33, test=sprint33) - rake clean # Remove any temporary products - rake clobber # Remove any generated file - rake lib:build # builds Foo.loomlib for the SDK specified in lib/loom.config - rake lib:install # installs Foo.loomlib into the SDK specified in lib/loom.config - rake lib:release # prepares sdk-specific Foo.loomlib for release - rake lib:show # lists libs installed for the SDK specified in lib/loom.config - rake lib:uninstall # removes Foo.loomlib from the SDK specified in lib/loom.config - rake set[sdk] # sets the provided SDK version into lib/loom.config and test/loom.config - rake test:build # builds FooTest.loom with the SDK specified in test/loom.config - rake test:ci # runs FooTest.loom for CI - rake test:run # runs FooTest.loom - (using loomlib.rake v1.0.0) - -The Rake tasks are defined with dependencies and modification triggers, so you can just run `rake test:run` every time you edit a source file, and the library and test app will be rebuilt as needed automatically. + rake clean # removes intermediate files to ensure a clean build + rake clobber # removes all generated artifacts to restore project to checkout-like state + rake demo:build # builds FooDemo.loom for sprint33 SDK + rake demo:cli[options] # executes FooDemo.loom as a commandline app, with options + rake demo:gui # launches FooDemo.loom as a GUI app + rake lib:build # builds Foo.loomlib for sprint33 SDK + rake lib:install # installs Foo.loomlib into sprint33 SDK + rake lib:release # prepares sdk-specific Foo.loomlib for release, and updates version in README + rake lib:show # lists libs installed for sprint33 SDK + rake lib:uninstall # removes Foo.loomlib from sprint33 SDK + rake set[sdk] # sets the provided SDK version into lib/loom.config and test/loom.config + rake test # shorthand for rake test:run + rake test:build # builds FooTest.loom against sprint33 SDK + rake test:ci # runs FooTest.loom for CI + rake test:run # runs FooTest.loom for the console + (using loomtasks v1.1.0) + + use `rake -D` for more detailed task descriptions + +If you are looking for more detail on any of the tasks, use `rake -D`: + +```console +$ rake -D set +rake set[sdk] + sets the provided SDK version into lib/loom.config and test/loom.config + lib/loom.config defines which SDK will be used to compile the loomlib, and also where to install it + test/loom.config defines which SDK will be used to compile the test app and demo app +``` + +The Rake tasks are defined with dependencies and modification triggers, so you can just run `rake test` every time you edit a source file, and the library and test app will be rebuilt as needed automatically. ## contributing From e9962e531b5f95269eda298c5724cc834fd64a65 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Thu, 12 Feb 2015 00:47:26 -0500 Subject: [PATCH 23/26] handle the quit from a GUI app more gracefully --- lib/tasks/loomlib_demo.rake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/tasks/loomlib_demo.rake b/lib/tasks/loomlib_demo.rake index ab23e69..ae9f112 100644 --- a/lib/tasks/loomlib_demo.rake +++ b/lib/tasks/loomlib_demo.rake @@ -64,11 +64,14 @@ namespace :demo do # loomlaunch expects to find Main.loom, so we make a launchable copy here FileUtils.cp(loomlib, 'bin/Main.loom') - cmd = loomlaunch(sdk_version) - try(cmd, "failed to launch .loom") + # capture the interrupt signal from a quit app + begin + cmd = loomlaunch(sdk_version) + try(cmd, "failed to launch .loom") + rescue Exception => e + puts ' (quit)' + end end - - puts '' end desc [ From 027175c03dc153269d1b990878195d9e55913b1a Mon Sep 17 00:00:00 2001 From: ellemenno Date: Thu, 12 Feb 2015 01:01:49 -0500 Subject: [PATCH 24/26] mention how to remove an unwanted task --- lib/tasks/loomlib_demo.rake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/tasks/loomlib_demo.rake b/lib/tasks/loomlib_demo.rake index ae9f112..72ba305 100644 --- a/lib/tasks/loomlib_demo.rake +++ b/lib/tasks/loomlib_demo.rake @@ -51,6 +51,7 @@ namespace :demo do desc [ "launches #{const_lib_name}Demo.loom as a GUI app", "use this launcher if your demo application class extends loom.Application", + "if your demo is a cli app, remove this task from the list with Rake::Task['demo:gui'].clear", ].join("\n") task :gui => DEMO do |t, args| puts "[#{t.name}] launching #{t.prerequisites[0]}..." @@ -77,6 +78,7 @@ namespace :demo do desc [ "executes #{const_lib_name}Demo.loom as a commandline app, with options", "use this launcher if your demo application class extends system.application.ConsoleApplication", + "if your demo is a gui app, remove this task from the list with Rake::Task['demo:cli'].clear", ].join("\n") task :cli, [:options] => DEMO do |t, args| args.with_defaults(:options => '') From 8bafce6a2c9efb663a36351ad95b802914e04fa1 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Thu, 12 Feb 2015 01:02:31 -0500 Subject: [PATCH 25/26] add detail to the lib:install description --- lib/tasks/loomlib.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/loomlib.rake b/lib/tasks/loomlib.rake index 3b30080..e9bbf59 100644 --- a/lib/tasks/loomlib.rake +++ b/lib/tasks/loomlib.rake @@ -208,6 +208,7 @@ namespace :lib do desc [ "installs #{const_lib_name}.loomlib into #{lib_config['sdk_version']} SDK", + "this makes it available to reference in .build files of any project targeting #{lib_config['sdk_version']}", ].join("\n") task :install => LIBRARY do |t, args| sdk_version = lib_config['sdk_version'] From a4c91f8f59087faafa61669aca0daebc06e785e4 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Thu, 12 Feb 2015 01:14:15 -0500 Subject: [PATCH 26/26] make project name all lowercase in rakefile --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 87dcab8..b4d1163 100644 --- a/Rakefile +++ b/Rakefile @@ -14,7 +14,7 @@ end task :default => :list_targets task :list_targets do |t, args| - a = "LoomTasks v#{VERSION} Rakefile" + a = "loomtasks v#{VERSION} Rakefile" b = "running on Ruby #{RUBY_VERSION}" puts "#{a} #{b}" system("rake -T")