class Docman::CLI
Public Instance Methods
build(deploy_target="git_target", state="")
click to toggle source
# File lib/docman/cli.rb, line 48 def build(deploy_target="git_target", state="") docman_state_var = "RELEASE_STATE" if ENV.has_key? docman_state_var and ENV[docman_state_var].length > 0 state = ENV[docman_state_var] end if state.length > 0 get_to_root_dir if options[:force] FileUtils.rm_rf('master') if File.directory? 'master' end Application.instance.build(deploy_target, state, options) say('Complete!', :green) else say("Cant build without state parameter or #{docman_state_var} environment variable.") end end
bump(state = nil)
click to toggle source
option :state option :skip
# File lib/docman/cli.rb, line 88 def bump(state = nil) bump_params = [] bump_params.push("--branch=#{options[:branch]}") if options[:branch] bump_params.push("--tag=#{options[:tag]}") if options[:tag] bump_params.push('--next') if options[:next] and (not options.has_kay? :tag or options[:tag].empty?) bump_params.push('--skip') if options[:skip] system "#{Application::bin}/bump-version.sh #{bump_params.join(' ')} #{state}" say('Complete!', :green) end
config_dir?()
click to toggle source
# File lib/docman/cli.rb, line 132 def config_dir? raise 'ERROR: No config directory in docroot' unless current_dir_has_config_dir end
current_dir_has_config_dir()
click to toggle source
# File lib/docman/cli.rb, line 128 def current_dir_has_config_dir File.directory?('config') end
deploy(deploy_target, name, type, version)
click to toggle source
# File lib/docman/cli.rb, line 70 def deploy(deploy_target, name, type, version) get_to_root_dir if version.start_with?('state_') state = version.partition('_').last build(deploy_target, state) else result = Application.instance.deploy(deploy_target, name, type, version, options) say(result, :green) end end
drush(drush_alias, command)
click to toggle source
# File lib/docman/cli.rb, line 110 def drush(drush_alias, command) env = drush_alias.partition('.').first.partition('@').last site = drush_alias.partition('.').last Application.instance.drush(env, site, command) say('Complete!', :green) end
get_to_root_dir()
click to toggle source
# File lib/docman/cli.rb, line 136 def get_to_root_dir until current_dir_has_config_dir raise 'ERROR: No config directory in docroot' if File.basename(Dir.pwd) == '/' Dir.chdir('..') end end
info(command, file)
click to toggle source
# File lib/docman/cli.rb, line 122 def info(command, file) say(Application.instance.info(command, file, options).to_json); # say('Complete!', :green) end
init(name, repo)
click to toggle source
# File lib/docman/cli.rb, line 16 def init(name, repo) if File.directory? name say("Directory #{name} already exists") if options[:force] FileUtils.rm_r(name) elsif options[:skip] if File.directory? File.join(name, 'config') and GitUtil.repo? File.join(name, 'config') return else FileUtils.rm_r(name) end else choice = ask('Are you sure you want do delete existing docroot? Type "yes" if you agree.') if choice == 'yes' FileUtils.rm_r(name) elsif Kernel::abort 'Exit' end end end puts "Init docroot directory #{name} and retrieve config from provided repo." Application.instance.init(name, repo, options) say('Complete!', :green) end
template(name = nil)
click to toggle source
# File lib/docman/cli.rb, line 101 def template(name = nil) current_dir_name = File.basename(Dir.pwd) get_to_root_dir name = current_dir_name if name.nil? Application.instance.template(name, options) say('Complete!', :green) end