Class: Scaffoldhub::Runner

Inherits:
Thor
  • Object
show all
Defined in:
lib/scaffoldhub/runner.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



20
21
22
# File 'lib/scaffoldhub/runner.rb', line 20

def method_missing(sym, *args, &block)
  system("rails generate scaffoldhub #{args.join(' ')} --scaffold #{sym.to_s}")
end

Instance Method Details

#push(scaffold_spec) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/scaffoldhub/runner.rb', line 9

def push(scaffold_spec)
  if load_spec(scaffold_spec)
    if Specification.valid?
      post_spec(scaffold_spec)
    else
      say "Unable to post your new scaffold. Please resolve these errors:"
      Specification.errors.each { |error| say error }
    end
  end
end