ki 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/ki.gemspec +1 -1
- data/lib/ki_cli.rb +22 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/ki.gemspec
CHANGED
data/lib/ki_cli.rb
CHANGED
@@ -39,6 +39,28 @@ end
|
|
39
39
|
class KiCli < Thor
|
40
40
|
register AppGenerator, :new, 'new [APP_NAME]', 'generate a new app'
|
41
41
|
|
42
|
+
desc 'config', 'set a specific value to a key in config.yml'
|
43
|
+
method_option :key, :type => :string, :aliases => '-k', :desc => 'specify which key to use'
|
44
|
+
method_option :val, :type => :string, :aliases => '-v', :desc => 'specify value for the key'
|
45
|
+
def config
|
46
|
+
if options[:key].nil? || options[:val].nil?
|
47
|
+
say "key and val required", :red
|
48
|
+
return 0
|
49
|
+
end
|
50
|
+
|
51
|
+
path = File.join(Dir.pwd, 'config.yml')
|
52
|
+
lines = File.open(path, 'r').read.split("\n")
|
53
|
+
File.open(path, 'w') { |f|
|
54
|
+
lines.each do |l|
|
55
|
+
if l.start_with? options[:key]
|
56
|
+
|
57
|
+
l = options[:key].to_s + ": " + options[:val].to_s
|
58
|
+
end
|
59
|
+
f.write l + "\n"
|
60
|
+
end
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
42
64
|
desc 'server', 'starts the app'
|
43
65
|
# method_option :reload, :type => :boolean, :aliases => '-r', :desc => 'Recommended for development'
|
44
66
|
method_option :port, :type => :numeric, :aliases => '-p', :desc => 'port'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -343,7 +343,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
343
343
|
version: '0'
|
344
344
|
segments:
|
345
345
|
- 0
|
346
|
-
hash:
|
346
|
+
hash: 2930016913991517107
|
347
347
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
348
348
|
none: false
|
349
349
|
requirements:
|