Class: DatabaseSchemaOwnership::Runner
- Inherits:
-
Object
- Object
- DatabaseSchemaOwnership::Runner
- Defined in:
- lib/database_schema_ownership/runner.rb
Overview
:nodoc
Constant Summary collapse
- RUBY_SCHEMA_PATH =
"db/schema.rb"- SQL_SCHEMA_PATH =
"db/structure.sql"- OWNERSHIP_PATH =
"db/database_schema_ownership"
Instance Attribute Summary collapse
-
#folder_path ⇒ Object
readonly
Returns the value of attribute folder_path.
-
#schema_extension ⇒ Object
readonly
Returns the value of attribute schema_extension.
-
#schema_path ⇒ Object
readonly
Returns the value of attribute schema_path.
Instance Method Summary collapse
-
#initialize(schema_path = nil, folder_path = OWNERSHIP_PATH) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(schema_path = nil, folder_path = OWNERSHIP_PATH) ⇒ Runner
Returns a new instance of Runner.
12 13 14 15 16 |
# File 'lib/database_schema_ownership/runner.rb', line 12 def initialize(schema_path = nil, folder_path = OWNERSHIP_PATH) @schema_path = schema_path || find_schema_path @folder_path = folder_path @schema_extension = File.extname(@schema_path) end |
Instance Attribute Details
#folder_path ⇒ Object (readonly)
Returns the value of attribute folder_path.
10 11 12 |
# File 'lib/database_schema_ownership/runner.rb', line 10 def folder_path @folder_path end |
#schema_extension ⇒ Object (readonly)
Returns the value of attribute schema_extension.
10 11 12 |
# File 'lib/database_schema_ownership/runner.rb', line 10 def schema_extension @schema_extension end |
#schema_path ⇒ Object (readonly)
Returns the value of attribute schema_path.
10 11 12 |
# File 'lib/database_schema_ownership/runner.rb', line 10 def schema_path @schema_path end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/database_schema_ownership/runner.rb', line 18 def run entities = parser.parse FileUtils.mkdir_p(folder_path) if entities.any? grouped = group_entities(entities) grouped.each do |name, | File.write(file_name(name), ) end end |