From 2694ecdae1874579a4b9908fc3ca14bf48559a25 Mon Sep 17 00:00:00 2001
From: Philippe PITTOLI
Date: Tue, 13 Aug 2019 18:03:34 +0200
Subject: [PATCH] renaming: Specs => SpecFileParser
---
debug.cr | 16 ++++++++--------
shard.yml | 6 +++---
src/{spec.cr => specfileparser.cr} | 12 ++++++------
3 files changed, 17 insertions(+), 17 deletions(-)
rename src/{spec.cr => specfileparser.cr} (96%)
diff --git a/debug.cr b/debug.cr
index adce6a7..826c759 100644
--- a/debug.cr
+++ b/debug.cr
@@ -1,5 +1,5 @@
require "option_parser"
-require "./src/spec"
+require "./src/specfileparser"
recipe_file_name = "some-non-existant-file"
@@ -18,7 +18,7 @@ end
options = Hash(String,String).new
options["someoptionexample"] = "option"
-specs = Specs.parse recipe_file_name, options
+specs = SpecFileParser.parse recipe_file_name, options
pp! specs
@@ -27,30 +27,30 @@ pp! specs
# low level stuff
-sectioncontainer = Specs::Section.new "val"
+sectioncontainer = SpecFileParser::Section.new "val"
begin
puts sectioncontainer.as_s
- puts "(NOT OK) Specs::Section should not accept .as_s"
+ puts "(NOT OK) SpecFileParser::Section should not accept .as_s"
rescue e
puts "(OK) #{e}"
end
begin
pp! sectioncontainer.as_a_or_s
- puts "(NOT OK) Specs::Section should not accept .as_a_or_s"
+ puts "(NOT OK) SpecFileParser::Section should not accept .as_a_or_s"
rescue e
puts "(OK) #{e}"
end
-arraycontainer = Specs::ArrayContainer.new Array(String).new.push "value"
+arraycontainer = SpecFileParser::ArrayContainer.new Array(String).new.push "value"
begin
puts arraycontainer.as_s
- puts "(NOT OK) Specs::ArrayContainer should not accept .as_s"
+ puts "(NOT OK) SpecFileParser::ArrayContainer should not accept .as_s"
rescue e
puts "(OK) #{e}"
end
begin
pp! arraycontainer.as_a_or_s
- puts "(OK) Specs::ArrayContainer should accept .as_a_or_s"
+ puts "(OK) SpecFileParser::ArrayContainer should accept .as_a_or_s"
rescue e
puts "(NOT OK) #{e}"
end
diff --git a/shard.yml b/shard.yml
index 0281e26..e146acc 100644
--- a/shard.yml
+++ b/shard.yml
@@ -1,11 +1,11 @@
-name: spec
-version: 0.4.1
+name: specfileparser
+version: 0.4.2
authors:
- Philippe Pittoli
description: |
- `Spec` is a parsing library for the `Spec` format.
+ `SpecFileParser` is a parsing library for the `Spec` format.
license: ISC
diff --git a/src/spec.cr b/src/specfileparser.cr
similarity index 96%
rename from src/spec.cr
rename to src/specfileparser.cr
index 1f4c718..c6cffda 100644
--- a/src/spec.cr
+++ b/src/specfileparser.cr
@@ -1,5 +1,5 @@
-class Specs
+class SpecFileParser
macro incompatible_methods(*names)
{% for name in names %}
@@ -40,7 +40,7 @@ class Specs
end
class LongStringContainer
- Specs.incompatible_methods as_s, as_a_or_s
+ SpecFileParser.incompatible_methods as_s, as_a_or_s
property value : String
def as_s_or_ls : String
@@ -52,7 +52,7 @@ class Specs
end
class ArrayContainer
- Specs.incompatible_methods as_s, as_s_or_ls
+ SpecFileParser.incompatible_methods as_s, as_s_or_ls
property value : Array(String)
def as_a_or_s : Array(String)
@@ -64,7 +64,7 @@ class Specs
end
class Section
- Specs.incompatible_methods as_s, as_a_or_s, as_s_or_ls
+ SpecFileParser.incompatible_methods as_s, as_a_or_s, as_s_or_ls
property name : String
property options : Array(String)
property content : Hash(String, StringContainer | ArrayContainer | LongStringContainer)
@@ -367,12 +367,12 @@ class Specs
# The only function to use from outside.
- def self.parse(file_name : String, options : Hash(String, String) | Nil = nil) : Specs | Nil
+ def self.parse(file_name : String, options : Hash(String, String) | Nil = nil) : SpecFileParser | Nil
begin
content = File.read(file_name)
content = content.rchop
- specs = Specs.new
+ specs = SpecFileParser.new
unless options.nil?
options.each do |opt, val|
specs.assignments[opt] = StringContainer.new val