Class: Hyraft::Rule::AdapterExhaust::DataGatewayCommand
- Inherits:
-
Object
- Object
- Hyraft::Rule::AdapterExhaust::DataGatewayCommand
- Defined in:
- lib/hyraft/rule/adapter_exhaust/data_gateway_command.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(args) ⇒ DataGatewayCommand
constructor
A new instance of DataGatewayCommand.
Constructor Details
#initialize(args) ⇒ DataGatewayCommand
Returns a new instance of DataGatewayCommand.
14 15 16 17 18 |
# File 'lib/hyraft/rule/adapter_exhaust/data_gateway_command.rb', line 14 def initialize(args) @gateway_name = args[0] @table_name = extract_table_name(@gateway_name) @target_dir = args[1] || "." end |
Class Method Details
.start(args) ⇒ Object
10 11 12 |
# File 'lib/hyraft/rule/adapter_exhaust/data_gateway_command.rb', line 10 def self.start(args) new(args).execute end |
Instance Method Details
#execute ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/hyraft/rule/adapter_exhaust/data_gateway_command.rb', line 20 def execute return show_usage unless @gateway_name filename = "sequel_#{@table_name}_gateway.rb" gateway_dir = File.join(@target_dir, "adapter-exhaust/data-gateway") full_path = File.join(gateway_dir, filename) FileUtils.mkdir_p(gateway_dir) File.write(full_path, gateway_template) puts "✓ Created gateway: #{full_path}" puts "Table name: #{@table_name}" puts "Port Adapter: #{port_class_name}" puts "Resource: #{source_class_name}" end |