weight-recorder 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/application.rb +1 -0
- data/lib/recorder/#db.rb# +48 -0
- data/lib/recorder/version.rb +1 -1
- data/lib/views/chart.haml +1 -0
- data/lib/views/layout.haml +3 -2
- metadata +3 -3
- data/latexes/handout_pre.tex +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c249d4e0df8064c1dfa8d8adf4859a531d11021e
|
4
|
+
data.tar.gz: 01aca001cb8bfaf54e4ad1eb27dbf2ce18fd374b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d5b69014cab33cbc08c0e052ed122a89bc5e79a2062629a82f2e319d5bbba76b6c26c8ca5548b07c7a527a384de57bca45a21facbd482720c4d9ea015825ef6
|
7
|
+
data.tar.gz: d79383cac20fc7ecb163393a4a8f3e51ae4d5df6c30ba72fc450d87547934d0137167ca9c2eada0b78e26e25178a4ac697c19f1d82cb36f675c1581548a338e6
|
data/lib/application.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'active_record'
|
5
|
+
|
6
|
+
module Recorder
|
7
|
+
|
8
|
+
module DB
|
9
|
+
|
10
|
+
def self.prepare
|
11
|
+
database_path = File.join(ENV['HOME'], '.recorder','recorder.sqlite3')
|
12
|
+
|
13
|
+
connect_database database_path
|
14
|
+
create_table_if_not_exists database_path
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.connect_database(path)
|
18
|
+
spec = {adapter: 'sqlite3', database: path}
|
19
|
+
ActiveRecord::Base.establish_connection spec
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.create_table_if_not_exists(path)
|
23
|
+
create_database_path path
|
24
|
+
|
25
|
+
connection = ActiveRecord::Base.connection
|
26
|
+
|
27
|
+
return if connection.table_exists?(:data)
|
28
|
+
|
29
|
+
connection.create_table :data do |d|
|
30
|
+
d.column :weight, :real, null: false
|
31
|
+
d.column :bodyfat, :real, null: true
|
32
|
+
d.column :date, :text, null: true
|
33
|
+
d.column :memo, :text, null: true
|
34
|
+
d.timestamps
|
35
|
+
end
|
36
|
+
connection.add_index :data, :created_at
|
37
|
+
connection.add_index :data, :date
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.create_database_path(path)
|
42
|
+
FileUtils.mkdir_p File.dirname(path)
|
43
|
+
end
|
44
|
+
|
45
|
+
private_class_method :connect_database, :create_table_if_not_exists, :create_database_path
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
data/lib/recorder/version.rb
CHANGED
data/lib/views/chart.haml
CHANGED
data/lib/views/layout.haml
CHANGED
@@ -13,8 +13,9 @@
|
|
13
13
|
%nav.navbar.navbar-default
|
14
14
|
.container-fluid
|
15
15
|
.navbar-header
|
16
|
-
|
17
|
-
|
16
|
+
%a.navbar-brand{href: uri('/data')} Weight Recorder
|
17
|
+
/%a.navbar-brand Bob's weight
|
18
|
+
/%a.navbar-brand #{@title}
|
18
19
|
%button{class: ('btn btn-default navbar-btn')}
|
19
20
|
%a(class="glyphicon glyphicon-pencil"){href: uri('data/new')} new
|
20
21
|
%button{class: ('btn btn-default navbar-btn')}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weight-recorder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shigeto R. Nishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -218,7 +218,6 @@ files:
|
|
218
218
|
- exe/weight-recorder
|
219
219
|
- hikis/README_en.hiki
|
220
220
|
- hikis/modify_db.hiki
|
221
|
-
- latexes/handout_pre.tex
|
222
221
|
- lib/application.rb
|
223
222
|
- lib/public/chartkick.js
|
224
223
|
- lib/public/css/bootstrap-theme.css
|
@@ -238,6 +237,7 @@ files:
|
|
238
237
|
- lib/public/js/bootstrap.min.js
|
239
238
|
- lib/public/js/npm.js
|
240
239
|
- lib/recorder.rb
|
240
|
+
- lib/recorder/#db.rb#
|
241
241
|
- lib/recorder/command.rb
|
242
242
|
- lib/recorder/command/options.rb
|
243
243
|
- lib/recorder/data.rb
|
data/latexes/handout_pre.tex
DELETED