Sha256: 8587a33b951869791cff6f8641f7edf3e9d78e71b17c5cd89c9ab9a44b938039
Contents?: true
Size: 1.23 KB
Versions: 26
Compression:
Stored size: 1.23 KB
Contents
require 'base64' module Writefully module Source class << self def content_path Writefully.options[:content] end def models_path File.join(Writefully.options[:app_directory], 'app', 'models') end def sample_content file open(File.dirname(__FILE__) + "/../sample/#{file}").read end def sample_content_paths valid_resources.map do |resource| ["#{resource}/1-change-me/README.md", "#{resource}/1-change-me/meta.yml", "#{resource}/1-change-me/assets/writefully.png"] end.flatten end def sample_content_properties file { path: file, content: sample_content(file), message: "added sample #{file}" } end def valid_resources skim_for(::Regexp.new('Writefully::Post')).map { |r| r.pluralize } end def to_load skim_for ::Regexp.new('Writefully') end def skim_for matcher Dir.chdir(models_path) do Dir.glob('*').select do |file| open(File.join(models_path, file)).read.strip.match(matcher) if File.file?(file) end.collect { |file| file.split('.')[0] } end end end end end
Version data entries
26 entries across 26 versions & 1 rubygems