Class: Devkitkat::Service::PredefinedCommand::AddExample
- Defined in:
- lib/devkitkat/service/predefined_command/add_example.rb
Instance Attribute Summary
Attributes included from Concerns::ServiceInitializer
Instance Method Summary collapse
Methods included from Concerns::ServiceInitializer
Instance Method Details
#available? ⇒ Boolean
26 27 28 |
# File 'lib/devkitkat/service/predefined_command/add_example.rb', line 26 def available? true end |
#machine_driver ⇒ Object
30 31 32 |
# File 'lib/devkitkat/service/predefined_command/add_example.rb', line 30 def machine_driver 'none' end |
#to_script ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/devkitkat/service/predefined_command/add_example.rb', line 7 def to_script names = command.args raise ArgumentError, 'Please specify at least one example name' if names.empty? FileUtils.mkdir_p(service.example_dir) names.map do |name| file_path = File.join(service.example_dir, name) <<-EOS if [[ ! -f "#{file_path}" ]]; then touch #{file_path} chmod 755 #{file_path} fi EOS end.join("\n") end |