rabbit_hole 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 003a74074b3696cbd896f8692f9fbf1fc5e6beb4
4
+ data.tar.gz: 9ae58825cc0855f06ab8eb22bb13a98578ffcec5
5
+ SHA512:
6
+ metadata.gz: 3b426b098a0307fae273bf0bb645898f30019c1e03f20994c57e18d1541ab6f3f0f32dde036c32527cdfe497acdda18ef47da7d0b7ff8e83c880f520ad714cd7
7
+ data.tar.gz: 72f709036c181677a0800b18eeb67826955f6176714a02f9c2ae8b8d0e304f7514fea90b4530a1dd12863483e85f79b8be5dd447c15069da74480f5653a837e5
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rabbit_hole.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 David Underwood
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,52 @@
1
+ # RabbitHole
2
+
3
+ Ever have one of those situations where every task seems to spawn another one, and another one, and another one?
4
+
5
+ Eventually you forget where you started and end up lost in a mess of documentation, source code, and config files.
6
+
7
+ A rabbit hole.
8
+
9
+ Use this gem to find your way back out again. Add each new task as you start it, and RabbitHole will keep track of your task stack for you. When you finish a task, tell RabbitHole and it'll remind you what you were working on before. Keep going til you get back to your starting point.
10
+
11
+ ## Installation
12
+
13
+ $ gem install rabbit_hole
14
+
15
+ ## Usage
16
+
17
+ Add new tasks:
18
+
19
+ $ rabbithole add "My new task"
20
+
21
+ See the current task:
22
+
23
+ $ rabbithole current
24
+
25
+ Complete the current task:
26
+
27
+ $ rabbithole complete
28
+
29
+ Remind yourself how deep you are:
30
+
31
+ $ rabbithole show
32
+
33
+ ### Abbreviations
34
+
35
+ All commands can be abbreviated as long as they're unambiguous.
36
+
37
+ e.g. `rabbithole s` maps to `rabbithole show`.
38
+
39
+ ### Aliases
40
+
41
+ I recommend adding an alias to your shell as typing 'rabbithole' all the time is cumbersome.
42
+
43
+ I use `alias rh="rabbithole"`.
44
+
45
+ ## Contributing
46
+
47
+ 1. Fork it
48
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 1. Write code and tests
50
+ 1. Commit your changes (`git commit -am 'Add some feature'`)
51
+ 1. Push to the branch (`git push origin my-new-feature`)
52
+ 1. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require "pathname"
3
+ bin_file = Pathname.new(__FILE__).realpath
4
+ $:.unshift File.expand_path("../../lib", bin_file)
5
+
6
+ require 'rabbit_hole'
7
+
8
+ RabbitHole::CLI.start(ARGV)
@@ -0,0 +1,4 @@
1
+ require "rabbit_hole/version"
2
+ require "rabbit_hole/base"
3
+ require "rabbit_hole/cli"
4
+
@@ -0,0 +1,58 @@
1
+ require "yaml"
2
+
3
+ module RabbitHole
4
+
5
+ class Base
6
+
7
+ def initialize(yml_path = "#{Dir.home}/.rabbit_hole.yml")
8
+ @yml_path = yml_path
9
+ end
10
+
11
+ def push(task)
12
+ with_stack do |stack|
13
+ stack.push(task)
14
+ end
15
+ end
16
+
17
+ def pop
18
+ with_stack do |stack|
19
+ stack.pop
20
+ end
21
+ end
22
+
23
+ def top
24
+ with_stack do |stack|
25
+ stack.last
26
+ end
27
+ end
28
+
29
+ def size
30
+ with_stack do |stack|
31
+ stack.size
32
+ end
33
+ end
34
+
35
+ def tasks
36
+ with_stack do |stack|
37
+ stack
38
+ end
39
+ end
40
+
41
+ private
42
+
43
+ def with_stack
44
+
45
+ if File.file?(@yml_path)
46
+ stack = YAML.load_file(@yml_path)
47
+ else
48
+ stack ||= []
49
+ end
50
+
51
+ result = yield stack
52
+
53
+ File.open(@yml_path, 'w') { |f| YAML.dump(stack, f) }
54
+
55
+ result
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,36 @@
1
+ require "thor"
2
+
3
+ module RabbitHole
4
+ class CLI < Thor
5
+ desc "add TASK", "Adds TASK to the top of the stack"
6
+ def add(task)
7
+ stack = Base.new
8
+ stack.push task
9
+ puts "Added task '#{task}' to the stack!"
10
+ end
11
+
12
+ desc "current", "show the current task"
13
+ def current
14
+ stack = Base.new
15
+ puts "Currently working on: '#{stack.top}'"
16
+ end
17
+
18
+ desc "complete", "Complete the current task"
19
+ def complete
20
+ stack = Base.new
21
+ puts "Completed: '#{stack.pop}'"
22
+ puts "Next task: '#{stack.top}'"
23
+ end
24
+
25
+ desc "show", "Show all tasks in the stack"
26
+ def show
27
+ stack = Base.new
28
+ tasks = stack.tasks
29
+ puts "#{tasks.size} levels deep"
30
+ puts "Current task: #{tasks.last}"
31
+ tasks[0...-1].each do |task|
32
+ puts task
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module RabbitHole
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rabbit_hole/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rabbit_hole"
8
+ spec.version = RabbitHole::VERSION
9
+ spec.authors = ["David Underwood"]
10
+ spec.email = ["davefp@gmail.com"]
11
+ spec.summary = %q{A quick and dirty command-line task organizer for finding your way out of rabbit-holes}
12
+ spec.description = %q{RabbitHole is designed for those times when you realize you're disappearing down a rabbit-hole and want to remember how you got there. Add successive tasks with `taskstack add TASK`. Mark the current task completed with `taskstack complete`, and it'll show you the task you were working on previously.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "thor", "~> 0.18"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rspec", "~> 2.14"
25
+ end
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+ describe RabbitHole do
3
+
4
+ before do
5
+
6
+ yml_path = "#{Dir.home}/.rabbit_hole_test.yml"
7
+
8
+ File.open(yml_path, "w") {|f| YAML.dump([], f)}
9
+ @task_stack = RabbitHole::Base.new(yml_path)
10
+ end
11
+
12
+ context "add task" do
13
+
14
+ before do
15
+ @task = "My new task"
16
+ end
17
+
18
+ it "should add the task to the top of the stack" do
19
+ @task_stack.push(@task)
20
+ @task_stack.top.should eq @task
21
+ end
22
+
23
+ it "should increase the size of the stack by 1" do
24
+ old_size = @task_stack.size
25
+ @task_stack.push(@task)
26
+
27
+ @task_stack.size.should eq (old_size + 1)
28
+ end
29
+
30
+ end
31
+
32
+ context "remove task" do
33
+
34
+ before do
35
+ @task = "My old task"
36
+ @task_stack.push(@task)
37
+ end
38
+
39
+ it "should return the last task" do
40
+ other_task = @task_stack.pop
41
+
42
+ other_task.should eq @task
43
+ end
44
+
45
+ it "should remove the top task from the stack" do
46
+ @task_stack.pop
47
+
48
+ @task_stack.top.should_not eq @task
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'rabbit_hole' # and any other gems you need
5
+
6
+ RSpec.configure do |config|
7
+ # some (optional) config here
8
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbit_hole
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - David Underwood
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.18'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.18'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.14'
55
+ description: RabbitHole is designed for those times when you realize you're disappearing
56
+ down a rabbit-hole and want to remember how you got there. Add successive tasks
57
+ with `taskstack add TASK`. Mark the current task completed with `taskstack complete`,
58
+ and it'll show you the task you were working on previously.
59
+ email:
60
+ - davefp@gmail.com
61
+ executables:
62
+ - rabbithole
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - .gitignore
67
+ - Gemfile
68
+ - LICENSE.txt
69
+ - README.md
70
+ - bin/rabbithole
71
+ - lib/rabbit_hole.rb
72
+ - lib/rabbit_hole/base.rb
73
+ - lib/rabbit_hole/cli.rb
74
+ - lib/rabbit_hole/version.rb
75
+ - rabbit_hole.gemspec
76
+ - spec/base_spec.rb
77
+ - spec/spec_helper.rb
78
+ homepage: ''
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.0.14
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: A quick and dirty command-line task organizer for finding your way out of
102
+ rabbit-holes
103
+ test_files:
104
+ - spec/base_spec.rb
105
+ - spec/spec_helper.rb