Module: Troo

Defined in:
lib/troo.rb,
lib/troo/debug.rb,
lib/troo/cli/add.rb,
lib/troo/options.rb,
lib/troo/version.rb,
lib/troo/cli/main.rb,
lib/troo/cli/show.rb,
lib/troo/database.rb,
lib/troo/launcher.rb,
lib/troo/api/client.rb,
lib/troo/preference.rb,
lib/troo/api/headers.rb,
lib/troo/api/request.rb,
lib/troo/cli/default.rb,
lib/troo/cli/refresh.rb,
lib/troo/models/card.rb,
lib/troo/models/list.rb,
lib/troo/remote/card.rb,
lib/troo/remote/list.rb,
lib/troo/api/response.rb,
lib/troo/models/board.rb,
lib/troo/remote/board.rb,
lib/troo/api/endpoints.rb,
lib/troo/configuration.rb,
lib/troo/models/member.rb,
lib/troo/remote/member.rb,
lib/troo/cli/thor_fixes.rb,
lib/troo/models/comment.rb,
lib/troo/models/refresh.rb,
lib/troo/remote/comment.rb,
lib/troo/presenters/card.rb,
lib/troo/presenters/list.rb,
lib/troo/retrieval/local.rb,
lib/troo/cli/commands/add.rb,
lib/troo/presenters/board.rb,
lib/troo/retrieval/remote.rb,
lib/troo/cli/commands/show.rb,
lib/troo/decorators/member.rb,
lib/troo/persistence/local.rb,
lib/troo/presenters/member.rb,
lib/troo/api/oauth_settings.rb,
lib/troo/presenters/comment.rb,
lib/troo/cli/commands/status.rb,
lib/troo/decorators/resource.rb,
lib/troo/presenters/resource.rb,
lib/troo/remote/comment_data.rb,
lib/troo/cli/commands/default.rb,
lib/troo/cli/commands/refresh.rb,
lib/troo/helpers/model_helpers.rb,
lib/troo/presentation/sentence.rb,
lib/troo/presentation/template.rb,
lib/troo/cli/commands/move/card.rb,
lib/troo/presentation/formatter.rb,
lib/troo/remote/persistence/card.rb,
lib/troo/remote/persistence/list.rb,
lib/troo/cli/commands/refresh/all.rb,
lib/troo/remote/comment_data_card.rb,
lib/troo/remote/persistence/board.rb,
lib/troo/helpers/decorator_helpers.rb,
lib/troo/remote/comment_data_board.rb,
lib/troo/remote/persistence/comment.rb,
lib/troo/helpers/remote_model_helpers.rb,
lib/troo/remote/persistence/move_card.rb,
lib/troo/cli/commands/show/show_boards.rb,
lib/troo/models/behaviours/set_default.rb,
lib/troo/cli/commands/show/show_comments.rb

Defined Under Namespace

Modules: API, Behaviours, CLI, Commands, DecoratorHelpers, Decorators, ModelHelpers, Persistence, Presenters, Remote, RemoteModelHelpers, Retrieval Classes: Align, Board, Card, Comment, Configuration, Database, Esc, Format, Formatter, Launcher, List, Member, Options, Output, Preference, Refresh, Sentence, Template, Wordwrap

Constant Summary collapse

ConfigurationNotFound =
Class.new(StandardError)
InvalidAccessToken =
Class.new(StandardError)
EndpointNotFound =
Class.new(StandardError)
VERSION =
'0.0.11'

Class Method Summary collapse

Class Method Details

.configuration(file = Dir.home + '/.trooconf', env = 'default') ⇒ Object

Returns [].

Parameters:

  • []
  • (String)

Returns:



14
15
16
17
18
19
20
21
22
# File 'lib/troo.rb', line 14

def self.configuration(file = Dir.home + '/.trooconf', env = 'default')
  unless File.exist?(file)
    warn "\nConfiguration cannot be found, please run 'troo " \
         "init' or './bin/troo init' first.\n"
    file = configuration_path + '/trooconf.yml'
  end

  @configuration ||= Troo::Configuration.load(file, env)
end

.debug(filename = 'profile.html', &block) ⇒ Object

Returns [].

Parameters:

  • (String)
  • []

Returns:



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/troo/debug.rb', line 9

def self.debug(filename = 'profile.html', &block)
  RubyProf.start

  yield

  result = RubyProf.stop
  result.eliminate_methods!([/^Array/, /^Hash/])

  File.open('./tmp/' + filename, 'w') do |file|
    RubyProf::CallStackPrinter.new(result).print(file)
  end
end

.endpoints(version = 'version_1') ⇒ Object

Returns [].

Parameters:

  • (String)

Returns:



26
27
28
29
# File 'lib/troo.rb', line 26

def self.endpoints(version = 'version_1')
  @endpoints ||= Troo::API::Endpoints
    .load(configuration_path + '/trello_api.yml', version)
end

.loggerObject

Returns [].

Returns:



32
33
34
35
36
37
38
39
# File 'lib/troo.rb', line 32

def self.logger
  @logger ||= Logger
    .new(log_path + '/troo.log').tap do |log|
    log.formatter = proc do |mode, time, prog, msg|
      "#{time.iso8601} #{mode}:\n#{msg}\n"
    end
  end
end