clitasks 0.0.3 → 0.0.5
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 +4 -4
- data/Rakefile +6 -0
- data/bin/task +5 -1
- data/lib/clitasks/commands.rb +7 -7
- data/lib/clitasks/configuration.rb +14 -0
- data/lib/clitasks/string_ext.rb +19 -0
- data/lib/clitasks/version.rb +3 -0
- data/lib/clitasks/viewer.rb +1 -1
- data/lib/clitasks/world.rb +4 -0
- data/lib/clitasks.rb +3 -0
- data/test/unit/link_builder_test.rb +9 -0
- data/test/unit/string_ext_test.rb +39 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc6898204b48be0886ba9edc71fd02708011ee85
|
4
|
+
data.tar.gz: 4ebd454e9d89e3a88a3e2ba09c874ae8c9938772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b1629e290269d40c5e83b62c798a5c8ae75f88108d9f142bdb28aee774889fbacd31afab33fe6568b78df2e08b86207cde6667b9b38d07d92c2499d972b380f
|
7
|
+
data.tar.gz: a2833139dc753bba54773d7f9d24f190d0cf21207fb5f5f15e5ac9d3c7f6adc909528df58a6ef51ed39b32b1e3891994a45e52f9594ea934308278776fdb3990
|
data/Rakefile
ADDED
data/bin/task
CHANGED
@@ -15,7 +15,11 @@ when 'edit'
|
|
15
15
|
CliTasks::Commands.edit *ARGV
|
16
16
|
CliTasks::Commands.rebuild
|
17
17
|
when 'search'
|
18
|
-
|
18
|
+
if ARGV.any?{|arg| arg == '-e' }
|
19
|
+
CliTasks::Commands.edit *ARGV.reject{|arg| arg == '-e' }
|
20
|
+
else
|
21
|
+
CliTasks::Commands.search *ARGV
|
22
|
+
end
|
19
23
|
CliTasks::Commands.rebuild
|
20
24
|
when 'start'
|
21
25
|
when 'finish'
|
data/lib/clitasks/commands.rb
CHANGED
@@ -28,8 +28,12 @@ module CliTasks
|
|
28
28
|
LinkBuilder.all
|
29
29
|
end
|
30
30
|
|
31
|
+
def world
|
32
|
+
@world ||= World.instance
|
33
|
+
end
|
34
|
+
|
31
35
|
def stories
|
32
|
-
@stories ||=
|
36
|
+
@stories ||= world.stories
|
33
37
|
end
|
34
38
|
|
35
39
|
def list(*args)
|
@@ -61,15 +65,11 @@ module CliTasks
|
|
61
65
|
story %q(#{name}) do
|
62
66
|
status queued
|
63
67
|
points 1
|
64
|
-
created_by
|
68
|
+
created_by '#{world.configuration.created_by || 'unassigned'}'
|
65
69
|
assigned_to :unassigned
|
66
70
|
tags *%w() # *%w(example example_two)
|
67
71
|
|
68
|
-
description
|
69
|
-
DESCRIPTION
|
70
|
-
|
71
|
-
comment :author, <<-COMMENT
|
72
|
-
COMMENT
|
72
|
+
description %q()
|
73
73
|
end
|
74
74
|
STORY
|
75
75
|
pattern = data.scan(/\A(\s+)/).uniq.min_by{|s| s.length }.first
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module CliTasks
|
2
|
+
class Configuration
|
3
|
+
include Singleton
|
4
|
+
attr_accessor :created_by
|
5
|
+
def load(file='stories/config.yml')
|
6
|
+
@file = file
|
7
|
+
@created_by = config['created_by']
|
8
|
+
end
|
9
|
+
|
10
|
+
def config
|
11
|
+
@config ||= YAML.load_file(@file)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'pp'
|
2
|
+
|
3
|
+
class String
|
4
|
+
def underscore
|
5
|
+
gsub(/(\W|_)+/, ?_)
|
6
|
+
end
|
7
|
+
|
8
|
+
def strip_chr(chrs)
|
9
|
+
gsub(%r{(^[#{chrs}]*|[#{chrs}]*$)}, '')
|
10
|
+
end
|
11
|
+
|
12
|
+
def sanitize
|
13
|
+
gsub(/\W+/, ' ')
|
14
|
+
end
|
15
|
+
|
16
|
+
def filenameify
|
17
|
+
downcase.underscore.strip_chr(?_)
|
18
|
+
end
|
19
|
+
end
|
data/lib/clitasks/viewer.rb
CHANGED
@@ -16,7 +16,7 @@ module CliTasks
|
|
16
16
|
def print
|
17
17
|
puts header
|
18
18
|
|
19
|
-
puts stories.
|
19
|
+
puts stories.reverse.inject({}){|hash,s|
|
20
20
|
hash.merge( s.status => hash.fetch(s.status, []) << s )
|
21
21
|
}.map{|status,group|
|
22
22
|
[separator] + group.map{|s| story(s) }
|
data/lib/clitasks/world.rb
CHANGED
data/lib/clitasks.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require './lib/clitasks'
|
3
|
+
|
4
|
+
describe 'New methods added to String class' do
|
5
|
+
let(:sample) { 'Hello World! This Is a @#$%&ing test' }
|
6
|
+
|
7
|
+
describe '#underscore' do
|
8
|
+
it 'should take any consecutive \W and sub with a single ?_' do
|
9
|
+
sample.underscore.must_equal 'Hello_World_This_Is_a_ing_test'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
describe '#strip_chr' do
|
13
|
+
it 'should remove any char passed in from beginning or end' do
|
14
|
+
sample.strip_chr('Hest ').must_equal 'llo World! This Is a @#$%&ing'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
describe '#sanitize' do
|
18
|
+
it 'should sub any consecutive \W with spaces' do
|
19
|
+
sample.sanitize.must_equal 'Hello World This Is a ing test'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
describe '#filenameify' do
|
23
|
+
it 'should downcase the string' do
|
24
|
+
sample.filenameify.match(/[A-Z]/).must_equal nil
|
25
|
+
end
|
26
|
+
it 'should convert consecutive \W into a single underscore' do
|
27
|
+
sample.filenameify.match(/\W/).must_equal nil
|
28
|
+
sample.filenameify.match(/\W\W+/).must_equal nil
|
29
|
+
sample.filenameify[/_/].must_equal '_'
|
30
|
+
end
|
31
|
+
it 'should remove any leading or trailing underscores' do
|
32
|
+
'_has leading and trailing underscores_'.filenameify.match(/^_/).must_equal nil
|
33
|
+
'_has leading and trailing underscores_'.filenameify.match(/_$/).must_equal nil
|
34
|
+
end
|
35
|
+
it 'should return an exceptable filename' do
|
36
|
+
sample.filenameify.must_equal 'hello_world_this_is_a_ing_test'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clitasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua "unixsuperhero" Toyota
|
@@ -17,16 +17,22 @@ executables:
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- lib/clitasks.rb
|
21
20
|
- lib/clitasks/commands.rb
|
21
|
+
- lib/clitasks/configuration.rb
|
22
22
|
- lib/clitasks/link_builder.rb
|
23
23
|
- lib/clitasks/runner.rb
|
24
24
|
- lib/clitasks/simple_dsl.rb
|
25
25
|
- lib/clitasks/story.rb
|
26
26
|
- lib/clitasks/story_reader.rb
|
27
|
+
- lib/clitasks/string_ext.rb
|
28
|
+
- lib/clitasks/version.rb
|
27
29
|
- lib/clitasks/viewer.rb
|
28
30
|
- lib/clitasks/world.rb
|
31
|
+
- lib/clitasks.rb
|
32
|
+
- test/unit/link_builder_test.rb
|
33
|
+
- test/unit/string_ext_test.rb
|
29
34
|
- bin/task
|
35
|
+
- Rakefile
|
30
36
|
homepage: http://github.com/unixsuperhero/clitasks
|
31
37
|
licenses:
|
32
38
|
- MIT
|