Class: CaveatPatchKids::App

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/caveat_patch_kids.rb

Instance Method Summary collapse

Instance Method Details

#bloomObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/caveat_patch_kids.rb', line 27

def bloom
  root_dir = Pathname.new(__FILE__).dirname + '..'
  sprockets = Sprockets::Environment.new(root_dir)

  vendor_assets_dir = root_dir + 'vendor/assets'
  scripts_dir = root_dir + 'scripts'
  home_dir = Pathname.new("~/.caveat_patch_kids")
  unsupported_dir = Pathname.new("~/Library/Application Support/Propane/unsupported/").expand_path

  sprockets.append_path vendor_assets_dir.to_s
  sprockets.append_path scripts_dir.to_s
  sprockets.append_path home_dir.expand_path.to_s

  caveat_patchor = sprockets.find_asset('caveatPatchor.js')

  prefix, basename = caveat_patchor.pathname.to_s.split('/')[-2..-1]

  FileUtils.mkdir_p(unsupported_dir.to_s)

  say_status "bloom", "#{unsupported_dir}/#{basename}"
  caveat_patchor.write_to "#{unsupported_dir}/#{basename}"
end

#plantObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/caveat_patch_kids.rb', line 15

def plant 
  create_file  "~/.caveat_patch_kids/caveatPatchor.js", <<END
//= require caveat_patch_kids
//
//= require caveat_patch_kids/display_avatars
//= require caveat_patch_kids/stylize_diffs
//
//= require_self
END
end

#tillObject



51
52
53
54
55
# File 'lib/caveat_patch_kids.rb', line 51

def till
  caveat_patchor = Pathname.new("~/Library/Application Support/Propane/unsupported/caveatPatchor.js").expand_path

  remove_file caveat_patchor.to_s
end