Top Level Namespace

Defined Under Namespace

Classes: Config, Helper, Issue, LocalRepository, Repository

Constant Summary collapse

CONFIG_FILE =
'.waff.yml'
EXCLUDE_FILE =
'.git/info/exclude'
HELP_TEXT =
<<-EOF
Usage:

waff [command] [params]

Commands:

waff list         -- Shows ready and in progress issues
waff show         -- Shows description of current issue (determined by current branch)
waff show number  -- Shows description of a given issue
waff take number  -- Sets the issue in progress, assigns it to yourself, and creates a branch for it
waff pause number -- Sets the issue to ready state
EOF

Instance Method Summary collapse

Instance Method Details

#check_local_repository_existsObject



51
52
53
54
55
56
# File 'lib/waff.rb', line 51

def check_local_repository_exists
  unless File.exist?('.git')
    puts 'No git repository found. Please move to the root of your project.'
    exit
  end
end

#init_configObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/waff.rb', line 22

def init_config
  unless File.exist?(CONFIG_FILE)
    puts "No config file detected (#{CONFIG_FILE}). Will generate one now in current directory."
    print 'Github username: '
    user = $stdin.gets
    print 'Github password/personal token: '
    token = $stdin.gets
    print 'Git remote (leave empty for "origin"): '
    remote = $stdin.gets.strip
    remote = remote.empty? ? 'origin' : remote

    # Write config file
    File.open(CONFIG_FILE, 'w') do |file|
      file.puts "user: #{user}"
      file.puts "token: #{token}"
      file.puts "remote: #{remote}"
    end

    # Write exclude file
    FileUtils.mkdir_p(File.dirname(EXCLUDE_FILE))
    File.open(EXCLUDE_FILE, 'a+') do |file|
      unless file.read =~ /^#{CONFIG_FILE}$/
        file.puts CONFIG_FILE
      end
    end

  end
end