ki_middleman 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ki_middleman/kiseru.rb +52 -0
- data/lib/ki_middleman/version.rb +1 -1
- metadata +15 -20
@@ -0,0 +1,52 @@
|
|
1
|
+
module Kiseru
|
2
|
+
|
3
|
+
class ConfigDir
|
4
|
+
|
5
|
+
DIR_NAME = '.kiseru'
|
6
|
+
|
7
|
+
attr_reader :path
|
8
|
+
|
9
|
+
def initialize(opts = {})
|
10
|
+
root = Pathname.new(File.expand_path(opts.fetch(:root) { '~' }))
|
11
|
+
@path = root + DIR_NAME
|
12
|
+
unless File.directory?(@path)
|
13
|
+
Dir.mkdir(@path)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def config(app_name)
|
18
|
+
Config.new(@path, app_name)
|
19
|
+
end
|
20
|
+
|
21
|
+
def file(file_name)
|
22
|
+
@path + file_name
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
class Config
|
28
|
+
|
29
|
+
def self.[](key)
|
30
|
+
ConfigDir.new.config(key)
|
31
|
+
end
|
32
|
+
|
33
|
+
def initialize(root_path, app_name)
|
34
|
+
file_path = (root_path + "#{app_name}.yml").to_s
|
35
|
+
@store = YAML::Store.new(file_path)
|
36
|
+
end
|
37
|
+
|
38
|
+
def write(key, time)
|
39
|
+
@store.transaction do
|
40
|
+
@store[key] = time
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def read(key)
|
45
|
+
@store.transaction(read_only=true) do
|
46
|
+
@store[key]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
data/lib/ki_middleman/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ki_middleman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-08-
|
13
|
+
date: 2012-08-15 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
17
|
-
requirement: &
|
17
|
+
requirement: &70365088752000 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70365088752000
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: methadone
|
28
|
-
requirement: &
|
28
|
+
requirement: &70365088751580 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70365088751580
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: debugger
|
39
|
-
requirement: &
|
39
|
+
requirement: &70365088751160 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70365088751160
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rake
|
50
|
-
requirement: &
|
50
|
+
requirement: &70365088750740 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70365088750740
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: simplecov
|
61
|
-
requirement: &
|
61
|
+
requirement: &70365088750320 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70365088750320
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec
|
72
|
-
requirement: &
|
72
|
+
requirement: &70365088749900 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70365088749900
|
81
81
|
description: Transforms JSON into other JSON
|
82
82
|
email:
|
83
83
|
- ben@freeagent.com
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- ki_middleman.gemspec
|
99
99
|
- lib/ki_middleman.rb
|
100
100
|
- lib/ki_middleman/config.rb
|
101
|
+
- lib/ki_middleman/kiseru.rb
|
101
102
|
- lib/ki_middleman/version.rb
|
102
103
|
- spec/integration/convert_spec.rb
|
103
104
|
- spec/spec_helper.rb
|
@@ -113,18 +114,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
114
|
- - ! '>='
|
114
115
|
- !ruby/object:Gem::Version
|
115
116
|
version: '0'
|
116
|
-
segments:
|
117
|
-
- 0
|
118
|
-
hash: -2790870063741766204
|
119
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
118
|
none: false
|
121
119
|
requirements:
|
122
120
|
- - ! '>='
|
123
121
|
- !ruby/object:Gem::Version
|
124
122
|
version: '0'
|
125
|
-
segments:
|
126
|
-
- 0
|
127
|
-
hash: -2790870063741766204
|
128
123
|
requirements: []
|
129
124
|
rubyforge_project:
|
130
125
|
rubygems_version: 1.8.10
|