lib/pt/ui.rb in pt-0.2 vs lib/pt/ui.rb in pt-0.2.1

- old
+ new

@@ -203,10 +203,11 @@ end config end def load_local_config + check_local_config_path config = YAML.load(File.read(LOCAL_CONFIG_PATH)) rescue {} if config.empty? message "I can't find info about this project in #{LOCAL_CONFIG_PATH}" projects = PT::ProjectTable.new(@client.get_projects) project = select("Please select the project for the current directory", projects) @@ -216,9 +217,16 @@ congrats "Thanks! I'm saving this project's info", "in #{LOCAL_CONFIG_PATH}: remember to .gitignore it!" save_config(config, LOCAL_CONFIG_PATH) end config + end + + def check_local_config_path + if GLOBAL_CONFIG_PATH == LOCAL_CONFIG_PATH + error("Please execute .pt inside your project directory and not in your home.") + exit + end end def save_config(config, path) File.new(path, 'w') unless File.exists?(path) File.open(path, 'w') {|f| f.write(config.to_yaml) } \ No newline at end of file