diff --git a/utility/type_attributes.json b/data/type_attributes.json similarity index 100% rename from utility/type_attributes.json rename to data/type_attributes.json diff --git a/rakelib/parse_schema.rake b/rakelib/parse_schema.rake index 7025a18..9b5324f 100644 --- a/rakelib/parse_schema.rake +++ b/rakelib/parse_schema.rake @@ -50,7 +50,7 @@ task :parse_schema do end # Input File is literally just a string for our purpose - File.write "#{__dir__}/../utility/type_attributes.json", JSON.pretty_generate(result.except('InputFile')) + File.write "#{__dir__}/../data/type_attributes.json", JSON.pretty_generate(result.except('InputFile')) end def required_keys(schema) diff --git a/rakelib/rebuild_types.rake b/rakelib/rebuild_types.rake index 62660df..dcafa03 100644 --- a/rakelib/rebuild_types.rake +++ b/rakelib/rebuild_types.rake @@ -6,7 +6,7 @@ DRY_TYPES = %w[string integer float decimal array hash symbol boolean date date_ desc 'Rebuild types' task :rebuild_types do - types = JSON.parse(File.read("#{__dir__}/../utility/type_attributes.json"), symbolize_names: true) + types = JSON.parse(File.read("#{__dir__}/../data/type_attributes.json"), symbolize_names: true) types.each_pair do |name, attributes| next build_empty_type(name, attributes) if attributes[:type].instance_of?(Array) @@ -35,14 +35,14 @@ task :rebuild_types do end File.write "#{__dir__}/../lib/telegram/bot/types/#{underscore(name)}.rb", - ERB.new(File.read("#{__dir__}/../utility/type.erb")).result(binding).gsub(" \n", '') + ERB.new(File.read("#{__dir__}/templates/type.erb")).result(binding).gsub(" \n", '') end end def build_empty_type(name, attributes) attributes = attributes[:type].join(" |\n ") File.write "#{__dir__}/../lib/telegram/bot/types/#{underscore(name)}.rb", - ERB.new(File.read("#{__dir__}/../utility/empty_type.erb")).result(binding).gsub(" \n", '') + ERB.new(File.read("#{__dir__}/templates/empty_type.erb")).result(binding).gsub(" \n", '') end def apply_default(attributes, attr_name, properties, original_type) diff --git a/utility/empty_type.erb b/rakelib/templates/empty_type.erb similarity index 100% rename from utility/empty_type.erb rename to rakelib/templates/empty_type.erb diff --git a/utility/type.erb b/rakelib/templates/type.erb similarity index 100% rename from utility/type.erb rename to rakelib/templates/type.erb