dooie 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f67cf8190c557842a8ded34f60f275782f39328c
4
+ data.tar.gz: 657fe272f9b5bdbeb3380da8623bbf6f564d234e
5
+ SHA512:
6
+ metadata.gz: c9ed3bf2e71af77195e603e604cd3d838dcc1753f64eaa44c3447a7b4fc77ab5d7ca3b098fe85556a3cd0d931c689148b3d78047eca55a0bf0911801308cbb3d
7
+ data.tar.gz: 885666f212d0775eb2de942d2e3632595f912c4afe00d17c5bc4a9840111d18b7f693f7150a24c9687dc4766172d69e34b9f346a790e65998f72f2a7284b6d6f
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dooie.gemspec
4
+ gemspec
5
+
6
+ gem 'pry-nav'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Cameron Kidman
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Dooie
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'dooie'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install dooie
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/dooie ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib')
4
+
5
+ require 'dooie'
6
+
7
+ new_dooie = Dooie::TodoFinder.new
8
+
9
+ new_dooie.run
data/dooie.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dooie/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dooie"
8
+ spec.version = Dooie::VERSION
9
+ spec.authors = ["Joey Ferguson"]
10
+ spec.email = ["fergmastaflex@gmail.com"]
11
+ spec.description = 'Finds task comments in your repo and creates a list'
12
+ spec.summary = 'We all add comments to our code that let us know we need to come back and do something.
13
+ This finds those and puts them in a file for you so you don\'t lose them'
14
+ spec.homepage = ""
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.executables << 'dooie'
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ end
data/lib/dooie.rb ADDED
@@ -0,0 +1,57 @@
1
+ require "dooie/version"
2
+
3
+ module Dooie
4
+ class TodoFinder
5
+
6
+ TODO_PATTERNS = [/#+(\s)*TODO(\:)*/i]
7
+ TODO_FILE_HEADER = "Here are your TODO items \n"
8
+
9
+ def initialize
10
+ @todo_items = find_todo_items
11
+ @todo_file = File.new('todo_items.txt', 'w')
12
+ end
13
+
14
+ def run
15
+ create_todo_file(@todo_items)
16
+ end
17
+
18
+ def create_todo_file(todo_items)
19
+ todo_items.each do |item|
20
+ @todo_file.write(item)
21
+ end
22
+ end
23
+
24
+ def extract_and_format_todos(line)
25
+ clean_line = line.scan(/#.*/).first
26
+ TODO_PATTERNS.each do |pattern|
27
+ clean_line.gsub!(pattern,'').strip!
28
+ end
29
+ clean_line
30
+ end
31
+
32
+ def find_todo_items
33
+ todo_items = []
34
+
35
+ files_with_todos.each do |file|
36
+ text = File.read(file)
37
+ text.each_line do |line|
38
+ next unless TODO_PATTERNS.any?{ |pattern| line =~ pattern }
39
+ todo_items << "[] #{extract_and_format_todos(line)} \n"
40
+ end
41
+ end
42
+
43
+ todo_items
44
+ end
45
+
46
+ def files_with_todos
47
+ files_with_todos = []
48
+
49
+ Dir['**/*.rb'].each do |file|
50
+ text = File.read(file)
51
+ files_with_todos << file if TODO_PATTERNS.any?{ |pattern| text =~ pattern }
52
+ end
53
+
54
+ files_with_todos
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,3 @@
1
+ module Dooie
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ class AnotherFakeFileWithTodos
2
+ def foo
3
+ @bar = "this is just a test" ## TODO: Again, just a test.
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class FakeFileWithTodos
2
+ def foo
3
+ @bar = "this is just a test" ## TODO: Again, just a test.
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class FakeFileWithoutTodos
2
+ def foo
3
+ @bar = "this is just a test"
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe "TodoFinder" do
4
+
5
+ subject { ::Dooie::TodoFinder.new }
6
+
7
+ let(:todo_items) { subject.find_todo_items }
8
+ let(:line) { '@bar = "this is just a test" ## TODO: Again, just a test.' }
9
+ let(:clean_line) { 'Again, just a test.' }
10
+
11
+ describe 'create_todo_file' do
12
+ it 'should create file containing todo items' do
13
+ subject.create_todo_file(todo_items)
14
+ expect(Dir['**/todo_items.txt'].count).to eq(1)
15
+ end
16
+ end
17
+
18
+ describe 'extract_and_format_todos' do
19
+ it 'should cleanse a line and prepare it for the todo file' do
20
+ expect(subject.extract_and_format_todos(line)).to eq(clean_line)
21
+
22
+ end
23
+ end
24
+
25
+ describe 'files_with_todos' do
26
+ it 'should find files that contain TODO comments' do
27
+ expect(subject.find_todo_items.count).to eq(3)
28
+ end
29
+ end
30
+
31
+ describe 'find_todo_items' do
32
+ it 'should return an array of todo items to parse' do
33
+ expect(subject.find_todo_items.count).to eq(3)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,12 @@
1
+ # Notice there is a .rspec file in the root folder. It defines rspec arguments
2
+ require 'rubygems'
3
+ require 'bundler/setup'
4
+
5
+ Bundler.require(:default, :development, :test)
6
+
7
+ RSpec.configure do |config|
8
+ config.run_all_when_everything_filtered = true
9
+ config.after(:suite) do
10
+ FileUtils.rm_rf(Dir["**/todo_items.txt"])
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dooie
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joey Ferguson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Finds task comments in your repo and creates a list
56
+ email:
57
+ - fergmastaflex@gmail.com
58
+ executables:
59
+ - dooie
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/dooie
69
+ - dooie.gemspec
70
+ - lib/dooie.rb
71
+ - lib/dooie/version.rb
72
+ - spec/fixtures/another_fake_file_with_todos.rb
73
+ - spec/fixtures/fake_file_with_todos.rb
74
+ - spec/fixtures/fake_file_without_todos.rb
75
+ - spec/lib/dooie_spec.rb
76
+ - spec/spec_helper.rb
77
+ homepage: ''
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.4.2
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: We all add comments to our code that let us know we need to come back and
101
+ do something. This finds those and puts them in a file for you so you don't lose
102
+ them
103
+ test_files:
104
+ - spec/fixtures/another_fake_file_with_todos.rb
105
+ - spec/fixtures/fake_file_with_todos.rb
106
+ - spec/fixtures/fake_file_without_todos.rb
107
+ - spec/lib/dooie_spec.rb
108
+ - spec/spec_helper.rb