fwb 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1b583bccd02634ed023f86634dd2674b532fa26c
4
+ data.tar.gz: 0611cdfa963b5e9708ed077fd838b5a2f6105ed2
5
+ SHA512:
6
+ metadata.gz: 57cf0f9c30e2dcd832b3ed69824ec57daa32476ab9f50197fc7139ea897f3fd10e3dcc5d7b414a2c6896fb33da5a43a937571fdcb662dc7fca6c9466d4911fb4
7
+ data.tar.gz: 37625eab91fb85c0c3b3ac6ec7a10fb009e2dde77758719d677a5b009063879b0c840e2fa8f6ca63ca078d403f1f7d7473fdb809eb3783e84622f5a65a6acdaa
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fwb.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Shelby Doolittle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # fwb
2
+
3
+ Filesystem Work Backlog (pronounced FWiB) - the flexible work backlog for your life
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'fwb'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install fwb
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec fwb` to use the code located in this directory, ignoring other installed copies of this gem.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( https://github.com/[my-github-username]/fwb/fork )
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create a new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "fwb"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/exe/fwb ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fwb'
4
+
5
+ puts Fwb::CommandFactory.from_argv(ARGV).execute!.output
@@ -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 'fwb/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fwb"
8
+ spec.version = Fwb::VERSION
9
+ spec.authors = ["Shelby Doolittle"]
10
+ spec.email = ["shelby@shelbyd.com"]
11
+
12
+ spec.summary = %q{Filesystem Work Backlog (fwib) - the flexible work backlog for your life}
13
+ spec.homepage = "https://github.com/shelbyd/fwb"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.9"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "memfs"
25
+ end
@@ -0,0 +1,6 @@
1
+ require 'fwb/version'
2
+ require 'fwb/command_factory'
3
+ require 'fwb/commands'
4
+
5
+ module Fwb
6
+ end
@@ -0,0 +1,16 @@
1
+ require 'fwb/commands'
2
+
3
+ module Fwb
4
+ class CommandFactory
5
+ COMMAND_NAMES = {
6
+ 'init' => Commands::Init,
7
+ 'new' => Commands::New,
8
+ 'next' => Commands::Next,
9
+ 'done' => Commands::Done,
10
+ }
11
+
12
+ def self.from_argv(argv)
13
+ (COMMAND_NAMES[argv[0]] || Commands::Unrecognized).from_argv(argv)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ require 'fwb/commands/base'
2
+
3
+ require 'fwb/commands/done'
4
+ require 'fwb/commands/init'
5
+ require 'fwb/commands/new'
6
+ require 'fwb/commands/next'
7
+ require 'fwb/commands/unrecognized'
8
+
9
+ module Fwb
10
+ module Commands
11
+ end
12
+ end
@@ -0,0 +1,37 @@
1
+ module Fwb
2
+ module Commands
3
+ class Base
4
+ def execute!
5
+ self
6
+ end
7
+
8
+ def output
9
+ ''
10
+ end
11
+
12
+ def fwb_dir
13
+ File.join(pwd, '.fwb')
14
+ end
15
+
16
+ def pwd
17
+ @pwd || ENV['PWD']
18
+ end
19
+
20
+ def fwb_dir_exists?
21
+ File.exists? fwb_dir
22
+ end
23
+
24
+ def current_file
25
+ File.join(fwb_dir, 'current')
26
+ end
27
+
28
+ class Result
29
+ attr_accessor :output
30
+
31
+ def initialize(output)
32
+ self.output = output
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,25 @@
1
+ module Fwb
2
+ module Commands
3
+ class Done < Base
4
+ def self.from_argv(argv)
5
+ new
6
+ end
7
+
8
+ def execute!
9
+ return Result.new('fatal: Not a fwb backlog') unless fwb_dir_exists?
10
+ return Result.new('fatal: The backlog is empty') if backlog_empty?
11
+
12
+ current_tasks = File.read(current_file).lines.map(&:rstrip)
13
+ result = Result.new("Finished task: #{current_tasks.first}")
14
+ File.open(current_file, 'w') { |f| f.write (current_tasks.drop(1) + ['']).join("\n") }
15
+ result
16
+ end
17
+
18
+ private
19
+
20
+ def backlog_empty?
21
+ File.read(current_file) == ""
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ module Fwb
2
+ module Commands
3
+ class Init < Base
4
+ def self.from_argv(argv)
5
+ new(ENV['PWD'])
6
+ end
7
+
8
+ attr_accessor :pwd
9
+
10
+ def initialize(pwd)
11
+ self.pwd = pwd
12
+ end
13
+
14
+ def execute!
15
+ return Result.new("There is already a fwb backlog in #{pwd}") if fwb_dir_exists?
16
+
17
+ Dir.mkdir fwb_dir
18
+ FileUtils.touch current_file
19
+ super
20
+ end
21
+
22
+ def output
23
+ "Initialized empty fwb backlog in #{pwd}"
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ module Fwb
2
+ module Commands
3
+ class New < Base
4
+ def self.from_argv(argv)
5
+ new(argv[1])
6
+ end
7
+
8
+ attr_accessor :task_name
9
+
10
+ def initialize(task_name)
11
+ self.task_name = task_name
12
+ end
13
+
14
+ def execute!
15
+ return Result.new('fatal: Not a fwb backlog') unless fwb_dir_exists?
16
+
17
+ File.open(current_file, 'a') { |f| f.write "#{task_name}\n" }
18
+ super
19
+ end
20
+
21
+ def output
22
+ "Created task: #{task_name}"
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ module Fwb
2
+ module Commands
3
+ class Next < Base
4
+ def self.from_argv(argv)
5
+ new
6
+ end
7
+
8
+ def execute!
9
+ return Result.new('fatal: Not a fwb backlog') unless fwb_dir_exists?
10
+
11
+ super
12
+ end
13
+
14
+ def output
15
+ File.read(current_file).lines.map(&:rstrip).first ||
16
+ 'fatal: The backlog is empty'
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ module Fwb
2
+ module Commands
3
+ class Unrecognized < Base
4
+ def self.from_argv(argv)
5
+ new(argv[0])
6
+ end
7
+
8
+ attr_accessor :attempted_command
9
+
10
+ def initialize(attempted_command)
11
+ self.attempted_command = attempted_command
12
+ end
13
+
14
+ def output
15
+ "Unrecognized command: \"#{attempted_command}\""
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module Fwb
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fwb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Shelby Doolittle
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: memfs
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - shelby@shelbyd.com
72
+ executables:
73
+ - fwb
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - exe/fwb
87
+ - fwb.gemspec
88
+ - lib/fwb.rb
89
+ - lib/fwb/command_factory.rb
90
+ - lib/fwb/commands.rb
91
+ - lib/fwb/commands/base.rb
92
+ - lib/fwb/commands/done.rb
93
+ - lib/fwb/commands/init.rb
94
+ - lib/fwb/commands/new.rb
95
+ - lib/fwb/commands/next.rb
96
+ - lib/fwb/commands/unrecognized.rb
97
+ - lib/fwb/version.rb
98
+ homepage: https://github.com/shelbyd/fwb
99
+ licenses:
100
+ - MIT
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.4.6
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Filesystem Work Backlog (fwib) - the flexible work backlog for your life
122
+ test_files: []