kiip 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/Guardfile +43 -0
- data/LICENSE.txt +21 -0
- data/README.md +50 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/kiip +7 -0
- data/kiip.gemspec +32 -0
- data/lib/kiip.rb +21 -0
- data/lib/kiip/cli.rb +34 -0
- data/lib/kiip/errors.rb +9 -0
- data/lib/kiip/repository.rb +90 -0
- data/lib/kiip/repository/package.rb +76 -0
- data/lib/kiip/tasks/symlink_task.rb +69 -0
- data/lib/kiip/version.rb +3 -0
- metadata +220 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f4ab9e25cf98311ac78915be7ce6aba963bdb64a
|
4
|
+
data.tar.gz: a536f1b403b2f5e4e7f8264c8f5ebcb8868275f0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 96b847ef907d0eb154d6ffba1b219626c60357f83af004a5b2deaeae0bdc7e84f2b11bfee96b766cb9965811074f596fda86cdcc2795b62884e0aa8590d5efb6
|
7
|
+
data.tar.gz: 96f01e0048f93dbc855e2dcdf8b61cb688aaca0c901cf9d6860ddfa3990f772c57ca330fc855f5e7f5c74461d205b0535d0f3d45a4b76b593f286fd611d4208c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.2
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
28
|
+
require "guard/rspec/dsl"
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
32
|
+
|
33
|
+
# RSpec files
|
34
|
+
rspec = dsl.rspec
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
37
|
+
watch(%r{spec/unit/.+_spec.rb})
|
38
|
+
watch(%r{lib/(.+).rb}) { |m| "spec/unit/#{m[1]}_spec.rb" }
|
39
|
+
|
40
|
+
# Ruby files
|
41
|
+
ruby = dsl.ruby
|
42
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
43
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Robin Wenglewski
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Kiip
|
2
|
+
|
3
|
+
[![Travis Status](https://travis-ci.org/rweng/kiip.svg)](https://travis-ci.org/rweng/kiip)
|
4
|
+
[![codecov.io](http://codecov.io/github/rweng/kiip/coverage.svg?branch=master)](http://codecov.io/github/rweng/kiip?branch=master)
|
5
|
+
|
6
|
+
Kiip, just another dotfiles tool to move your actual files and folders to a repository (which can be synced by another tool) and replace them with symlinks.
|
7
|
+
|
8
|
+
## Terminology
|
9
|
+
|
10
|
+
- `Repository`: the place where your packages are stored, e.g. `~/Dropbox/kiip`
|
11
|
+
- `Package`: The file or folder in `PATH_TO_CASTLE/home/PACKAGE_NAME`
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
$ gem install kiip
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Commands:
|
20
|
+
kiip help [COMMAND] # Describe available commands or one specific command
|
21
|
+
kiip list # lists all packages
|
22
|
+
kiip rm NAME # removes package with name NAME, see: kiip help rm
|
23
|
+
kiip sync PACKAGE_NAME # recreates the source of the package (via symlink, copy, etc)
|
24
|
+
kiip track PACKAGE_NAME PATH # tracks the file or folder under PATH with the package name NAME....
|
25
|
+
|
26
|
+
Options:
|
27
|
+
[--dry], [--no-dry]
|
28
|
+
|
29
|
+
Examples:
|
30
|
+
kiip track ssh ~/.ssh
|
31
|
+
kiip list
|
32
|
+
ssh:
|
33
|
+
~/.ssh
|
34
|
+
|
35
|
+
|
36
|
+
## Development
|
37
|
+
|
38
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
39
|
+
|
40
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rweng/kiip. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
45
|
+
|
46
|
+
|
47
|
+
## License
|
48
|
+
|
49
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
50
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kiip"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/kiip
ADDED
data/kiip.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'kiip/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kiip"
|
8
|
+
spec.version = Kiip::VERSION
|
9
|
+
spec.authors = ["Robin Wenglewski"]
|
10
|
+
spec.email = ["robin@wenglewski.de"]
|
11
|
+
|
12
|
+
spec.summary = %q{just another dotfiles tool}
|
13
|
+
spec.homepage = "https://github.com/rweng/kiip"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "pry"
|
24
|
+
spec.add_development_dependency "pry-stack_explorer"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "codecov"
|
27
|
+
spec.add_development_dependency "guard-rspec"
|
28
|
+
spec.add_dependency "thor", " ~> 0.19.1"
|
29
|
+
spec.add_dependency "hashie", " ~> 3.4.3"
|
30
|
+
spec.add_dependency "highline", " ~> 1.7.8"
|
31
|
+
spec.add_dependency "activesupport", " ~> 4.2.1"
|
32
|
+
end
|
data/lib/kiip.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'hashie'
|
3
|
+
require 'highline'
|
4
|
+
require 'active_support/core_ext/hash/keys'
|
5
|
+
|
6
|
+
require 'kiip/version'
|
7
|
+
|
8
|
+
module Kiip
|
9
|
+
autoload :Cli, 'kiip/cli'
|
10
|
+
autoload :Syncer, 'kiip/syncer'
|
11
|
+
autoload :Repository, 'kiip/repository'
|
12
|
+
autoload :Errors, 'kiip/errors'
|
13
|
+
|
14
|
+
module Tasks
|
15
|
+
autoload :SymlinkTask, 'kiip/tasks/symlink_task'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.root
|
19
|
+
File.expand_path(File.join(__dir__, '..'))
|
20
|
+
end
|
21
|
+
end
|
data/lib/kiip/cli.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Kiip
|
2
|
+
class Cli < Thor
|
3
|
+
class_option :dry, :type => :boolean, default: false
|
4
|
+
class_option :verbose, :type => :boolean, default: false
|
5
|
+
|
6
|
+
desc 'track PACKAGE_NAME PATH', 'tracks the file or folder under PATH with the package name NAME. wrap PATH in quotes to ensure ~ and env variables are kept.'
|
7
|
+
def track package_name, file_or_folder
|
8
|
+
repository.track(package_name, file_or_folder)
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'sync PACKAGE_NAME', 'recreates the source of the package (via symlink, copy, etc)'
|
12
|
+
def sync package_name
|
13
|
+
repository.sync!(package_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'list', 'lists all packages'
|
17
|
+
def list
|
18
|
+
puts repository.print_content
|
19
|
+
end
|
20
|
+
|
21
|
+
option :remove_source, default: false, type: :boolean, desc: 'if the source should be removed, defaults to false'
|
22
|
+
option :remove_target, default: false, type: :boolean, desc: 'if the source should be removed, defaults to false'
|
23
|
+
option :replace_source, default: false, type: :boolean, desc: 'if the source should be replaced with the target, defaults to false'
|
24
|
+
desc 'rm NAME', 'removes package with name NAME, see: kiip help rm'
|
25
|
+
def rm package_name
|
26
|
+
repository.rm package_name
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
def repository
|
31
|
+
Kiip::Repository.get_instance(is_dry: options[:dry], is_verbose: options[:verbose])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/kiip/errors.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
3
|
+
module Kiip
|
4
|
+
class Repository < Hashie::Dash
|
5
|
+
autoload :Package, 'kiip/repository/package'
|
6
|
+
ID_FILE_NAME = '.kiip_repository'
|
7
|
+
|
8
|
+
def self.get_instance(**options)
|
9
|
+
path = ENV['KIIP_REPO'] || raise('KIIP_REPO environment variable not defined')
|
10
|
+
|
11
|
+
options[:path] = path
|
12
|
+
|
13
|
+
return self.new(**options)
|
14
|
+
end
|
15
|
+
|
16
|
+
include Hashie::Extensions::Dash::PropertyTranslation
|
17
|
+
property :path, required: true, coerce: String
|
18
|
+
property :is_dry, default: false
|
19
|
+
property :is_verbose, default: false
|
20
|
+
|
21
|
+
def exists?
|
22
|
+
id_file_path = File.join(path, ID_FILE_NAME)
|
23
|
+
File.exists? id_file_path
|
24
|
+
end
|
25
|
+
|
26
|
+
def sync! *names
|
27
|
+
names = package_names if names.empty?
|
28
|
+
names.each { |name| get_package(name).sync! }
|
29
|
+
end
|
30
|
+
|
31
|
+
def track package_name, path
|
32
|
+
return unless ensure_existance
|
33
|
+
package = get_package(package_name)
|
34
|
+
package.create! unless package.exists?
|
35
|
+
package.track(path)
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [String] multi-line string with content of the repository
|
39
|
+
def print_content
|
40
|
+
StringIO.open do |result|
|
41
|
+
packages.each do |package|
|
42
|
+
result.puts package.name + ':'
|
43
|
+
package.decoded_content.each { |content| result.puts ' ' + content }
|
44
|
+
end
|
45
|
+
|
46
|
+
result.string
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def packages
|
51
|
+
package_names.map do |package_name|
|
52
|
+
get_package(package_name)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def create!
|
57
|
+
FileUtils.mkdir_p(path)
|
58
|
+
FileUtils.touch(File.join(path, ID_FILE_NAME))
|
59
|
+
end
|
60
|
+
|
61
|
+
def rm *package_names
|
62
|
+
package_names.each do |package_name|
|
63
|
+
get_package(package_name).rm
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
# asks user to create repository if it doesn't exist
|
69
|
+
#
|
70
|
+
# @return [boolean] true if repo exists now
|
71
|
+
def ensure_existance
|
72
|
+
return true if exists?
|
73
|
+
|
74
|
+
if HighLine.new.agree("Repository #{path} does not exist. Want me to create it? (yes/no)")
|
75
|
+
create!
|
76
|
+
end
|
77
|
+
|
78
|
+
exists?
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_package(package_name)
|
82
|
+
Package.new(name: package_name, repository: self)
|
83
|
+
end
|
84
|
+
|
85
|
+
# @return [String[]]
|
86
|
+
def package_names
|
87
|
+
Pathname.new(path).children.select(&:directory?).map(&:basename).map(&:to_s)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require "base64"
|
2
|
+
|
3
|
+
module Kiip
|
4
|
+
class Repository
|
5
|
+
class Package < Hashie::Dash
|
6
|
+
class << self
|
7
|
+
def encode path
|
8
|
+
Base64.encode64 path
|
9
|
+
end
|
10
|
+
|
11
|
+
def decode path
|
12
|
+
Base64.decode64 path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
include Hashie::Extensions::Dash::Coercion
|
17
|
+
property :name, required: true, coerce: String
|
18
|
+
property :repository, required: true
|
19
|
+
|
20
|
+
|
21
|
+
def track(tracking_path)
|
22
|
+
raise "path does not exist: #{tracking_path}" unless File.exists?(File.expand_path tracking_path)
|
23
|
+
|
24
|
+
tracking_path = tracking_path.gsub %r{^#{File.expand_path('~')}}, '~'
|
25
|
+
|
26
|
+
# escape /
|
27
|
+
escaped_tracking_path = self.class.encode tracking_path
|
28
|
+
|
29
|
+
return if repository.is_dry
|
30
|
+
|
31
|
+
task = Tasks::SymlinkTask.new(name: 'task-name', source: tracking_path, target: File.join(path, escaped_tracking_path))
|
32
|
+
task.exec!
|
33
|
+
end
|
34
|
+
|
35
|
+
def sync!
|
36
|
+
content.each do |subpath|
|
37
|
+
source = self.class.decode subpath
|
38
|
+
task = Tasks::SymlinkTask.new(name: 'task-name', source: source, target: File.join(path, subpath))
|
39
|
+
task.exec!
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def decoded_content
|
44
|
+
content.map { |s| self.class.decode s }
|
45
|
+
end
|
46
|
+
|
47
|
+
# creates the package or raises an error
|
48
|
+
def create!
|
49
|
+
Dir.mkdir(path)
|
50
|
+
end
|
51
|
+
|
52
|
+
def rm
|
53
|
+
content.each do |subpath|
|
54
|
+
source = self.class.decode subpath
|
55
|
+
task = Tasks::SymlinkTask.new(name: 'task-name', source: source, target: File.join(path, subpath))
|
56
|
+
task.restore
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [boolean]
|
61
|
+
def exists?
|
62
|
+
File.directory?(path)
|
63
|
+
end
|
64
|
+
|
65
|
+
def path
|
66
|
+
File.join(repository.path, name)
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
# @return [String[]] array of package content files/folders
|
71
|
+
def content
|
72
|
+
Pathname.new(path).children.map(&:basename).map(&:to_s)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Kiip::Tasks
|
2
|
+
|
3
|
+
# basic task, just does symlinks. More might follow
|
4
|
+
class SymlinkTask < Hashie::Dash
|
5
|
+
include Hashie::Extensions::Dash::PropertyTranslation
|
6
|
+
|
7
|
+
# task name for defining which ones to run
|
8
|
+
property :name, required: true, coerce: String
|
9
|
+
|
10
|
+
# the original, removes ending /
|
11
|
+
# we must call expand_path to ensure FileUtils.ln_s, File.exists? etc work correctly
|
12
|
+
property :source, required: true, transform_with: ->(val) { File.expand_path val.to_s.gsub(/\/$/, '') }
|
13
|
+
|
14
|
+
# the place in the castle
|
15
|
+
property :target, required: true, transform_with: ->(val) { File.expand_path val.to_s }
|
16
|
+
|
17
|
+
property :is_verbose, default: false
|
18
|
+
|
19
|
+
property :is_dry, default: false
|
20
|
+
|
21
|
+
# actually execute the task
|
22
|
+
def exec!
|
23
|
+
return initialize! unless File.exists? target
|
24
|
+
|
25
|
+
return create_symlink_from_source_to_target unless File.exists? source
|
26
|
+
|
27
|
+
return if File.symlink? source and File.readlink(source) == target
|
28
|
+
|
29
|
+
if cli.agree "#{source} already exists. Replace with symlink?"
|
30
|
+
remove_source
|
31
|
+
create_symlink_from_source_to_target
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def restore
|
36
|
+
remove_source
|
37
|
+
copy_target_to_source
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def cli
|
42
|
+
HighLine.new
|
43
|
+
end
|
44
|
+
|
45
|
+
def initialize!
|
46
|
+
raise "source must exist to initalize: #{source}" unless File.exists? source
|
47
|
+
raise "source must not be a symlink: #{source}" if File.symlink? source
|
48
|
+
|
49
|
+
move_source_to_target
|
50
|
+
create_symlink_from_source_to_target
|
51
|
+
end
|
52
|
+
|
53
|
+
def copy_target_to_source
|
54
|
+
FileUtils.cp_r(target, source, verbose: is_verbose, noop: is_dry)
|
55
|
+
end
|
56
|
+
|
57
|
+
def remove_source
|
58
|
+
FileUtils.rm_f(source, verbose: is_verbose, noop: is_dry)
|
59
|
+
end
|
60
|
+
|
61
|
+
def move_source_to_target
|
62
|
+
FileUtils.mv(source, target, verbose: is_verbose, noop: is_dry)
|
63
|
+
end
|
64
|
+
|
65
|
+
def create_symlink_from_source_to_target
|
66
|
+
FileUtils.ln_s(target, source, verbose: is_verbose, noop: is_dry)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/kiip/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,220 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kiip
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robin Wenglewski
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-stack_explorer
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: codecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: thor
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.19.1
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.19.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: hashie
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 3.4.3
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 3.4.3
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: highline
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.7.8
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.7.8
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: activesupport
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 4.2.1
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 4.2.1
|
167
|
+
description:
|
168
|
+
email:
|
169
|
+
- robin@wenglewski.de
|
170
|
+
executables:
|
171
|
+
- kiip
|
172
|
+
extensions: []
|
173
|
+
extra_rdoc_files: []
|
174
|
+
files:
|
175
|
+
- ".gitignore"
|
176
|
+
- ".rspec"
|
177
|
+
- ".ruby-version"
|
178
|
+
- ".travis.yml"
|
179
|
+
- CODE_OF_CONDUCT.md
|
180
|
+
- Gemfile
|
181
|
+
- Guardfile
|
182
|
+
- LICENSE.txt
|
183
|
+
- README.md
|
184
|
+
- Rakefile
|
185
|
+
- bin/console
|
186
|
+
- bin/setup
|
187
|
+
- exe/kiip
|
188
|
+
- kiip.gemspec
|
189
|
+
- lib/kiip.rb
|
190
|
+
- lib/kiip/cli.rb
|
191
|
+
- lib/kiip/errors.rb
|
192
|
+
- lib/kiip/repository.rb
|
193
|
+
- lib/kiip/repository/package.rb
|
194
|
+
- lib/kiip/tasks/symlink_task.rb
|
195
|
+
- lib/kiip/version.rb
|
196
|
+
homepage: https://github.com/rweng/kiip
|
197
|
+
licenses:
|
198
|
+
- MIT
|
199
|
+
metadata: {}
|
200
|
+
post_install_message:
|
201
|
+
rdoc_options: []
|
202
|
+
require_paths:
|
203
|
+
- lib
|
204
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - ">="
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
requirements: []
|
215
|
+
rubyforge_project:
|
216
|
+
rubygems_version: 2.4.6
|
217
|
+
signing_key:
|
218
|
+
specification_version: 4
|
219
|
+
summary: just another dotfiles tool
|
220
|
+
test_files: []
|