lib/teamster-cli.rb in teamster-0.5.2 vs lib/teamster-cli.rb in teamster-0.6.0

- old
+ new

@@ -41,50 +41,50 @@ def ask_user(question) print "#{question}: " STDIN.gets.strip end - def create_module_for(name) - puts "Creating placeholders for module #{name}...\n" - FileUtils.mkdir_p "lib/teamster-modules/#{name}/views" - create_file "lib/teamster-modules/#{name}.rb", "module_placeholder_for", name - create_file "lib/teamster-modules/#{name}/#{name}_helper.rb", "module_helper_placeholder_for", name - create_file "lib/teamster-modules/#{name}/views/#{name}.erb", "view_placeholder_for", name - create_file "lib/teamster-modules/#{name}/views/#{name}_summary.erb", "view_summary_placeholder_for", name - puts "\nBasic module creation done!" - puts "Controller : \"lib/teamster-modules/#{name}.rb\"" - puts "Helper : \"lib/teamster-modules/#{name}/#{name}_helper.rb\"" - puts "View : \"lib/teamster-modules/#{name}/views/#{name}.erb\"" - puts "Summary View : \"lib/teamster-modules/#{name}/views/#{name}_summary.erb\"" + def create_adapter_for(name) + puts "Creating placeholders for adapter #{name}...\n" + FileUtils.mkdir_p "lib/teamster-adapters/#{name}/views" + create_file "lib/teamster-adapters/#{name}.rb", "adapter_placeholder_for", name + create_file "lib/teamster-adapters/#{name}/#{name}_helper.rb", "adapter_helper_placeholder_for", name + create_file "lib/teamster-adapters/#{name}/views/#{name}.erb", "view_placeholder_for", name + create_file "lib/teamster-adapters/#{name}/views/#{name}_summary.erb", "view_summary_placeholder_for", name + puts "\nBasic adapter creation done!" + puts "Controller : \"lib/teamster-adapters/#{name}.rb\"" + puts "Helper : \"lib/teamster-adapters/#{name}/#{name}_helper.rb\"" + puts "View : \"lib/teamster-adapters/#{name}/views/#{name}.erb\"" + puts "Summary View : \"lib/teamster-adapters/#{name}/views/#{name}_summary.erb\"" end - def import_module_for(name) - puts "Importing module: #{name}" + def import_adapter_for(name) + puts "Importing adapter: #{name}" zip_file = "#{name}.zip" if File.exists?(zip_file) if `which unzip`.length != 0 `unzip #{zip_file}` puts "\nSuccessfully imported #{name}. Please restart teamster to use." else - puts "\nUnable to import module. Export depends on cli tool \"unzip\"." + puts "\nUnable to import adapter. Export depends on cli tool \"unzip\"." end else puts "Unable to find file: #{zip_file}" end end - def export_module_for(name) - puts "Exporting module: #{name}" + def export_adapter_for(name) + puts "Exporting adapter: #{name}" zip_file = "#{name}.zip" puts "The following files will be zipped:" - puts "- lib/teamster-modules/#{name}.rb" - puts '- Everything in folder lib/teamster-modules/#{name}/' + puts "- lib/teamster-adapters/#{name}.rb" + puts '- Everything in folder lib/teamster-adapters/#{name}/' if `which zip`.length != 0 - `zip -r #{zip_file} lib/teamster-modules/#{name}.rb lib/teamster-modules/#{name}/` + `zip -r #{zip_file} lib/teamster-adapters/#{name}.rb lib/teamster-adapters/#{name}/` puts "\nExported to #{zip_file}!" else - puts "\nUnable to export module. Export depends on cli tool \"zip\"." + puts "\nUnable to export adapter. Export depends on cli tool \"zip\"." end end def create_file(filename, method, *args) case [File.exists?(filename), !!@config[:overwrite]] @@ -130,13 +130,13 @@ init, start, stop, restart Options (standalone): --help Display this detailed help. --version Version of the teamster used. - --create-module NAME Creates a stub of a module - --import-module FILE << PENDING IMPLEMENTATION >> - --export-module FILE << PENDING IMPLEMENTATION >> + --create-adapter NAME Creates a stub of a adapter + --import-adapter FILE << PENDING IMPLEMENTATION >> + --export-adapter FILE << PENDING IMPLEMENTATION >> Options used with \"start\": --prod Binds a unix socket to be used by a web server (eg. Nginx) and creates a state file @@ -162,33 +162,33 @@ Dir.glob("lib/*.rb").each {|file| require File.absolute_path(file)} run Teamster::Core::App CODE end - def teamster_modules + def teamster_adapters <<-CODE -Dir.glob(File.dirname(__FILE__) + '/teamster-modules/*.rb').each do |mdl| +Dir.glob(File.dirname(__FILE__) + '/teamster-adapters/*.rb').each do |mdl| require mdl end CODE end - def module_placeholder_for(name) + def adapter_placeholder_for(name) <<-CODE require_relative \"#{name}/#{name}_helper\" \# NOTE: If the namespace is changed, please take care of the -\# namespace of the sub-class and helper modules. +\# namespace of the sub-class and helper adapters. module Teamster - module Modules + module Adapters class #{name.capitalize} < Sinatra::Base - \# Class methods that contain Teamster-Module specific helpers. - include BaseModule + \# Class methods that contain Teamster-Adapter specific helpers. + include BaseAdapter \# Stuff that needs to be done before registration with core. - has_helpers #{name.capitalize}Helper \# Add modules here (comma separated) if there are helper modules. + has_helpers #{name.capitalize}Helper \# Add adapters here (comma separated) if there are helper adapters. views_at \"\#\{File.dirname(__FILE__)\}/#{name}/views\" under_development \# Remove this line when development is finished. \# Register this class so it can be used. register self @@ -200,13 +200,13 @@ end end CODE end - def module_helper_placeholder_for(name) + def adapter_helper_placeholder_for(name) <<-CODE module Teamster - module Modules + module Adapters module #{name.capitalize}Helper def #{name}_summary? true end