Module: Rusky

Defined in:
lib/rusky.rb,
lib/rusky/cli.rb,
lib/rusky/hook.rb,
lib/rusky/task.rb,
lib/rusky/hooks.rb,
lib/rusky/setting.rb,
lib/rusky/version.rb

Defined Under Namespace

Classes: CLI, Hook, Hooks, Setting, Task

Constant Summary collapse

VERSION =
"0.2.5"

Class Method Summary collapse

Class Method Details

.current_work_directory_nameObject



42
43
44
# File 'lib/rusky.rb', line 42

def self.current_work_directory_name
  `lsof -p #{Process.ppid} | grep cwd`.split(" ").last
end

.installObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rusky.rb', line 9

def self.install
  cwd = current_work_directory_name

  unless processable?(cwd)
    puts "rusky > can't find .git directory, so skipping rusky process"
    return
  end

  Rusky::Hooks.new(cwd).create
  Rusky::Setting.new(cwd).create

  puts "rusky > installation is done. enjoy!"
rescue => e
  puts "rusky > unexpected error happened: #{e.inspect}"
end

.processable?(cwd) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/rusky.rb', line 46

def self.processable?(cwd)
  File.exists? File.join(cwd, '.git')
end

.uninstallObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rusky.rb', line 25

def self.uninstall
  cwd = current_work_directory_name

  unless processable?(cwd)
    puts "rusky > can't find .git directory, so skipping rusky process"
    return
  end

  Rusky::Hooks.new(cwd).delete
  Rusky::Setting.new(cwd).delete

  puts "rusky > uninstallation is done. please remove rake tasks for rusky if you have them"
  puts "rusky > Thank you for using rusky!"
rescue => e
  puts "rusky > unexpected error happened: #{e.inspect}"
end