areilly_test_gem 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/test_gem +21 -0
- data/lib/test_gem/hello.rb +7 -0
- data/lib/test_gem/my_file.rb +23 -0
- data/lib/test_gem/test_gem.rb +9 -0
- data/lib/test_gem/version.rb +8 -0
- metadata +51 -0
data/bin/test_gem
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
3
|
+
|
4
|
+
require 'test_gem/hello.rb'
|
5
|
+
require 'test_gem/my_file.rb'
|
6
|
+
require 'test_gem/test_gem'
|
7
|
+
require 'test_gem/version.rb'
|
8
|
+
|
9
|
+
include TestGem
|
10
|
+
puts "\n"
|
11
|
+
puts 'usage: test_gem <filename> [ first | (last) ]' unless ARGV[0]
|
12
|
+
|
13
|
+
file = ARGV[0]
|
14
|
+
|
15
|
+
if ARGV[0] && (ARGV[1] == nil) then puts MyFile.first( file ) end
|
16
|
+
|
17
|
+
puts MyFile.first( file ) if ARGV[1] == 'first'
|
18
|
+
|
19
|
+
puts MyFile.last(file) if ARGV[1] == 'last'
|
20
|
+
|
21
|
+
puts "\n"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
module TestGem
|
4
|
+
|
5
|
+
class MyFile
|
6
|
+
attr_reader :file_path
|
7
|
+
|
8
|
+
def initialize(file_path)
|
9
|
+
@file_path = File.expand_path(file_path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def MyFile.first(path)
|
13
|
+
File.open(path) {|file| file.readline}
|
14
|
+
end
|
15
|
+
|
16
|
+
def MyFile.last(path)
|
17
|
+
File.open(path) {|file| file.readlines[-1]}
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: areilly_test_gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.8
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andy Reilly
|
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: 1vw2go@gmail.com
|
16
|
+
executables:
|
17
|
+
- test_gem
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/test_gem
|
22
|
+
- lib/test_gem/test_gem.rb
|
23
|
+
- lib/test_gem/version.rb
|
24
|
+
- lib/test_gem/hello.rb
|
25
|
+
- lib/test_gem/my_file.rb
|
26
|
+
homepage: http://rubygems.org/gems/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.25
|
47
|
+
signing_key:
|
48
|
+
specification_version: 3
|
49
|
+
summary: Making a Test Gem
|
50
|
+
test_files: []
|
51
|
+
has_rdoc:
|