Sha256: eeed0dc0680b6276490709f52541ba22a76aa68207fcbf792e834ce7994824d3

Contents?: true

Size: 1000 Bytes

Versions: 1

Compression:

Stored size: 1000 Bytes

Contents

require 'pathname'
require 'thor'

require_relative 'nsume/cli'
require_relative 'nsume/prepare'
require_relative 'nsume/version'
require_relative 'nsume/dev_helper'

module Nsume
  class << self
    def root
      @root ||= Pathname.new(File.expand_path('../', File.dirname(__FILE__)))
    end

    # TODO: move config
    def source_path
      path = Dir.pwd
      path = File.join(path, 'tmp') if File.exists?(File.join(path, 'nsume.gemspec'))
      path
    end

    def generators_path
      Nsume.root.join('lib', 'generators').to_s
    end

    def templates_path
      Nsume.root.join('lib', 'templates').to_s
    end

    def config_template
      File.read(File.expand_path('_config.yml.erb', Nsume.templates_path))
    end

    def posts_path
      path = File.expand_path('_posts', Nsume.source_path)
      FileUtils.mkdir_p(path) unless File.exists?(path)
      path
    end

    def post_template
      File.read(File.expand_path('post.md.erb', Nsume.templates_path))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nsume-0.0.4 lib/nsume.rb