ki 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/ki.gemspec +1 -1
  3. data/lib/ki_cli.rb +22 -0
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
data/ki.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ki"
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Cristian Mircea Messel"]
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.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: 524519885161704144
346
+ hash: 2930016913991517107
347
347
  required_rubygems_version: !ruby/object:Gem::Requirement
348
348
  none: false
349
349
  requirements: