librails 1.1.6 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/librails/settings.rb +24 -2
- data/lib/librails/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5442bfe19fdd87e12645f35d9df1d139176e38347d893c17b19605ed869bbee
|
4
|
+
data.tar.gz: a529c638d5c250cab764f7f73f0eb4ca3c9189c88b5c032ec2ea91245400a602
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df850494eb04c384afaa9b50ed054a4d36b5b251ba998c8000c8be3d19ff251e92af3107d10355b9126caabdcdbfe098af772dc3a8a898550a288469c1b9714b
|
7
|
+
data.tar.gz: 1adc870ce27733211ad69ae3e10a8e816efc0f02505950ae5433f33e4b551903d27dffca5750c343b89b92a0ec5ef1029478c226201475e20dc41288fa46df1a
|
data/lib/librails/settings.rb
CHANGED
@@ -37,6 +37,22 @@ module Librails
|
|
37
37
|
result
|
38
38
|
end
|
39
39
|
|
40
|
+
def self.get_array(key)
|
41
|
+
value = get_value(key)
|
42
|
+
return nil unless value
|
43
|
+
values = nil
|
44
|
+
if value =~ /^---/
|
45
|
+
# Rails Settings Cachedは配列をYAML形式で保存している
|
46
|
+
# "---\n- bootstrap\n- chatgpt\n- git\n- github\n- javascript\n
|
47
|
+
value = value.sub(/^---\n/, '')
|
48
|
+
values = value.split(/\n/).collect {|v| v.sub(/^- /, '').strip}
|
49
|
+
else
|
50
|
+
# 新方式は単なるtsvとする
|
51
|
+
values = value.split(/\t/)
|
52
|
+
end
|
53
|
+
values
|
54
|
+
end
|
55
|
+
|
40
56
|
def self.normalize_value(value)
|
41
57
|
value.sub(/^--- /, '').strip
|
42
58
|
end
|
@@ -56,12 +72,18 @@ module Librails
|
|
56
72
|
end
|
57
73
|
|
58
74
|
def self.set_value(key, value)
|
59
|
-
settings =
|
75
|
+
settings = get_record(key)
|
60
76
|
unless settings
|
61
77
|
settings = Settings.new
|
62
78
|
settings.key = key
|
63
79
|
end
|
64
|
-
|
80
|
+
str = nil
|
81
|
+
if value.kind_of?(Array)
|
82
|
+
str = value.join("\t") # タブ区切りで保存
|
83
|
+
else
|
84
|
+
str = value.to_s
|
85
|
+
end
|
86
|
+
settings.value = str
|
65
87
|
settings.save!
|
66
88
|
end
|
67
89
|
|
data/lib/librails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: librails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- src256
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 7.0.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mysql2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.5'
|
27
41
|
description: My Rails Plugin
|
28
42
|
email:
|
29
43
|
- src@srcw.net
|