yhara-lifelog 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +17 -0
- data/VERSION +1 -0
- data/bin/lifelog +62 -0
- data/lifelog.gemspec +48 -0
- data/models.rb +16 -0
- data/view/index.haml +19 -0
- metadata +87 -0
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
rescue LoadError
|
4
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
5
|
+
end
|
6
|
+
|
7
|
+
Jeweler::Tasks.new do |gemspec|
|
8
|
+
gemspec.name = "lifelog"
|
9
|
+
gemspec.summary = "A lifelogging tool written in Ramaze"
|
10
|
+
gemspec.email = "yutaka.hara/at/gmail.com"
|
11
|
+
gemspec.homepage = "http://github.com/yhara/lifelog"
|
12
|
+
gemspec.description = gemspec.summary
|
13
|
+
gemspec.authors = ["Yutaka HARA"]
|
14
|
+
gemspec.add_dependency('ramaze', '= 2009.05')
|
15
|
+
gemspec.add_dependency('dm-core')
|
16
|
+
gemspec.add_dependency('do_sqlite3')
|
17
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/lifelog
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ramaze'
|
5
|
+
|
6
|
+
class MainController < Ramaze::Controller
|
7
|
+
map '/'
|
8
|
+
engine :Haml
|
9
|
+
|
10
|
+
def index
|
11
|
+
@posts = Post.all(:order => [:posted_at.desc])
|
12
|
+
end
|
13
|
+
|
14
|
+
def say
|
15
|
+
Post.create({
|
16
|
+
:posted_at => Time.now,
|
17
|
+
:message => request.params["message"],
|
18
|
+
})
|
19
|
+
|
20
|
+
redirect '/'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
module LifeLog
|
24
|
+
include Innate::Optioned
|
25
|
+
|
26
|
+
options.dsl do
|
27
|
+
o "Path of config file",
|
28
|
+
:config, File.expand_path("~/.lifelog.rb")
|
29
|
+
o "Path of database file",
|
30
|
+
:db, File.expand_path("~/.lifelog.db")
|
31
|
+
o "Port number",
|
32
|
+
:port, 7012
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
OptionParser.new{|o|
|
37
|
+
o.on("--config PATH"){|path|
|
38
|
+
LifeLog.options[:config] = path
|
39
|
+
}
|
40
|
+
o.on("--db DB_PATH"){|path|
|
41
|
+
LifeLog.options[:db] = File.expand_path(path, Dir.pwd)
|
42
|
+
}
|
43
|
+
o.on("--port N"){|port|
|
44
|
+
LifeLog.options[:port] = port
|
45
|
+
}
|
46
|
+
o.on("--help"){ puts o.to_s; exit }
|
47
|
+
}.parse!(ARGV)
|
48
|
+
|
49
|
+
conf = LifeLog.options[:config]
|
50
|
+
if File.exist?(conf)
|
51
|
+
Ramaze::Log.info("Loading config file: #{conf}")
|
52
|
+
require conf
|
53
|
+
else
|
54
|
+
Ramaze::Log.warn("Config file not found: #{conf}")
|
55
|
+
end
|
56
|
+
|
57
|
+
Ramaze::Log.info("Loading database: #{LifeLog.options[:db]}")
|
58
|
+
require __DIR__('../models.rb')
|
59
|
+
|
60
|
+
Ramaze::Log.info("Starting server with port #{LifeLog.options[:port]}")
|
61
|
+
Ramaze.start :port => LifeLog.options[:port],
|
62
|
+
:root => __DIR__('../')
|
data/lifelog.gemspec
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{lifelog}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Yutaka HARA"]
|
9
|
+
s.date = %q{2009-05-23}
|
10
|
+
s.default_executable = %q{lifelog}
|
11
|
+
s.description = %q{A lifelogging tool written in Ramaze}
|
12
|
+
s.email = %q{yutaka.hara/at/gmail.com}
|
13
|
+
s.executables = ["lifelog"]
|
14
|
+
s.files = [
|
15
|
+
"Rakefile",
|
16
|
+
"VERSION",
|
17
|
+
"bin/lifelog",
|
18
|
+
"lifelog.gemspec",
|
19
|
+
"models.rb",
|
20
|
+
"view/index.haml"
|
21
|
+
]
|
22
|
+
s.has_rdoc = true
|
23
|
+
s.homepage = %q{http://github.com/yhara/lifelog}
|
24
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
25
|
+
s.require_paths = ["lib"]
|
26
|
+
s.rubygems_version = %q{1.3.2}
|
27
|
+
s.summary = %q{A lifelogging tool written in Ramaze}
|
28
|
+
|
29
|
+
if s.respond_to? :specification_version then
|
30
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
31
|
+
s.specification_version = 3
|
32
|
+
|
33
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
34
|
+
s.add_runtime_dependency(%q<ramaze>, ["= 2009.05"])
|
35
|
+
s.add_runtime_dependency(%q<dm-core>, [">= 0"])
|
36
|
+
s.add_runtime_dependency(%q<do_sqlite3>, [">= 0"])
|
37
|
+
else
|
38
|
+
s.add_dependency(%q<ramaze>, ["= 2009.05"])
|
39
|
+
s.add_dependency(%q<dm-core>, [">= 0"])
|
40
|
+
s.add_dependency(%q<do_sqlite3>, [">= 0"])
|
41
|
+
end
|
42
|
+
else
|
43
|
+
s.add_dependency(%q<ramaze>, ["= 2009.05"])
|
44
|
+
s.add_dependency(%q<dm-core>, [">= 0"])
|
45
|
+
s.add_dependency(%q<do_sqlite3>, [">= 0"])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
data/models.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'dm-core'
|
3
|
+
|
4
|
+
DataMapper.setup(:default, "sqlite3://#{LifeLog.options[:db]}")
|
5
|
+
|
6
|
+
class Post
|
7
|
+
include DataMapper::Resource
|
8
|
+
property :id, Serial
|
9
|
+
property :posted_at, DateTime
|
10
|
+
property :message, String
|
11
|
+
|
12
|
+
def time_str
|
13
|
+
self.posted_at.strftime("%Y-%m-%d %H:%M:%S")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
Post.auto_upgrade!
|
data/view/index.haml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
%html
|
2
|
+
%head
|
3
|
+
%meta{:"http-equiv"=>"Content-Type", :content=>"text/html", :charset=>"utf-8" }
|
4
|
+
%title LifeLogger
|
5
|
+
%body
|
6
|
+
%h1 LifeLog
|
7
|
+
|
8
|
+
%table.log
|
9
|
+
%tr
|
10
|
+
%td
|
11
|
+
%td
|
12
|
+
%form{:action => "/say", :method => "POST"}
|
13
|
+
%input{:type => "text", :size => 120, :name => "message"}
|
14
|
+
%input{:type => "submit", :value => "add"}
|
15
|
+
|
16
|
+
- @posts.each do |post|
|
17
|
+
%tr.post
|
18
|
+
%td.time= h post.time_str
|
19
|
+
%td.message= post.message
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yhara-lifelog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yutaka HARA
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-23 00:00:00 -07:00
|
13
|
+
default_executable: lifelog
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ramaze
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - "="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "2009.05"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: dm-core
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: do_sqlite3
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
description: A lifelogging tool written in Ramaze
|
46
|
+
email: yutaka.hara/at/gmail.com
|
47
|
+
executables:
|
48
|
+
- lifelog
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files: []
|
52
|
+
|
53
|
+
files:
|
54
|
+
- Rakefile
|
55
|
+
- VERSION
|
56
|
+
- bin/lifelog
|
57
|
+
- lifelog.gemspec
|
58
|
+
- models.rb
|
59
|
+
- view/index.haml
|
60
|
+
has_rdoc: true
|
61
|
+
homepage: http://github.com/yhara/lifelog
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options:
|
64
|
+
- --charset=UTF-8
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 1.2.0
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: A lifelogging tool written in Ramaze
|
86
|
+
test_files: []
|
87
|
+
|