Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Commit

Permalink
Initialize feature, Scenario create default .todotxt.cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
Bèr Kessels committed Feb 5, 2013
1 parent 48becba commit 990de0c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@
Gemfile.lock
pkg/*
coverage/*
tmp/*
6 changes: 3 additions & 3 deletions bin/todotxt
Expand Up @@ -5,9 +5,9 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)

args = ARGV.clone

if args.empty?
args.push "ls"
end
#if args.empty?
#args.push "ls"
#end

require "todotxt"
Todotxt::CLI.start(args)
17 changes: 17 additions & 0 deletions features/initialize.feature
@@ -0,0 +1,17 @@
Feature: Initialize

So that I can start using todotxt
As a new user
I want to set up example files

Background:
Given a home directory

Scenario: todotxt
When I run `todotxt` interactively
And I type "yes"
Then it should pass with:
"""
You need a .todotxt.cfg file in your home folder to continue (used to determine the path of your todo.txt.) Answer yes to have it generated for you (pointing to ~/todo.txt), or no to create it yourself.
"""
And a file named ".todotxt.cfg" should exist
3 changes: 3 additions & 0 deletions features/step_definitions/environment_steps.rb
@@ -0,0 +1,3 @@
Given /^a home directory$/ do
step %{a directory named "home"}
end
2 changes: 1 addition & 1 deletion lib/todotxt/cli.rb
Expand Up @@ -273,7 +273,7 @@ def ask_and_create_conf
confirm_generate = yes? "Create ~/.todotxt.cfg? [y/N]"

if confirm_generate
@cfg.generate!
@config.generate!
else
puts ""
exit
Expand Down
2 changes: 1 addition & 1 deletion lib/todotxt/config.rb
Expand Up @@ -25,7 +25,7 @@ def files
end

def generate!
FileUtils.copy "conf/todotxt.cfg", @config_path
FileUtils.copy File.join(File.dirname(File.expand_path(__FILE__)), "..", "..", "conf", "todotxt.cfg"), @config_path
end

private
Expand Down

0 comments on commit 990de0c

Please sign in to comment.