taskdown 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +9 -0
- data/lib/taskdown.rb +13 -0
- data/lib/taskdown/manager.rb +22 -0
- data/lib/taskdown/project.rb +28 -0
- data/lib/taskdown/task.rb +38 -0
- data/lib/taskdown/version.rb +3 -0
- data/spec/fixtures/project.txt +9 -0
- data/spec/fixtures/projects.txt +11 -0
- data/spec/fixtures/task.txt +3 -0
- data/spec/taskdown/manager_spec.rb +31 -0
- data/spec/taskdown/project_spec.rb +46 -0
- data/spec/taskdown/task_spec.rb +39 -0
- data/spec/taskdown_spec.rb +11 -0
- data/taskdown.gemspec +21 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ad8f1401e5fd27d0890bae1468a92847fb045713
|
4
|
+
data.tar.gz: 99d0cb8d86976ff203d1fba699901efcc641b488
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 22c369b0a76a16a421c28af9347176b7c46f113beb7e007a077cb44978bce9059b06626c569c2c5d96b39f1e9728927363284015afe04867737b8674a05e35ef
|
7
|
+
data.tar.gz: 35c16a02b233e622e534661e7e5d8a95c76391d71216467e8f5cff27c1b38b45bfdccd2d07e1003e7007a84506105681b06ac6ca7cd7d74a5b1eb7eb1877a87f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Hashrocket Workstation
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Taskdown
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'taskdown'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install taskdown
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/taskdown.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
class Taskdown::Manager
|
2
|
+
attr_reader :text
|
3
|
+
|
4
|
+
def initialize(string)
|
5
|
+
@text = string
|
6
|
+
end
|
7
|
+
|
8
|
+
def projects
|
9
|
+
text.split(/(?=^!)/).map do |project_string|
|
10
|
+
Taskdown::Project.new(project_string)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_hash
|
15
|
+
{ projects: projects.map(&:to_hash) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_json
|
19
|
+
to_hash.to_json
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'taskdown'
|
2
|
+
|
3
|
+
class Taskdown::Project
|
4
|
+
attr_reader :text, :name
|
5
|
+
|
6
|
+
def initialize(string)
|
7
|
+
@text = string
|
8
|
+
@name = text.slice!(/^\!.+/)[1..-1].strip
|
9
|
+
end
|
10
|
+
|
11
|
+
def tasks
|
12
|
+
task_strings.map do |task|
|
13
|
+
Taskdown::Task.new(task)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def task_strings
|
18
|
+
text.split(/(?=\n\w)/).delete_if do |element|
|
19
|
+
element == "\n" || element == ""
|
20
|
+
end.map(&:strip)
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_hash
|
24
|
+
{ name: name,
|
25
|
+
tasks: tasks.map(&:to_hash) }
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'taskdown'
|
2
|
+
|
3
|
+
class Taskdown::Task
|
4
|
+
|
5
|
+
attr_reader :text, :modified_text
|
6
|
+
|
7
|
+
def initialize(string)
|
8
|
+
@text = string
|
9
|
+
@modified_text = @text.dup
|
10
|
+
end
|
11
|
+
|
12
|
+
def name
|
13
|
+
@name ||= modified_text.slice!(/^.+\n/)
|
14
|
+
end
|
15
|
+
|
16
|
+
def description
|
17
|
+
@description ||= modified_text.slice(/^\s+.+/m).chomp
|
18
|
+
end
|
19
|
+
|
20
|
+
def labels
|
21
|
+
@labels ||= prestripped_labels.map do |label|
|
22
|
+
label.gsub(/^\#/, '')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_hash
|
27
|
+
{ name: name,
|
28
|
+
description: description,
|
29
|
+
labels: labels }
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def prestripped_labels
|
35
|
+
text.scan(/\#\s*\w+/)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
!Project one
|
2
|
+
This is the first #task
|
3
|
+
With the first description
|
4
|
+
And the second like of the first descrption
|
5
|
+
Of the first task
|
6
|
+
|
7
|
+
!Project two
|
8
|
+
This is the first task fo the #second_project
|
9
|
+
And with the first line
|
10
|
+
Of the first description
|
11
|
+
Of the second project
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'taskdown'
|
2
|
+
require 'taskdown/manager'
|
3
|
+
|
4
|
+
describe Taskdown::Manager do
|
5
|
+
|
6
|
+
let(:project_string) do
|
7
|
+
File.read "spec/fixtures/projects.txt"
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:manager) { Taskdown::Manager.new(project_string) }
|
11
|
+
|
12
|
+
describe "#text" do
|
13
|
+
it "returns the passed in string" do
|
14
|
+
manager.text.should == project_string
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#projects" do
|
19
|
+
it "returns a collection of projects" do
|
20
|
+
manager.projects.first.should be_a(Taskdown::Project)
|
21
|
+
manager.projects.count.should == 2
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "to_hash" do
|
26
|
+
it "returns a hash of the projects and tasks" do
|
27
|
+
manager.to_hash.keys.should include(:projects)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'taskdown/project'
|
2
|
+
require 'taskdown/task'
|
3
|
+
|
4
|
+
describe Taskdown::Project do
|
5
|
+
let(:project) { described_class.new(project_string) }
|
6
|
+
|
7
|
+
|
8
|
+
let(:project_string) do
|
9
|
+
File.read "spec/fixtures/project.txt"
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#name" do
|
13
|
+
it "returns the name of the project" do
|
14
|
+
project.name.should == "Project one"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#task_strings" do
|
19
|
+
it "returns a collection of task strings" do
|
20
|
+
project.task_strings.count.should == 2
|
21
|
+
project.task_strings.first.should be_a(String)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#tasks" do
|
26
|
+
|
27
|
+
let(:first_task) { project.tasks.first }
|
28
|
+
|
29
|
+
it "returns a collection of tasks" do
|
30
|
+
first_task.should be_instance_of(Taskdown::Task)
|
31
|
+
project.tasks.should be_a(Array)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#to_hash" do
|
37
|
+
it "returns a hash of of the project" do
|
38
|
+
project.to_hash.keys.should include(:name, :tasks)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "has an array of tasks" do
|
42
|
+
project.to_hash[:tasks].should be_a(Array)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'taskdown/task'
|
2
|
+
|
3
|
+
describe Taskdown::Task do
|
4
|
+
|
5
|
+
let(:task) { Taskdown::Task.new(string) }
|
6
|
+
|
7
|
+
let(:string) do
|
8
|
+
File.read 'spec/fixtures/task.txt'
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#name" do
|
12
|
+
it "returns the name from the sting" do
|
13
|
+
task.name.should == "Task 1 #label1 #label2 two\n"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#description" do
|
18
|
+
it "returns any indented line" do
|
19
|
+
task.description.should == " Descripiton #label3\n Description line2 #label4"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#labels" do
|
24
|
+
it "returns a collection of words prefixed with a '#'" do
|
25
|
+
task.labels.should == ['label1','label2','label3', 'label4']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#to_hash" do
|
30
|
+
it "returns a hash of the task" do
|
31
|
+
task.to_hash.should == {
|
32
|
+
name: "Task 1 #label1 #label2 two\n",
|
33
|
+
description: " Descripiton #label3\n Description line2 #label4",
|
34
|
+
labels: ['label1','label2','label3', 'label4']
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
data/taskdown.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/taskdown/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["mrmicahcooper"]
|
6
|
+
gem.email = ["mrmicahcoop@gmail.com"]
|
7
|
+
gem.description = %q{Parses Taskdown syntax}
|
8
|
+
gem.summary = %q{}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "taskdown"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Taskdown::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency 'pry'
|
19
|
+
gem.add_development_dependency 'rspec'
|
20
|
+
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: taskdown
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mrmicahcooper
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Parses Taskdown syntax
|
42
|
+
email:
|
43
|
+
- mrmicahcoop@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- .rspec
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/taskdown.rb
|
55
|
+
- lib/taskdown/manager.rb
|
56
|
+
- lib/taskdown/project.rb
|
57
|
+
- lib/taskdown/task.rb
|
58
|
+
- lib/taskdown/version.rb
|
59
|
+
- spec/fixtures/project.txt
|
60
|
+
- spec/fixtures/projects.txt
|
61
|
+
- spec/fixtures/task.txt
|
62
|
+
- spec/taskdown/manager_spec.rb
|
63
|
+
- spec/taskdown/project_spec.rb
|
64
|
+
- spec/taskdown/task_spec.rb
|
65
|
+
- spec/taskdown_spec.rb
|
66
|
+
- taskdown.gemspec
|
67
|
+
homepage: ''
|
68
|
+
licenses: []
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 2.0.6
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: ''
|
90
|
+
test_files:
|
91
|
+
- spec/fixtures/project.txt
|
92
|
+
- spec/fixtures/projects.txt
|
93
|
+
- spec/fixtures/task.txt
|
94
|
+
- spec/taskdown/manager_spec.rb
|
95
|
+
- spec/taskdown/project_spec.rb
|
96
|
+
- spec/taskdown/task_spec.rb
|
97
|
+
- spec/taskdown_spec.rb
|