issue-beaver 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ dir: lib
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  Issue Beaver
2
2
  ============
3
3
 
4
- **This is work in progress**
5
-
6
4
  * **Issue Beaver** scans your project's source code for comments containing *TODO*.
7
5
 
8
6
  * **Issue Beaver** automatically creates new issues on Github for each TODO comment it finds.
@@ -11,7 +9,29 @@ Issue Beaver
11
9
 
12
10
  The goal is to provide simple and lightweight tracking of low-level technical issues (TODOs) and make the project's progress more transparent for people who don't want to read the source code.
13
11
 
14
- ![a beaver](http://kidsfront.com/coloring-pages/sm_color/beaver.jpg)
12
+ Usage
13
+ =====
14
+
15
+ * Install
16
+ ```sh
17
+ gem install issue-beaver
18
+ ```
19
+
20
+ * Search for todos in the ```app``` directory. Only files in the Git repository are accessed, ever.
21
+ ```sh
22
+ issuebeaver find app
23
+ ```
24
+
25
+ * See what todos are new, modified or closed?
26
+ ```sh
27
+ issuebeaver status
28
+ ```
29
+
30
+ * Open new issues, update issues that have been modified, close issues that have been removed.
31
+ ```sh
32
+ issuebeaver commit
33
+ ```
34
+
15
35
 
16
36
  Configuration
17
37
  -------------
@@ -19,20 +39,20 @@ Configuration
19
39
  ### Repository
20
40
  Issue beaver tries to use the Github repository specified in **remote.origin** of your local git repository for storing the issues. If you want to use a different repository (e.g. that of your own fork) you can set the **issuebeaver.repository** config variable:
21
41
 
22
- ```
42
+ ```sh
23
43
  git config issuebeaver.repository eckardt/issue-beaver
24
44
  ```
25
45
 
26
46
  ### Github login
27
47
  If you don't want to be asked for your Github login you can set the **github.user** config variable. Your Github password won't be stored.
28
48
 
29
- ```
49
+ ```sh
30
50
  git config github.user eckardt
31
51
  ```
32
52
 
33
53
  ### Issue labels
34
54
  You can specify a list of labels that should be used for issues created by Issue Beaver. Make sure to create the labels for your repository using Github Issues' *Manage Labels* feature, otherwise Issue Beaver will fail.
35
55
 
36
- ```
56
+ ```sh
37
57
  git config issuebeaver.labels todo,@high
38
58
  ```
@@ -33,7 +33,9 @@ module IssueBeaver
33
33
  github_repo = repo_name
34
34
  else
35
35
  url = @git.config["#{repo_name}.url"]
36
- github_repo = url.match(/git@github\.com:([^\.]+)\.git/)[1] if url
36
+ match = url.match(/git@github\.com:([^\.]+)\.git/) ||
37
+ url.match(/https?:\/\/github\.com\/([^\.]+)\/?/)
38
+ github_repo = match[1] if url
37
39
  end
38
40
  github_repo
39
41
  end
@@ -56,7 +56,7 @@ module IssueBeaver
56
56
  rescue Octokit::UnprocessableEntity => e
57
57
  puts "Failed to save issue (Check if there are invalid assignees or labels)"
58
58
  puts e
59
- return nil
59
+ return Hashie::Mash.new({})
60
60
  end
61
61
  @local_issues << new_attrs
62
62
  new_attrs
@@ -50,7 +50,7 @@ module IssueBeaver
50
50
  @unmatched_issues ||=
51
51
  Enumerator.new do |yielder|
52
52
  @issues.to_a.each do |issue|
53
- next if merged_issues.to_a.map(&:number).include? issue.number
53
+ next if merged_issues.to_a.map{|issue| issue.attributes.number }.compact.include? issue.number
54
54
  issue.mark_for_closing if @repo.is_ahead?(issue.commit)
55
55
  yielder << issue
56
56
  end
@@ -16,7 +16,7 @@ module IssueBeaver
16
16
 
17
17
 
18
18
  def find(*args)
19
- config['dir'] = dir(args[1]) if args[1]
19
+ load_config(args)
20
20
 
21
21
  if todo_comments.all.any?
22
22
  _list_status(todo_comments.all)
@@ -27,7 +27,7 @@ module IssueBeaver
27
27
 
28
28
 
29
29
  def status(*args)
30
- config['dir'] = dir(args[1]) if args[1]
30
+ load_config(args)
31
31
  issues = merger(github_issues.all, todo_comments.all).changed
32
32
  if issues.any?
33
33
  _list_status(issues)
@@ -38,7 +38,7 @@ module IssueBeaver
38
38
 
39
39
 
40
40
  def diff(*args)
41
- config['dir'] = dir(args[1]) if args[1]
41
+ load_config(args)
42
42
  issues = merger(github_issues.all, todo_comments.all).changed
43
43
  if issues.any?
44
44
  _list_diff(issues)
@@ -49,7 +49,7 @@ module IssueBeaver
49
49
 
50
50
 
51
51
  def commit(*args)
52
- config['dir'] = dir(args[1]) if args[1]
52
+ load_config(args)
53
53
  issues = merger(github_issues.all, todo_comments.all).changed
54
54
  issues.each do |issue|
55
55
  issue.save
@@ -129,7 +129,7 @@ module IssueBeaver
129
129
  Models::GithubIssue.use_repository(Models::GithubIssueRepository.new(
130
130
  repo(config).slug,
131
131
  repo(config).github_user,
132
- nil,
132
+ config['github_password'],
133
133
  {:labels => repo(config).labels}))
134
134
  Models::GithubIssue
135
135
  end
@@ -165,6 +165,19 @@ module IssueBeaver
165
165
  end
166
166
 
167
167
 
168
+ def load_config(args)
169
+ options = args[1..-1]
170
+ return unless options
171
+
172
+ if p_option_index = options.find_index('-p')
173
+ config['github_password'] = options[p_option_index + 1]
174
+ 2.times{ options.delete_at(p_option_index) }
175
+ end
176
+
177
+ config['dir'] = dir(options[0]) if options[0]
178
+ end
179
+
180
+
168
181
  def dir(path)
169
182
  File.absolute_path(path)
170
183
  end
@@ -1,3 +1,3 @@
1
1
  module IssueBeaver
2
- VERSION = '0.2.0'
3
- end
2
+ VERSION = '0.2.1'
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: issue-beaver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-08 00:00:00.000000000 Z
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: treetop
@@ -195,6 +195,7 @@ executables:
195
195
  extensions: []
196
196
  extra_rdoc_files: []
197
197
  files:
198
+ - .issuebeaver.yml
198
199
  - .rspec
199
200
  - Gemfile
200
201
  - README.md