Sha256: 7998074ca7da0283b799d2a9c1267be468d7fc532020a60b7307962908415c56

Contents?: true

Size: 1010 Bytes

Versions: 4

Compression:

Stored size: 1010 Bytes

Contents

require 'highline/import'
require 'ghost/manager/ghost_file'

module Ghost
  module Manager

    class ThemeGenerator

      def initialize
        @ghost_file = Ghost::Manager::GhostFile.new

        unless @ghost_file.exists?
          say "<%= color('Unable to find ghostfile', :red, :bold) %>"
          raise Exception.new "Missing ghostfile"
        end
      end

      def generate theme = nil
        theme_name = theme
        theme_name = ask "What do you want your theme to be called? " if theme_name.nil?
        temp = File.join Dir.pwd, theme_name

        # Install yeoman
        puts ""
        say "<%= color('Installing Yeoman dependencies...', :light_blue, :bold) %>"
        system "npm install -g yo bower grunt-cli gulp"

        # Run generator
        puts ""
        say "<%= color('Running yeoman generator ghost-interface...', :light_blue, :bold) %>"
        system "yo ghost-interface #{theme_name}"

        @ghost_file.set_default_theme theme_name
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ghost-manager-1.0.3 lib/ghost/manager/theme_generator.rb
ghost-manager-1.0.2 lib/ghost/manager/theme_generator.rb
ghost-manager-1.0.1 lib/ghost/manager/theme_generator.rb
ghost-manager-1.0.0 lib/ghost/manager/theme_generator.rb