Class: Motion::Project::GemCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/motion/gem/gem_command.rb

Constant Summary collapse

@@description =
<<-DESCRIPTION
    Creates a skeleton RubyMotion Gem.
DESCRIPTION
@@example =
<<-EXAMPLE
    `motion gem GEM`

    This creates the following directory structure:
  GEM/
  ├── .gitignore
  ├── Gemfile
  ├── LICENSE.md
  ├── README.md
  ├── Rakefile
  ├── lib/
  │   ├── GEM/
  │   │   ├── version.rb
  │   └── GEM.rb
  └── GEM.gemspec
EXAMPLE

Instance Method Summary collapse

Instance Method Details

#run(args) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/motion/gem/gem_command.rb', line 31

def run(args)
  option_parser = OptionParser.new do |opt|
    opt.banner = 'Usage:'
    opt.separator '    motion gem <gem-name>'
    opt.separator ''
    opt.separator 'Options:'
    opt.on('-h', '--help', 'Shows this screen')
    opt.separator ''
    opt.separator 'Description:'
    opt.separator @@description
    opt.separator ''
    opt.separator 'Example:'
    opt.separator @@example
  end

  option_parser.parse!
  if args.count > 1
    puts option_parser
    exit 1
  elsif args.count == 0
    puts option_parser
    exit
  end

  gem_name = args.first
  Motion::Gem::Command::Template.scaffold_gem(gem_name)
end