Sha256: a7e48e3c0ad7adaba3a4790c0886c8b09b26742ca12718ac8a901bac118e9603

Contents?: true

Size: 861 Bytes

Versions: 2

Compression:

Stored size: 861 Bytes

Contents

module RocketApi
  module Commands
    module Files
      # ...
      # @param [String] dir_name
      def is_exist?(dir_name)
        File.exist?(dir_name)
      end
      # ...
      # @param [String] name
      def class_name_camel(name)
        name.split('_').map(&:capitalize).join
      end
      # ...
      # @param [String] name
      # @param [String] text
      # @param [Hash] options
      # ...
      # @raise [StandardError] error
      def create_single_file(name, text, **options)
        raise "#{RocketApi::FILE_EXIST} #{name}" if is_exist?(name)

        out_file = File.new(name, "w")
        out_file.chmod(001) if options[:exe]
        out_file.puts(text)
        out_file.close

        puts "#{RocketApi::CREATE_SUCCESS} #{name}"
      rescue StandardError => e
        raise e, "#{name} err: #{e.message}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rocket_api-0.0.1.3 lib/rocket_api/commands/files.rb
rocket_api-0.0.1.2 lib/rocket_api/commands/files.rb