-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
58 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
source :rubygems; gemspec | ||
group :development do | ||
gem 'working', path: '.' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'working/guard' | ||
# vim ft=ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
require 'bundler/gem_tasks' | ||
require 'working/rake_tasks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,27 @@ | ||
require "working/version" | ||
require 'working/version' | ||
|
||
module Working | ||
# Your code goes here... | ||
README_PATH = 'README.rdoc' | ||
|
||
class << self | ||
def file_snippet path, start_pattern, end_pattern | ||
desired = [] | ||
File.readlines(path).each do |e| | ||
return desired.join if e[end_pattern] | ||
in_desired_region = true if e[start_pattern] | ||
desired << e if in_desired_region | ||
end | ||
desired | ||
end | ||
def readme_snippet start_pattern, end_pattern | ||
file_snippet README_PATH, start_pattern, end_pattern | ||
end | ||
|
||
def file_third_line path | ||
File.readlines(path)[2] | ||
end | ||
def third_line_of_readme | ||
file_third_line README_PATH | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require 'bundler/gem_tasks' | ||
task default: :test | ||
task :test do | ||
Dir['test/**/*_test.rb'].each{|e| load e} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Working | ||
VERSION = '0.0.7' | ||
VERSION = '0.0.8' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'working/test_helper' | ||
# Spork.prefork doesn't like when this is missing | ||
Spork.each_run do | ||
require 'working' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require './test/test_helper.rb' | ||
class WorkingTest < MiniTest::Unit::TestCase | ||
def test_file_snippet | ||
actual = Working.file_snippet(__FILE__, /^require/, /^class/) | ||
assert_equal "require './test/test_helper.rb'\n", actual | ||
end | ||
|
||
# This is because I put the gem.summary on the 3rd line of the README.rdoc | ||
def test_third_line | ||
assert_equal " def test_file_snippet\n", Working.file_third_line(__FILE__) | ||
end | ||
end |