Class: Crafti::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/crafti.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_path, &block) ⇒ Git



141
142
143
144
# File 'lib/crafti.rb', line 141

def initialize(app_path, &block)
  @app_path = app_path
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#app_pathObject (readonly)

Returns the value of attribute app_path.



139
140
141
# File 'lib/crafti.rb', line 139

def app_path
  @app_path
end

Instance Method Details

#add(*args) ⇒ Object



150
151
152
153
154
155
156
157
158
# File 'lib/crafti.rb', line 150

def add(*args)
  cmd = case args.first
  when :all then "."
  else
    files = args.join(' ')
  end

  git "add #{cmd}"
end

#commit(message) ⇒ Object



160
161
162
# File 'lib/crafti.rb', line 160

def commit(message)
  git "commit -am '#{message}'"
end

#git(command) ⇒ Object



164
165
166
# File 'lib/crafti.rb', line 164

def git(command)
  results = system "cd #{app_path} && git #{command}"
end

#initObject



146
147
148
# File 'lib/crafti.rb', line 146

def init
  git "init ."
end