Sha256: 736c17de276fcdcb21f7e6f3fa76ac4e5eceb0d6f18bd23f0fcaebcb56b037c4
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
require 'yaml' require 'rainbow' require 'screencap' require 'mini_magick' MiniMagick.processor = :gm if ENV['gm'] # # Yet Another Media Generator # module YAMG autoload :CLI, 'yamg/cli' autoload :Icon, 'yamg/icon' autoload :Splash, 'yamg/splash' autoload :Screenshot, 'yamg/screenshot' # Load template works TEMPLATES = YAML.load_file( File.join(File.dirname(__FILE__), 'yamg', 'templates.yaml') ) # def initialize(conf = './.yamg.yml') # load_config(conf) # end class << self attr_accessor :config def init file = './.yamg.yml' if File.exist?(file) puts "File exists: '#{file}'" exit 1 end puts Rainbow('Creating your configuration').black src = File.join(File.dirname(__FILE__), 'yamg', 'yamg.yml') FileUtils.cp(src, file) end def load_config(conf = './.yamg.yml') self.config = YAML.load_file(conf).freeze rescue Errno::ENOENT puts Rainbow('Create config! Run: `yamg init`').red exit 1 end def load_images(dir) return [dir] unless File.extname(dir).empty? Dir["#{dir}/*.png"].map { |f| File.basename(f) } end # # Writes image to disk # def write_out(img, path) img.format File.extname(path) FileUtils.mkdir_p File.dirname(path) img.write(path) rescue Errno::ENOENT puts puts Rainbow("Path not found '#{path}'").red exit 1 end end end # }, # "customImages": [ # { # "width": 120, # "height": 120, # "path": "../Media/custom", # "filename": "outputFilename.png", # "source": { # "filename": "image.png", # "background": "fff6d5" # } # } # ], # "screenshots": [ # { # "url": "http://notabe.com", # "name": "homepage" # } # ] # }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
yamg-0.0.9 | lib/yamg.rb |
yamg-0.0.8 | lib/yamg.rb |
yamg-0.0.7 | lib/yamg.rb |