Sha256: 11e6704e50aef5be18e878154655cc389ad44f55d8d94b9c31b5ce260ef1c3b3

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

require "fileutils"
require "thor"

module Codelation
  class Cli < Thor
  private

    # Install dot files and load them into ~/.bash_profile
    def install_dot_files
      # Create the directory ~/.codelation/bash if it doesn't exist
      bash_directory = File.expand_path("~/.codelation/bash")
      FileUtils.rm_rf(bash_directory) if Dir.exist?(bash_directory)
      FileUtils.mkdir_p(bash_directory)

      # Copy dot files to ~/.codelation
      copy_file "dot_files/.codelation.bash",     "~/.codelation/bash/.codelation.bash"
      copy_file "dot_files/.git-completion.bash", "~/.codelation/bash/.git-completion.bash"
      copy_file "dot_files/.git-prompt.sh",       "~/.codelation/bash/.git-prompt.sh"
      copy_file "dot_files/.jshintrc",            "~/.jshintrc"
      copy_file "dot_files/.rubocop.yml",         "~/.rubocop.yml"
      copy_file "dot_files/.scss-lint.yml",       "~/.scss-lint.yml"

      # Add `source ~/.codelation.bash` to ~/.bash_profile if it doesn't exist
      FileUtils.touch(File.expand_path("~/.bash_profile"))
      append_to_file "~/.bash_profile", "source ~/.codelation/bash/.codelation.bash"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
codelation-cli-0.2.0 lib/codelation/development/dot_files.rb
codelation-cli-0.1.1 lib/codelation/development/dot_files.rb
codelation-cli-0.1.0 lib/codelation/development/dot_files.rb
codelation-cli-0.0.28 lib/codelation/development/dot_files.rb
codelation-cli-0.0.27 lib/codelation/development/dot_files.rb
codelation-cli-0.0.26 lib/codelation/development/dot_files.rb
codelation-cli-0.0.25 lib/codelation/development/dot_files.rb
codelation-cli-0.0.24 lib/codelation/development/dot_files.rb