nrodruck_test_gem 0.0.1 → 0.0.2

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.
@@ -4,5 +4,19 @@ require 'test_gem'
4
4
 
5
5
  puts "test_gem script executing"
6
6
  puts ARGV[0]
7
+ puts "Here!"
8
+ if ARGV[0] == "--init"
9
+ TestGem::init_config
10
+ else
11
+ begin
12
+ counter = 1
13
+ file = File.new("program.config", "r")
14
+ while (line = file.gets)
15
+ puts "#{counter}: #{line}"
16
+ counter += 1
17
+ end
18
+ rescue
19
+ raise TestGem::MyFile.MyError
20
+ end
21
+ end
7
22
 
8
- puts TestGem::MyFile.first( ARGV[0] )
@@ -2,12 +2,30 @@ $LOAD_PATH.unshift File.expand_path("../test_gem", __FILE__)
2
2
 
3
3
  require 'version'
4
4
  require 'hello'
5
+ require 'yaml'
5
6
 
6
7
  module TestGem
7
8
 
9
+ @default_file_name
10
+ @supported_types
11
+
8
12
  puts "module TestGem defined"
9
13
 
10
- class MyFile
14
+ def self.init_config
15
+ data = {:default_file_name => "default.txt",
16
+ :supported_types => [:key => 'txt', :key2 => 'pdf']}
17
+
18
+ File.open('program.config', "w") do |f|
19
+ YAML.dump(data, f)
20
+ end
21
+ end
22
+
23
+ class MyFile
24
+
25
+ def initialize
26
+ default_file_name = 'default'
27
+ supported_types = ['txt', 'pdf']
28
+ end
11
29
 
12
30
  def self.first(filename)
13
31
  File.open(filename, "r") {|f| f.readline}
@@ -16,5 +34,9 @@ module TestGem
16
34
  def self.last(filename)
17
35
  File.open(filename, "r")[-1]
18
36
  end
37
+ end
38
+
39
+ class MyError < StandardError
40
+ puts "Standard Error"
19
41
  end
20
42
  end
@@ -2,6 +2,6 @@ module TestGem
2
2
 
3
3
  puts "file version.rb required"
4
4
 
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.2"
6
6
 
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nrodruck_test_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: