tluong_test_gem 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/test_gem +13 -6
- data/lib/test_gem/exception.rb +6 -0
- data/lib/test_gem/version.rb +1 -1
- data/lib/test_gem.rb +17 -0
- metadata +2 -1
data/bin/test_gem
CHANGED
@@ -1,15 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'yaml'
|
3
4
|
require 'test_gem'
|
4
5
|
puts "test_gem script executing"
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
case command
|
7
|
+
case ARGV[0]
|
8
|
+
when "--init"
|
9
|
+
TestGem.init_config
|
10
10
|
when "first"
|
11
|
-
puts TestGem::MyFile.first(
|
11
|
+
puts TestGem::MyFile.first(ARGV[1])
|
12
12
|
when "last"
|
13
|
-
puts TestGem::MyFile.last(
|
13
|
+
puts TestGem::MyFile.last(ARGV[1])
|
14
|
+
else
|
15
|
+
begin
|
16
|
+
config = YAML.load_file('config.yml')
|
17
|
+
TestGem.configure(config)
|
18
|
+
rescue MissingConfigException => e
|
19
|
+
puts "missing config!"
|
20
|
+
end
|
14
21
|
end
|
15
22
|
|
data/lib/test_gem/version.rb
CHANGED
data/lib/test_gem.rb
CHANGED
@@ -3,9 +3,26 @@ $LOAD_PATH.unshift File.expand_path("../test_gem", __FILE__)
|
|
3
3
|
require 'version'
|
4
4
|
require 'hello'
|
5
5
|
require 'myfile'
|
6
|
+
require 'exception'
|
6
7
|
|
7
8
|
module TestGem
|
8
9
|
|
9
10
|
puts "module TestGem defined"
|
10
11
|
|
12
|
+
def self.init_config
|
13
|
+
puts "called init_config"
|
14
|
+
File.open('config.yml', 'w') do |f|
|
15
|
+
f.puts <<-EOF
|
16
|
+
default_file_name: default_file.txt
|
17
|
+
supported_types:
|
18
|
+
- txt
|
19
|
+
- pdf
|
20
|
+
EOF
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.configure hash
|
25
|
+
puts hash.inspect
|
26
|
+
end
|
27
|
+
|
11
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tluong_test_gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -22,6 +22,7 @@ files:
|
|
22
22
|
- lib/test_gem/version.rb
|
23
23
|
- lib/test_gem/hello.rb
|
24
24
|
- lib/test_gem/myfile.rb
|
25
|
+
- lib/test_gem/exception.rb
|
25
26
|
- bin/test_gem
|
26
27
|
homepage: http://rubygems.org/gems/test_gem
|
27
28
|
licenses: []
|