Class: Rys::Bundler::Commands::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rys/bundler/commands/base.rb

Direct Known Subclasses

Build

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(args) ⇒ Object

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/rys/bundler/commands/base.rb', line 11

def self.run(args)
  raise NotImplementedError
end

Instance Method Details

#command(command) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/rys/bundler/commands/base.rb', line 31

def command(command)
  output, status = Open3.capture2e(command)

  if !status.success?
    ui.error output
    exit 1
  end
end

#get_redmine_plugin!Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/rys/bundler/commands/base.rb', line 40

def get_redmine_plugin!
  plugins_dir = Pathname.pwd.join('plugins')
  plugins = Pathname.glob(plugins_dir.join('*/rys.rb'))

  case plugins.size
  when 0
    raise 'There is no redmine plugin for rys gems. Please run "rails generate rys:redmine:plugin NAME"'
  when 1
    return plugins.first.dirname
  else
    raise 'There are more than one redmine plugin for rys plugins.'
  end
end

#pastelObject



19
20
21
# File 'lib/rys/bundler/commands/base.rb', line 19

def pastel
  @pastel ||= Pastel.new
end

#promptObject



15
16
17
# File 'lib/rys/bundler/commands/base.rb', line 15

def prompt
  @prompt ||= TTY::Prompt.new
end

#runObject

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/rys/bundler/commands/base.rb', line 27

def run
  raise NotImplementedError
end

#uiObject



23
24
25
# File 'lib/rys/bundler/commands/base.rb', line 23

def ui
  ::Bundler.ui
end