Module: Zenflow

Defined in:
lib/zenflow/cli.rb,
lib/zenflow/version.rb,
lib/zenflow/helpers/ask.rb,
lib/zenflow/helpers/log.rb,
lib/zenflow/helpers/help.rb,
lib/zenflow/helpers/repo.rb,
lib/zenflow/helpers/shell.rb,
lib/zenflow/commands/admin.rb,
lib/zenflow/helpers/branch.rb,
lib/zenflow/helpers/config.rb,
lib/zenflow/helpers/github.rb,
lib/zenflow/commands/deploy.rb,
lib/zenflow/commands/hotfix.rb,
lib/zenflow/helpers/version.rb,
lib/zenflow/commands/feature.rb,
lib/zenflow/commands/release.rb,
lib/zenflow/commands/reviews.rb,
lib/zenflow/helpers/changelog.rb,
lib/zenflow/helpers/pull_request.rb,
lib/zenflow/helpers/branch_command.rb,
lib/zenflow/helpers/branch_commands/diff.rb,
lib/zenflow/helpers/branch_commands/abort.rb,
lib/zenflow/helpers/branch_commands/start.rb,
lib/zenflow/helpers/branch_commands/deploy.rb,
lib/zenflow/helpers/branch_commands/finish.rb,
lib/zenflow/helpers/branch_commands/review.rb,
lib/zenflow/helpers/branch_commands/update.rb,
lib/zenflow/helpers/branch_commands/compare.rb,
lib/zenflow/helpers/branch_commands/branches.rb

Defined Under Namespace

Modules: Branch, BranchCommands, Changelog, Repo Classes: Admin, BranchCommand, CLI, Config, Deploy, Feature, Github, GithubRequest, Help, Hotfix, PullRequest, Query, Release, Reviews, Shell, Version

Constant Summary collapse

VERSION =
Zenflow::Version["#{File.dirname(__FILE__)}/../../VERSION.yml"]
LOG_PATH =
File.join(Dir.pwd, ".zenflow-log")

Class Method Summary collapse

Class Method Details

.Ask(question, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/zenflow/helpers/ask.rb', line 3

def self.Ask(question, options={})
  response = Zenflow::Query.ask_question(question, options)
  Zenflow::Query.handle_response(response, options)
rescue StandardError => e
  puts e.message
  options[:response] = nil
  retry
rescue Interrupt => e
  puts
  puts "-----> Exiting...".cyan
  LogToFile("-----> Received interrupt. Exiting...")
  exit(1)
end

.Deploy(to, opts = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/zenflow/commands/deploy.rb', line 3

def self.Deploy(to, opts={})
  Branch.push(to)
  if opts[:migrations]
    Log("Deploying with migrations to #{to}")
    Shell["cap #{to} deploy:migrations"]
  else
    Log("Deploying to #{to}")
    Shell["cap #{to} deploy"]
  end
end

.Help(options = {}) ⇒ Object



3
4
5
# File 'lib/zenflow/helpers/help.rb', line 3

def self.Help(options={})
  Zenflow::Help.new(options)
end

.Log(message, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/zenflow/helpers/log.rb', line 5

def self.Log(message, options={})
  output = ""
  output << "       " if options[:indent]
  output << "-----> " if !(options[:arrows] === false)
  output << message
  LogToFile(output)
  output = output.send(options[:color] || :cyan) unless options[:color] == false
  puts output
end

.LogToFile(message) ⇒ Object



15
16
17
18
19
# File 'lib/zenflow/helpers/log.rb', line 15

def self.LogToFile(message)
  File.open(LOG_PATH, "a") do |f|
    f.write(message+"\n")
  end
end