beastie 0.4.0 → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55a0236d7397dc7dd609866c8626939671311a40
4
- data.tar.gz: 4c2bbd746c30ddf062e5e93dcd07585479db165a
3
+ metadata.gz: ca5d460f24e83edbb2b106d2b1f60d8e8c10f5fc
4
+ data.tar.gz: dd4e8dd316989aea173f854ec5296303ce3a5830
5
5
  SHA512:
6
- metadata.gz: a7b1ca0ad1891cfe1b6f977aa540c61637b1a080d6aaefb51f6b2c68762327ca8ece38b671a8a01286e136380f24505ebeffd6c689157af5af512d7db1ae8932
7
- data.tar.gz: a29e31ed196abfdf13c16fcc4e227de4b09028ff007acdf90f8be02f88c4dc3c0471307b151d31a1a15eda4852f7cc78e5f2c7a2f7c105d885b7caf0d7655b34
6
+ metadata.gz: 836849aadce0e785d18ad285a6264cb0258cb3a6d9cd5efc3452c07b6f2ebc6b3396fcca27804cecd82cf98bc7bcb4b1ea82144e0bf3c27d9f86e203013f7477
7
+ data.tar.gz: fde34045e57073b772bb47d6633eacc8b822ef966be48366ac558d73af90effec717af1ac897d5051da283a838579beecc6eadb65a67ba836abd7de389188aa5
data/README.textile CHANGED
@@ -107,6 +107,18 @@ will show open issues with priority greater or equal to 4.
107
107
 
108
108
  Notice that the expression passes as argument to @--where@ is evaluated in Ruby, so any Ruby expression will work.
109
109
 
110
+ Since, after the initial excitement, typing @--where "status == 'open'"@ becomes quite boring, the following shortcuts are available:
111
+
112
+ * @--status STATUS@, to select by status
113
+ * @--type TYPE@, to select by type
114
+
115
+ the options are put in and. So, for instance:
116
+
117
+ beastie --status open --type bug --where "priority > 3"
118
+
119
+ will select the open issues, with type bug and priority greater than 3.
120
+
121
+
110
122
  h2. Remarks and Warnings
111
123
 
112
124
  Beastie generates human-readable filenames, following the convention "Jekyll":http://jekyllrb.com has for blog posts. Selecting issues using filenames, however, is a bit clumsy and to simplify operations @beastie@ assigns a number to each issue, which can be used to reference them. The number can be seen with the @list@ command and depends upon the order in which issues are listed in the directory. Thus *the same issue might be assigned a different id over time*, if the order in which files are read changes (e.g., if a new back-dated issue is added by hand).
data/bin/beastie CHANGED
@@ -16,6 +16,7 @@ Mercenary.program(:beastie) do |p|
16
16
  p.command(:new) do |c|
17
17
  c.syntax "new"
18
18
  c.description "create a new issue"
19
+ c.alias :add
19
20
 
20
21
  c.action do |args, options|
21
22
  if args.size != 0
@@ -77,12 +78,20 @@ Mercenary.program(:beastie) do |p|
77
78
  c.description "list all issues"
78
79
 
79
80
  c.option "where", "-w COND", "--where COND", "filter according to condition"
81
+ c.option "open", "-s STATUS", "--status STATUS", "list only issues of a given status"
82
+ c.option "type", "-t TYPE", "--type TYPE", "list only issues of a given type"
80
83
 
81
84
  c.action do |_, options|
82
85
  dir = dest_dir options
83
86
 
84
87
  issue = Beastie::Issue.new dir
85
- issue.list options["where"] || "true" # it is a string because we eval the argument
88
+
89
+ filter = "true" # it is a string because it is eval-uated
90
+ filter += " and status == '#{options["open"]}'" if options["open"]
91
+ filter += " and type == '#{options["type"]}'" if options["type"]
92
+ filter += " and #{options["where"]}" if options["where"]
93
+
94
+ issue.list filter
86
95
  end
87
96
  end
88
97
 
@@ -108,7 +117,7 @@ Mercenary.program(:beastie) do |p|
108
117
  p.command(:change) do |c|
109
118
  c.syntax "change N f v"
110
119
  c.description "change value of field 'f' to 'v' in issue N"
111
- c.alias "modify"
120
+ c.alias :modify
112
121
 
113
122
  c.action do |args, options|
114
123
  dir = dest_dir options
@@ -155,7 +164,7 @@ Mercenary.program(:beastie) do |p|
155
164
 
156
165
  p.command(:projects) do |c|
157
166
  c.syntax "projects"
158
- c.alias "list_projects"
167
+ c.alias :list_projects
159
168
  c.description "list currently defined projects"
160
169
 
161
170
  c.action do |_,_|
data/lib/beastie/issue.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'date'
2
2
  require 'tempfile'
3
3
  require 'yaml'
4
+ require 'readline'
4
5
 
5
6
  module Beastie
6
7
  class Issue
@@ -47,14 +48,14 @@ module Beastie
47
48
  PROMPT=2
48
49
 
49
50
  ISSUE_FIELDS = {
50
- "title" => ["gets.chomp", "'title'", "Short description of the issue"],
51
+ "title" => ["Readline.readline", "'title'", "Short description of the issue"],
51
52
  "status" => ["", "'open'", ""],
52
53
  "created" => ["", "Date.today", ""],
53
- "component" => ["gets.chomp", "''", "Component affected by the issue"],
54
+ "component" => ["Readline.readline", "''", "Component affected by the issue"],
54
55
  "priority" => ["get_int", "3", "Priority (an integer number, e.g., from 1 to 5)"],
55
56
  "severity" => ["get_int", "3", "Severity (an integer number, e.g., from 1 to 5)"],
56
57
  "points" => ["get_int", "5", "Points (an integer estimating difficulty of fix)"],
57
- "type" => ["gets.chomp", "'bug'", "Type (e.g., story, task, bug, refactoring)"],
58
+ "type" => ["Readline.readline", "'bug'", "Type (e.g., story, task, bug, refactoring)"],
58
59
  "description" => ["get_lines", "''", "Longer description (terminate with '.')"]
59
60
  }
60
61
 
@@ -184,13 +185,18 @@ module Beastie
184
185
 
185
186
  # read n-lines (terminated by a ".")
186
187
  def get_lines
187
- $/ = "\n.\n"
188
- STDIN.gets.chomp("\n.\n")
188
+ lines = []
189
+ line = ""
190
+ until line == "."
191
+ line = Readline.readline
192
+ lines << line
193
+ end
194
+ lines.join("\n")
189
195
  end
190
196
 
191
197
  # read an integer
192
198
  def get_int
193
- gets.chomp.to_i
199
+ Readline.readline.to_i
194
200
  end
195
201
 
196
202
  # generate a unique filename for this issue
@@ -1,3 +1,3 @@
1
1
  module Beastie
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beastie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adolfo Villafiorita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-27 00:00:00.000000000 Z
11
+ date: 2014-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler