Top Level Namespace

Defined Under Namespace

Modules: Kernel, Tennpipes, TennpipesTasks

Constant Summary collapse

RACK_ENV =
ENV["RACK_ENV"] ||= "development"
TENNPIPES_ROOT =
ENV["TENNPIPES_ROOT"] ||= File.dirname(Tennpipes.first_caller)
TENNPIPES_LOG_LEVEL =

Defines the log level for a Tennpipes project.

ENV['TENNPIPES_LOG_LEVEL']
TENNPIPES_LOGGER =

Defines the logger used for a Tennpipes project.

ENV['TENNPIPES_LOGGER']

Instance Method Summary collapse

Instance Method Details

#applicationsObject

Show applications



7
8
9
10
11
12
13
14
# File 'lib/tennpipes-base/cli/console.rb', line 7

def applications
  puts "==== List of Mounted Applications ====\n\n"
  Tennpipes.mounted_apps.each do |app|
    puts " * %-10s mapped to      %s" % [app.name, app.uri_root]
  end
  puts
  Tennpipes.mounted_apps.map { |app| "#{app.name} => #{app.uri_root}" }
end

#env_migration_versionObject



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/tennpipes-base/cli/rake_tasks.rb', line 46

def env_migration_version
  version = ENV["MIGRATION_VERSION"]
  if version.nil? && ENV["VERSION"]
    deprecated = true
    warn "Environment variable VERSION is deprecated, use MIGRATION_VERSION"
    version = ENV["VERSION"]
  end
  version ? Integer(version) : nil
rescue ArgumentError
  warn "Environment variable #{deprecated ? '' : 'MIGRATION_'}VERSION=#{version} should be non-existant or Integer"
  nil
end

#list_app_routes(app, args) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/tennpipes-base/cli/rake_tasks.rb', line 31

def list_app_routes(app, args)
  app_routes = app.named_routes
  app_routes.reject! { |r| r.identifier.to_s !~ /#{args.query}/ } if args.query.present?
  app_routes.map! { |r| [r.verb, r.name, r.path] }
  return if app_routes.empty?
  shell.say "\nApplication: #{app.app_class}", :yellow
  app_routes.unshift(["REQUEST", "URL", "PATH"])
  max_col_1 = app_routes.max { |a, b| a[0].size <=> b[0].size }[0].size
  max_col_2 = app_routes.max { |a, b| a[1].size <=> b[1].size }[1].size
  app_routes.each_with_index do |row, i|
    message = [row[1].ljust(max_col_2+2), row[0].center(max_col_1+2), row[2]]
    shell.say("    " + message.join(" "), i==0 ? :bold : nil)
  end
end

#reload!Object

Reloads classes



2
3
4
# File 'lib/tennpipes-base/cli/console.rb', line 2

def reload!
  Tennpipes.reload!
end

#shellObject



48
49
50
# File 'lib/tennpipes-base/cli/rake.rb', line 48

def shell
  @_shell ||= Thor::Base.shell.new
end