lib/idonethis/use_cases/config.rb in idonethis-cli-0.12.0 vs lib/idonethis/use_cases/config.rb in idonethis-cli-0.13.0
- old
+ new
@@ -1,40 +1,40 @@
-module Idonethis::UseCases
- module Config
- class << self
- def apply(_, args={})
- log = args[:log] || fail("You need to supply :log adapter")
-
- log.call "args: #{args}"
-
- require 'yaml'
-
- settings = File.exists?(filename) ? YAML.load_file(filename) : {}
-
- token = (args[:opts].map{|it| it.match /user.token=(.+)/}.compact || []).first
-
- if token
- File.open filename, "w+" do |f|
- f.puts(settings.merge({token: token[1]}).to_yaml)
- end
- end
-
- team = (args[:opts].map{|it| it.match /user.team=(.+)/}.compact || []).first
-
- if team
- File.open filename, "w+" do |f|
- f.puts(settings.merge({team: team[1]}).to_yaml)
- end
- end
-
- puts "Settings saved to <#{filename}>"
- end
-
- private
-
- def filename
- require 'settings_file'
- Idonethis::SettingsFile.path
- end
- end
- end
-end
+module Idonethis::UseCases
+ module Config
+ class << self
+ def apply(_, args={})
+ log = args[:log] || fail("You need to supply :log adapter")
+
+ log.call "args: #{args}"
+
+ require 'yaml'
+
+ settings = File.exists?(filename) ? YAML.load_file(filename) : {}
+
+ token = (args[:opts].map{|it| it.match /user.token=(.+)/}.compact || []).first
+
+ if token
+ File.open filename, "w+" do |f|
+ f.puts(settings.merge({token: token[1]}).to_yaml)
+ end
+ end
+
+ team = (args[:opts].map{|it| it.match /user.team=(.+)/}.compact || []).first
+
+ if team
+ File.open filename, "w+" do |f|
+ f.puts(settings.merge({team: team[1]}).to_yaml)
+ end
+ end
+
+ puts "Settings saved to <#{filename}>"
+ end
+
+ private
+
+ def filename
+ require 'settings_file'
+ Idonethis::SettingsFile.path
+ end
+ end
+ end
+end