Sha256: 2f7535192a6bbea21a0d2dcf5680a05eba4d2c73abd9780d3f053e059f1fa4e2

Contents?: true

Size: 1.39 KB

Versions: 70

Compression:

Stored size: 1.39 KB

Contents

module Octopress
  module Ink
    module Commands
      class Init
        def self.process_command(p)
          p.command(:init) do |c|
            c.syntax "init <PATH> [options]"
            c.description "Add Octopress Ink scaffolding to an existing gem based plugin."
            c.option "theme", "--theme", "Plugin will be a theme."

            c.action do |args, options|
              if args.empty?
                raise "Please provide a plugin name, e.g. my_awesome_plugin."
              else
                @options = options
                @options['path'] = args[0]
                init_plugin
              end
            end
          end
        end

        def self.init_plugin
          settings = New.gem_settings(@options['path'])
          settings[:type] = @options['theme'] ? 'theme' : 'plugin'

          New.add_asset_dirs(settings)
          New.add_demo_files(settings)

          puts "\nTo finish setting up your Octopress Ink plugin:\n".bold
          puts "1. Add gem requirements to your gemspec:\n\n"
          puts New.dependencies(settings).sub("\n\n", "\n").yellow
          puts "2. Add an Octopress Ink plugin to your gem, making changes as necessary:\n\n"

          template = <<-HERE
require "octopress-ink"

Octopress::Ink.add_plugin({
#{New.indent(New.plugin_config(settings))}
})
          HERE

          puts template.yellow
        end
      end
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
octopress-ink-1.0.0.rc.51 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.50 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.49 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.48 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.47 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.46 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.45 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.44 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.43 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.42 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.41 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.40 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.39 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.38 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.37 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.36 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.35 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.34 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.33 lib/octopress-ink/commands/init.rb
octopress-ink-1.0.0.rc.32 lib/octopress-ink/commands/init.rb