Skip to content

Commit

Permalink
Re-arrange utility dir
Browse files Browse the repository at this point in the history
  • Loading branch information
atipugin committed Nov 24, 2024
1 parent 09b7631 commit 5d6487a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 4 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion rakelib/parse_schema.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions rakelib/rebuild_types.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 5d6487a

Please sign in to comment.