minder 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66b3a3442d25126ae9c577eea879ad652a5d68cf
4
- data.tar.gz: 47664732c3c2d7cd647732951d9a3ad8e6295ca4
3
+ metadata.gz: 04665cae7902282fb0354f8897c7267e463c3aad
4
+ data.tar.gz: 3f0a83899f2269bc469f073fd3c0a3d012d1e44d
5
5
  SHA512:
6
- metadata.gz: 78e7312555108b90e7ae3745a5c393f9e1cc888a9c4967f6173d771277dbd3cb7ffa6524d39d17595973b5ab641509c15d363017eabf1f1f58739a6160c12f82
7
- data.tar.gz: 3fd237cd9452fa32cb5aeac920f475dd61e4585157e819c48f58d7ac7b7b7665afa4d7f558189cfd0615a57d94bd5bd95cba9eb6fc0f33cc931c64e45319cf9b
6
+ metadata.gz: 53f6d0608801071dfa6ba6b5c1a2ef81978b244bd2f69026f35bd2dce90dbf5946198f2c63f8322480bb6f33514128b464089c7e4a734b73184dfce0b476c0a1
7
+ data.tar.gz: ed2a922c027a2fd7d12737d124a2dfa71fe0ee048f67e2f2d462bf48e5de0941d5b71e07769634c0591747714e67f996008c1b4351cbed754f87a70e9396d754
@@ -6,7 +6,6 @@ module Minder
6
6
  DOING_FILE = File.join(ENV["HOME"], '.minder', 'doing.txt')
7
7
  DONE_FILE = File.join(ENV["HOME"], '.minder', 'done.txt')
8
8
  MIGRATIONS_PATH = File.expand_path(File.dirname(__FILE__) + '/../')
9
- DATABASE_LOCATION = "#{ENV['HOME']}/.minder/database.sqlite3"
10
9
  LOG_LOCATION = "#{ENV['HOME']}/.minder/info.log"
11
10
 
12
11
  require 'minder/application'
@@ -16,6 +15,18 @@ module Minder
16
15
  require 'active_support'
17
16
  require 'fileutils'
18
17
 
18
+ def self.config
19
+ @config ||= begin
20
+ config = Minder::Config.new(CONFIG_LOCATION)
21
+ config.load
22
+ config
23
+ end
24
+ end
25
+
26
+ def self.database_location
27
+ "#{ENV['HOME']}/.minder/#{config.database_name}.sqlite3"
28
+ end
29
+
19
30
  def self.formatted_time(seconds)
20
31
  minutes = (seconds / 60).to_i
21
32
  seconds = (seconds % 60).round
@@ -6,7 +6,8 @@ module Minder
6
6
  work_duration: 25,
7
7
  short_break_duration: 5,
8
8
  long_break_duration: 15,
9
- emoji: 'tomato'
9
+ emoji: 'tomato',
10
+ database_name: 'database'
10
11
  }
11
12
 
12
13
  attr_accessor :location
@@ -7,9 +7,9 @@ class Database
7
7
  attr_reader :rom
8
8
 
9
9
  def initialize
10
- FileUtils.mkdir_p(File.dirname(Minder::DATABASE_LOCATION))
10
+ FileUtils.mkdir_p(File.dirname(Minder.database_location))
11
11
  ROM.use :auto_registration
12
- ROM.setup(:sql, "sqlite://#{Minder::DATABASE_LOCATION}")
12
+ ROM.setup(:sql, "sqlite://#{Minder.database_location}")
13
13
 
14
14
  require 'minder/tasks/task'
15
15
  require 'minder/database/task_mapper'
@@ -48,7 +48,6 @@ module Minder
48
48
  def continue
49
49
  return unless current_period.elapsed?
50
50
 
51
- current_period.complete!
52
51
  complete_period(current_period)
53
52
 
54
53
  advance_period
@@ -58,6 +57,7 @@ module Minder
58
57
  end
59
58
 
60
59
  def complete_period(period)
60
+ period.complete!
61
61
  database.complete_period(period)
62
62
  @pomodoros_today = nil
63
63
  end
@@ -1,3 +1,3 @@
1
1
  module Minder
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Method
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-31 00:00:00.000000000 Z
11
+ date: 2015-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -304,9 +304,8 @@ files:
304
304
  - assets/start.wav
305
305
  - bin/minder
306
306
  - db/migrate/001_create_tasks.rb
307
- - db/migrate/002_import_tasks.rb
308
- - db/migrate/003_create_periods.rb
309
- - db/migrate/004_add_duration_in_seconds_to_periods.rb
307
+ - db/migrate/002_create_periods.rb
308
+ - db/migrate/003_add_duration_in_seconds_to_periods.rb
310
309
  - lib/minder.rb
311
310
  - lib/minder/application.rb
312
311
  - lib/minder/cli/filter_frame.rb
@@ -1,15 +0,0 @@
1
- Sequel.migration do
2
- up do
3
- next unless File.exists?(Minder::DOING_FILE)
4
-
5
- tasks = ROM.env.gateways[:default].connection.from(:tasks)
6
- tasks.delete
7
-
8
- File.readlines(Minder::DOING_FILE).each do |line|
9
- tasks.insert(description: line.strip)
10
- end
11
- end
12
-
13
- down do
14
- end
15
- end