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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8b3bf9526e0ed143b51fafe5ff7f46bf71790cd
4
- data.tar.gz: f5a371089e0306e5d65eebd711f38b8535b2612e
3
+ metadata.gz: dc6898204b48be0886ba9edc71fd02708011ee85
4
+ data.tar.gz: 4ebd454e9d89e3a88a3e2ba09c874ae8c9938772
5
5
  SHA512:
6
- metadata.gz: 37035c652d2994b2416d7026098f9646927d4d085255bf540f5ab0305b894786b80bff04fc3d7a5b0605ae9ccd475b51528b8e374d9d64d4ca6d8ea57292e92f
7
- data.tar.gz: 2a4d7b4a2f1440b90c12c6cee8285c4684da467b5a7ed866cf16658e195d669bdb42efd67f329a6c06d0d5cd289049500fea80b436ca8ffa9cddd260196e6950
6
+ metadata.gz: 8b1629e290269d40c5e83b62c798a5c8ae75f88108d9f142bdb28aee774889fbacd31afab33fe6568b78df2e08b86207cde6667b9b38d07d92c2499d972b380f
7
+ data.tar.gz: a2833139dc753bba54773d7f9d24f190d0cf21207fb5f5f15e5ac9d3c7f6adc909528df58a6ef51ed39b32b1e3891994a45e52f9594ea934308278776fdb3990
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ t.pattern = "test/**/*_test.rb"
6
+ end
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
- CliTasks::Commands.search *ARGV
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'
@@ -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 ||= World.instance.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 :unassigned
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 <<-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
@@ -0,0 +1,3 @@
1
+ module CliTasks
2
+ VERSION = '0.0.5'
3
+ end
@@ -16,7 +16,7 @@ module CliTasks
16
16
  def print
17
17
  puts header
18
18
 
19
- puts stories.sort_by{|s| s.name }.inject({}){|hash,s|
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) }
@@ -3,6 +3,10 @@ module CliTasks
3
3
  include Singleton
4
4
  attr_writer :stories
5
5
 
6
+ def configuration
7
+ @configuration ||= Configuration.instance.tap(&:load)
8
+ end
9
+
6
10
  def reset
7
11
  @stories = []
8
12
  end
data/lib/clitasks.rb CHANGED
@@ -2,7 +2,10 @@ require 'fileutils'
2
2
  require 'pathname'
3
3
  require 'pp'
4
4
  require 'singleton'
5
+ require 'yaml'
5
6
 
7
+ require 'clitasks/string_ext'
8
+ require 'clitasks/configuration'
6
9
  require 'clitasks/world'
7
10
  require 'clitasks/simple_dsl'
8
11
  require 'clitasks/story_reader'
@@ -0,0 +1,9 @@
1
+ require 'minitest/autorun'
2
+ require './lib/clitasks'
3
+
4
+ describe CliTasks::LinkBuilder do
5
+ describe '#link' do
6
+ it 'should make any intermediate directories'
7
+ it 'should find the relative_path from the symlink to the links target'
8
+ end
9
+ end
@@ -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.3
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