chrislee_test_gem 0.0.3
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.
- data/bin/test_gem +16 -0
- data/lib/test_gem/hello.rb +6 -0
- data/lib/test_gem/myfile.rb +18 -0
- data/lib/test_gem/version.rb +6 -0
- data/lib/test_gem.rb +10 -0
- metadata +51 -0
data/bin/test_gem
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test_gem'
|
3
|
+
|
4
|
+
case ARGV[0]
|
5
|
+
when "first"
|
6
|
+
first_line = TestGem::MyFile.new ARGV[1]
|
7
|
+
puts first_line.first(ARGV[1])
|
8
|
+
when "last"
|
9
|
+
last_line = TestGem::MyFile.new ARGV[1]
|
10
|
+
puts last_line.last(ARGV[1])
|
11
|
+
else
|
12
|
+
puts "test_gem can return the first or last line of a text file"
|
13
|
+
puts "Usage:"
|
14
|
+
puts "test_gem first <file location>"
|
15
|
+
puts "test_gem last <file location>"
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module TestGem
|
2
|
+
|
3
|
+
class MyFile
|
4
|
+
def initialize file_location
|
5
|
+
@file_location = file_location
|
6
|
+
end
|
7
|
+
|
8
|
+
def first file_location=@file_location
|
9
|
+
File.open(file_location, "r"){|f| f.readlines[0].chomp}
|
10
|
+
end
|
11
|
+
|
12
|
+
def last file_location=@file_location
|
13
|
+
File.open(file_location,"r"){|f| f.readlines.last.chomp}
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/lib/test_gem.rb
ADDED
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chrislee_test_gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Chris Lee
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-07 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A gem to explain how to make gems
|
15
|
+
email: finges@gmail.com
|
16
|
+
executables:
|
17
|
+
- test_gem
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/test_gem.rb
|
22
|
+
- lib/test_gem/version.rb
|
23
|
+
- lib/test_gem/hello.rb
|
24
|
+
- lib/test_gem/myfile.rb
|
25
|
+
- bin/test_gem
|
26
|
+
homepage: http://rubygems.org/gems/chrislee_test_gem
|
27
|
+
licenses: []
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubyforge_project:
|
46
|
+
rubygems_version: 1.8.24
|
47
|
+
signing_key:
|
48
|
+
specification_version: 3
|
49
|
+
summary: Making a Test Gem
|
50
|
+
test_files: []
|
51
|
+
has_rdoc:
|