tag 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gemspec CHANGED
@@ -12,12 +12,11 @@ Gem::Specification.new do |s|
12
12
  s.description = "This project lets you tag anything from the commandline. The `tag` executable provides a consistent way to add, remove and modify tags for tagged items. The goal is to make tagging dead simple and usable by other commandline apps. In making tags a first class nix citizen, perhaps they will see the light of day."
13
13
  s.required_rubygems_version = ">= 1.3.6"
14
14
  s.executables = %w(tag)
15
- s.add_dependency 'thor', '~> 0.14.6'
15
+ s.add_dependency 'boson', '~> 1.0.0'
16
16
  s.add_development_dependency 'bahia', '~> 0.4.0'
17
17
  s.add_development_dependency 'minitest', '~> 2.11.0'
18
18
  s.add_development_dependency 'rake', '~> 0.9.2'
19
- s.files = Dir.glob(%w[{lib,spec}/**/*.rb bin/* [A-Z]*.{txt,rdoc,md} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
20
- s.files += %w{.travis.yml}
19
+ s.files = Dir.glob(%w[{lib,spec}/**/*.rb bin/* [A-Z]*.{txt,rdoc,md} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec .travis.yml}
21
20
  s.extra_rdoc_files = ["README.md", "LICENSE.txt"]
22
21
  s.license = 'MIT'
23
22
  end
@@ -1,3 +1,6 @@
1
+ == 0.3.0
2
+ * Switch out thor for boson
3
+
1
4
  == 0.2.1
2
5
  * Fix gemspec loading
3
6
  * Update dev dependencies
data/README.md CHANGED
@@ -10,8 +10,8 @@ Examples
10
10
 
11
11
  Let's start with tagging animals:
12
12
 
13
- $ tag add horse -t fast strong
14
- $ tag add cat -t fast independent
13
+ $ tag add horse -t fast,strong
14
+ $ tag add cat -t fast,independent
15
15
  $ tag add dog -t loving
16
16
  $ tag list fast
17
17
  horse
@@ -21,8 +21,8 @@ Tired of animals, let's tag cities. To avoid interfering with
21
21
  the animals list, we'll use a cities model:
22
22
 
23
23
  $ tag add nyc -t fast fun -m cities
24
- $ tag add boston -t educated clean -m cities
25
- $ tag add paris -t awesome delicious
24
+ $ tag add boston -t educated,clean -m cities
25
+ $ tag add paris -t awesome,delicious
26
26
  $ tag list fast -m cities
27
27
  nyc
28
28
  # to avoid typing '-m cities' for every command
@@ -47,5 +47,4 @@ Todo
47
47
  * Several more tag actions
48
48
  * Description and time fields
49
49
  * Make storage agnostic
50
- * Switch from thor to boson
51
50
  * Explain how to integrate with other commandline apps
data/deps.rip CHANGED
@@ -1 +1 @@
1
- thor ~>0.14.6
1
+ boson ~>1.0.0
@@ -1,35 +1,38 @@
1
- require 'thor'
1
+ require 'boson/runner'
2
2
 
3
3
  module Tag
4
- class Runner < Thor
4
+ class Runner < Boson::Runner
5
5
  def self.model_option
6
- method_option :model, :type => :string, :aliases => '-m'
6
+ option :model, :type => :string
7
7
  end
8
8
 
9
9
  model_option
10
- method_option :tags, :type => :array, :required => true, :aliases => '-t'
11
- desc "add *ITEMS -t *TAGS", 'add tag(s) to item(s)'
10
+ option :tags, :type => :array, :required => true
11
+ desc 'add tag(s) to item(s)'
12
12
  def add(*items)
13
+ options = items[-1].is_a?(Hash) ? items.pop : {}
13
14
  Tag.store(options[:model]).multi_tag(items, options[:tags])
14
15
  end
15
16
 
16
17
  model_option
17
- method_option :tags, :type => :array, :required => true, :aliases => '-t'
18
- desc "rm *ITEMS -t *TAGS", 'remove tag(s) from item(s)'
18
+ option :tags, :type => :array, :required => true
19
+ desc 'remove tag(s) from item(s)'
19
20
  def rm(*items)
21
+ options = items[-1].is_a?(Hash) ? items.pop : {}
20
22
  Tag.store(options[:model]).multi_remove_tag(items, options[:tags])
21
23
  end
22
24
 
23
25
  model_option
24
- desc "list TAG", 'list items by tag'
25
- def list(tag)
26
+ desc 'list items by tag'
27
+ def list(tag, options={})
26
28
  puts Tag.store(options[:model]).list(tag)
27
29
  end
28
30
 
29
31
  model_option
30
- method_option :rm, :type => :boolean, :desc => 'remove tags'
31
- desc "tags", 'list or remove tags'
32
+ option :rm, :type => :boolean, :desc => 'remove tags'
33
+ desc 'list or remove tags'
32
34
  def tags(*args)
35
+ options = args[-1].is_a?(Hash) ? args.pop : {}
33
36
  if options[:rm]
34
37
  Tag.store(options[:model]).delete_tags(*args)
35
38
  else
@@ -38,12 +41,12 @@ module Tag
38
41
  end
39
42
 
40
43
  model_option
41
- desc "tree", 'print tags with their items underneath them'
42
- def tree
44
+ desc 'print tags with their items underneath them'
45
+ def tree(options={})
43
46
  puts Tag.store(options[:model]).tree
44
47
  end
45
48
 
46
- desc "models", 'list models'
49
+ desc 'list models'
47
50
  def models
48
51
  puts Tag::Store.models
49
52
  end
@@ -1,3 +1,3 @@
1
1
  module Tag
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -15,7 +15,7 @@ describe Tag::Runner do
15
15
  end
16
16
 
17
17
  it "adds two tags" do
18
- tag 'add feynman -t physicist teacher'
18
+ tag 'add feynman -t physicist,teacher'
19
19
  tagged('physicist').must_equal ["feynman"]
20
20
  tagged('physicist').must_equal ["feynman"]
21
21
  end
@@ -47,22 +47,22 @@ describe Tag::Runner do
47
47
 
48
48
  describe "rm" do
49
49
  it "removes a tag" do
50
- tag 'add newton -t physicist fig'
50
+ tag 'add newton -t physicist,fig'
51
51
  tag 'rm newton -t fig'
52
52
  tagged('physicist').must_equal ['newton']
53
53
  tagged('fig').must_equal []
54
54
  end
55
55
 
56
56
  it "removes two tags" do
57
- tag 'add newton -t physicist fig sir'
58
- tag 'rm newton -t fig sir'
57
+ tag 'add newton -t physicist,fig,sir'
58
+ tag 'rm newton -t fig,sir'
59
59
  tagged('physicist').must_equal ['newton']
60
60
  tagged('fig').must_equal []
61
61
  tagged('sir').must_equal []
62
62
  end
63
63
 
64
64
  it "removes two items from a tag" do
65
- tag 'add newton -t physicist fig'
65
+ tag 'add newton -t physicist,fig'
66
66
  tag 'add tree -t fig'
67
67
  tag 'rm newton tree -t fig'
68
68
  tagged('fig').must_equal []
@@ -74,7 +74,7 @@ describe Tag::Runner do
74
74
  end
75
75
 
76
76
  it "with model option removes a tag from other model" do
77
- tag 'add newton -t physicist fig -m physics'
77
+ tag 'add newton -t physicist,fig -m physics'
78
78
  tag 'rm newton -t fig -m physics'
79
79
  tagged('physicist -m physics').must_equal ['newton']
80
80
  tagged('physicist').must_equal []
@@ -83,13 +83,13 @@ describe Tag::Runner do
83
83
 
84
84
  describe "tags" do
85
85
  it "by default lists all tags" do
86
- tag 'add fermi -t italian german irish'
86
+ tag 'add fermi -t italian,german,irish'
87
87
  tag 'tags'
88
88
  stdout.split("\n").must_equal %w{german irish italian}
89
89
  end
90
90
 
91
91
  it "with model option lists all tags for another model" do
92
- tag 'add fermi -t italian german irish -m physicist'
92
+ tag 'add fermi -t italian,german,irish -m physicist'
93
93
  tag 'tags -m physicist'
94
94
  stdout.split("\n").must_equal %w{german irish italian}
95
95
  tag 'tags'
@@ -97,8 +97,8 @@ describe Tag::Runner do
97
97
  end
98
98
 
99
99
  it "with rm option deletes tags" do
100
- tag 'add fermi -t italian german irish'
101
- tag 'add davinci -t italian german irish'
100
+ tag 'add fermi -t italian,german,irish'
101
+ tag 'add davinci -t italian,german,irish'
102
102
  tag 'tags german irish --rm'
103
103
  tagged('german').must_equal []
104
104
  tagged('irish').must_equal []
@@ -106,7 +106,7 @@ describe Tag::Runner do
106
106
  end
107
107
 
108
108
  it "tree prints tree" do
109
- tag 'add child -t parent1 parent2'
109
+ tag 'add child -t parent1,parent2'
110
110
  tag 'tree'
111
111
  stdout.chomp.must_equal [
112
112
  'parent1', ' child', 'parent2', ' child'
@@ -114,7 +114,7 @@ describe Tag::Runner do
114
114
  end
115
115
 
116
116
  it "models prints list of models" do
117
- tag 'add feynman -t funny -m physicist'
117
+ tag 'add feynman -t funny -m=physicist'
118
118
  tag 'add cat -t independent'
119
119
  tag 'models'
120
120
  stdout.split("\n").must_equal ['default', 'physicist']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-23 00:00:00.000000000 Z
12
+ date: 2012-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: thor
16
- requirement: &70106164252560 !ruby/object:Gem::Requirement
15
+ name: boson
16
+ requirement: &70210577708060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.14.6
21
+ version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70106164252560
24
+ version_requirements: *70210577708060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bahia
27
- requirement: &70106164177780 !ruby/object:Gem::Requirement
27
+ requirement: &70210577707580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.4.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70106164177780
35
+ version_requirements: *70210577707580
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: minitest
38
- requirement: &70106164177020 !ruby/object:Gem::Requirement
38
+ requirement: &70210577707000 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.11.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70106164177020
46
+ version_requirements: *70210577707000
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &70106164176360 !ruby/object:Gem::Requirement
49
+ requirement: &70210577706480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.9.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70106164176360
57
+ version_requirements: *70210577706480
58
58
  description: This project lets you tag anything from the commandline. The `tag` executable
59
59
  provides a consistent way to add, remove and modify tags for tagged items. The goal
60
60
  is to make tagging dead simple and usable by other commandline apps. In making tags
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: 1.3.6
104
104
  requirements: []
105
105
  rubyforge_project:
106
- rubygems_version: 1.8.16
106
+ rubygems_version: 1.8.11
107
107
  signing_key:
108
108
  specification_version: 3
109
109
  summary: tag anything from the commandline