Module: Minder

Defined in:
lib/minder.rb,
lib/minder/config.rb,
lib/minder/version.rb,
lib/minder/cli/frame.rb,
lib/minder/cli/scene.rb,
lib/minder/tasks/task.rb,
lib/minder/application.rb,
lib/minder/cli/help_frame.rb,
lib/minder/cli/task_editor.rb,
lib/minder/pomodoro/period.rb,
lib/minder/cli/filter_frame.rb,
lib/minder/cli/search_frame.rb,
lib/minder/cli/message_frame.rb,
lib/minder/cli/pomodoro_frame.rb,
lib/minder/tasks/task_manager.rb,
lib/minder/cli/quick_add_frame.rb,
lib/minder/pomodoro/idle_period.rb,
lib/minder/pomodoro/work_period.rb,
lib/minder/pomodoro/break_period.rb,
lib/minder/pomodoro/pomodoro_runner.rb,
lib/minder/database/database_migrator.rb,
lib/minder/database/commands/delete_task.rb

Defined Under Namespace

Modules: Commands Classes: Application, BreakPeriod, Config, DatabaseMigrator, FilterFrame, Frame, HelpFrame, IdlePeriod, MessageFrame, Period, PomodoroFrame, PomodoroRunner, QuickAddFrame, Scene, SearchFrame, Task, TaskEditor, TaskManager, WorkPeriod

Constant Summary collapse

DEFAULT_WORK_PERIOD =
25
DEFAULT_BREAK_PERIOD =
5
CONFIG_LOCATION =
File.join(ENV["HOME"], '.minder', 'config.json')
ASSETS_LOCATION =
File.expand_path(File.dirname(__FILE__) + '/../assets')
DOING_FILE =
File.join(ENV["HOME"], '.minder', 'doing.txt')
DONE_FILE =
File.join(ENV["HOME"], '.minder', 'done.txt')
MIGRATIONS_PATH =
File.expand_path(File.dirname(__FILE__) + '/../')
LOG_LOCATION =
"#{ENV['HOME']}/.minder/info.log"
VERSION =
'0.4.3'

Class Method Summary collapse

Class Method Details

.configObject



18
19
20
21
22
23
24
# File 'lib/minder.rb', line 18

def self.config
  @config ||= begin
                config = Minder::Config.new(CONFIG_LOCATION)
                config.load
                config
              end
end

.database_locationObject



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

def self.database_location
  "#{ENV['HOME']}/.minder/#{config.database_name}.sqlite3"
end

.formatted_time(seconds) ⇒ Object



30
31
32
33
34
# File 'lib/minder.rb', line 30

def self.formatted_time(seconds)
  minutes = (seconds / 60).to_i
  seconds = (seconds % 60).round
  "#{'%02d' % minutes}:#{'%02d' % seconds}"
end

.is_linux?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/minder.rb', line 43

def self.is_linux?
  RUBY_PLATFORM =~ /linux/
end

.play_sound(name) ⇒ Object



36
37
38
39
40
41
# File 'lib/minder.rb', line 36

def self.play_sound(name)
  command = is_linux? ? 'aplay' : 'afplay'
  spawn("#{command} #{ASSETS_LOCATION}/#{name}",
        out: '/dev/null',
        err: '/dev/null')
end

.pry_open(b) ⇒ Object



47
48
49
50
51
# File 'lib/minder.rb', line 47

def self.pry_open(b)
  Curses.close_screen
  require 'pry'
  b.pry
end