kiip 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3240b679e955ee5fbd7d1e3a1cd1bd1fe000e20a
4
- data.tar.gz: 2ebb7db6c11d52bc7807991b9354455fa87fd80e
3
+ metadata.gz: da08024c0ea0f33be0d8c9638bdd188bf1790e2d
4
+ data.tar.gz: 9f04b5a78be8e1504450ee2371f8fbac3d384180
5
5
  SHA512:
6
- metadata.gz: e8d3d7a910d44edb27f1960d82dff3631b7900c08100b886b96f1c192c98b5633f876bde0ffe2066146c494db6737b268264f6c90ec2a2be27ab0a904a026659
7
- data.tar.gz: e701876d02d0ff455ad2423a9ce48dc7d3d6563b83beb4cc6bb69dcf08a3e978ec6715e05ba877d4357fa0c634090267734b96a3efea30f4fc8151bd8623ab85
6
+ metadata.gz: 794ca532eb4c790f801351877041bc8c8494c2b28f118ad69d97813bc29f85cf03106483fdd3eae2ede993ebdbcfa433394bf6b00422984261aae6c4a1e5d23b
7
+ data.tar.gz: 75b9890ce3cddc2ed28d91e2893e8eac0e197ded49b16df9c943bd52b8573c6d102a9ca370081d0634752aa8bfecc5c89ade4453a998a497d0be8e9964ce19f6
@@ -1 +1 @@
1
- ruby-2.2
1
+ ruby-2.3
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.3.0
3
4
  - 2.2.1
4
5
  - 2.1.5
5
6
  - 2.0.0
data/README.md CHANGED
@@ -8,7 +8,8 @@ Kiip, just another dotfiles tool to move your actual files and folders to a repo
8
8
  ## Terminology
9
9
 
10
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`
11
+ - `Package`: The folder `PATH_TO_REPOSITORY/PACKAGE_NAME`. It can contain multiple entries.
12
+ - `Entry`: The file/folder/symlink **in** `PATH_TO_REPOSITORY/PACKAGE_NAME`. It is the real file/folder, with an base64 encoded name of the original path.
12
13
 
13
14
  ## Installation
14
15
 
@@ -18,19 +19,45 @@ Kiip, just another dotfiles tool to move your actual files and folders to a repo
18
19
 
19
20
  Commands:
20
21
  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....
22
+ kiip link PACKAGE_NAME # ensures links to the package files exist
23
+ kiip list # lists all packages with content
24
+ kiip restore PACKAGE_NAME # restores the content of the package to the original places
25
+ kiip rm NAME # removes package with name NAME from the repository
26
+ kiip track PACKAGE_NAME PATH # tracks the file or folder under PATH with the package name NAM...
27
+ kiip unlink PACKAGE_NAME # removes the links to the package files
25
28
 
26
29
  Options:
27
- [--dry], [--no-dry]
30
+ -d, [--dry], [--no-dry]
31
+ -v, [--verbose], [--no-verbose]
28
32
 
29
33
  Examples:
30
- kiip track ssh ~/.ssh
31
- kiip list
34
+ $ kiip track -v ssh ~/.ssh
35
+ mv /Users/rowe/.ssh /Users/rowe/Sync/home/kiip/ssh/fi8uc3No
36
+ ln -s /Users/rowe/Sync/home/kiip/ssh/fi8uc3No /Users/rowe/.ssh
37
+
38
+ $ kiip list
32
39
  ssh:
33
- ~/.ssh
40
+ ~/.ssh | linked
41
+
42
+ $ kiip unlink -v ssh
43
+ removing ~/.ssh
44
+
45
+ $ kiip list
46
+ ssh:
47
+ ~/.ssh | not_existent
48
+
49
+ $ kiip restore -v ssh
50
+ copy /Users/rowe/Sync/home/kiip/ssh/fi8uc3No to ~/.ssh
51
+
52
+ $ kiip list
53
+ ssh:
54
+ ~/.ssh | directory
55
+
56
+ $ kiip rm -v ssh
57
+ rm -r /Users/rowe/Sync/home/kiip/ssh
58
+
59
+ $ kiip list
60
+
34
61
 
35
62
 
36
63
  ## Development
data/exe/kiip CHANGED
@@ -3,5 +3,10 @@
3
3
  $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
4
4
 
5
5
  require 'kiip'
6
-
7
- Kiip::Cli.start(ARGV)
6
+ begin
7
+ Kiip::Cli.start(ARGV)
8
+ rescue StandardError => e
9
+ require 'highline'
10
+ HighLine.color_scheme = HighLine::SampleColorScheme.new
11
+ HighLine.new.say "<%= color('#{e.message}', :error) %>"
12
+ end
@@ -1,7 +1,7 @@
1
1
  module Kiip
2
2
  class Cli < Thor
3
- class_option :dry, :type => :boolean, default: false
4
- class_option :verbose, :type => :boolean, default: false
3
+ class_option :dry, :type => :boolean, default: false, aliases: '-d'
4
+ class_option :verbose, :type => :boolean, default: false, aliases: '-v'
5
5
 
6
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
7
  def track package_name, file_or_folder
@@ -33,6 +33,11 @@ module Kiip
33
33
  repository.rm package_name
34
34
  end
35
35
 
36
+ desc 'version', 'displays kiip version'
37
+ def version
38
+ puts Kiip::VERSION
39
+ end
40
+
36
41
  private
37
42
  def repository
38
43
  Kiip::Repository.get_instance(is_dry: options[:dry], is_verbose: options[:verbose])
@@ -13,7 +13,8 @@ module Kiip
13
13
  cli.agree("#{source} exists. Remove it?") ? remove_source : return
14
14
  end
15
15
 
16
- FileUtils.copy_entry(target, expanded_source, **file_options)
16
+ puts "copy #{target} to #{source}" if verbose?
17
+ FileUtils.copy_entry(target, expanded_source) unless dry?
17
18
  end
18
19
 
19
20
  # removes the source. If source is not a link to target, it asks the users.
@@ -24,7 +25,8 @@ module Kiip
24
25
  end
25
26
 
26
27
  if correct_link? or cli.agree("#{source} is not a symlink to #{target}. Still remove it?")
27
- FileUtils.remove_entry(expanded_source, **file_options)
28
+ puts "removing #{source}" if file_options[:verbose]
29
+ FileUtils.remove_entry(expanded_source, **file_options) unless file_options[:noop]
28
30
  end
29
31
  end
30
32
 
@@ -48,12 +50,20 @@ module Kiip
48
50
  @cli || HighLine.new
49
51
  end
50
52
 
53
+ def verbose?
54
+ package.repository.is_verbose
55
+ end
56
+
57
+ def dry?
58
+ package.repository.is_dry
59
+ end
60
+
51
61
  def expanded_source
52
62
  File.expand_path(source)
53
63
  end
54
64
 
55
65
  def file_options
56
- {verbose: package.repository.is_verbose, noop: package.repository.is_dry}
66
+ {verbose: verbose?, noop: dry?}
57
67
  end
58
68
 
59
69
  # asks the user if source should be removed and removes it
@@ -45,14 +45,14 @@ module Kiip
45
45
 
46
46
  return if repository.is_dry
47
47
 
48
- task = Tasks::SymlinkTask.new(name: 'task-name', source: tracking_path, target: File.join(path, escaped_tracking_path))
48
+ task = Tasks::SymlinkTask.new(name: 'task-name', source: tracking_path, target: File.join(path, escaped_tracking_path), is_verbose: repository.is_verbose, is_dry: repository.is_dry)
49
49
  task.exec!
50
50
  end
51
51
 
52
52
  def sync!
53
53
  content.each do |subpath|
54
54
  source = self.class.decode subpath
55
- task = Tasks::SymlinkTask.new(name: 'task-name', source: source, target: File.join(path, subpath))
55
+ task = Tasks::SymlinkTask.new(name: 'task-name', source: source, target: File.join(path, subpath), is_verbose: repository.is_verbose, is_dry: repository.is_dry)
56
56
  task.exec!
57
57
  end
58
58
  end
@@ -7,7 +7,7 @@ module Kiip
7
7
  def self.get_instance(**options)
8
8
  path = ENV['KIIP_REPO'] || raise('KIIP_REPO environment variable not defined')
9
9
 
10
- options[:path] = path
10
+ options[:path] = %x(echo #{path}).rstrip
11
11
 
12
12
  return self.new(**options)
13
13
  end
@@ -110,4 +110,4 @@ module Kiip
110
110
  Pathname.new(path).children.select(&:directory?).map(&:basename).map(&:to_s)
111
111
  end
112
112
  end
113
- end
113
+ end
@@ -23,7 +23,10 @@ module Kiip::Tasks
23
23
  return initialize! unless File.exists? target
24
24
 
25
25
  if File.symlink? source
26
- return if File.readlink(source) == target
26
+ if File.readlink(source) == target
27
+ puts "#{source} already linked" if is_verbose
28
+ return
29
+ end
27
30
 
28
31
  if cli.agree "#{source} already exists, linking to #{File.readlink(source)}. Replace?"
29
32
  remove_source
@@ -1,3 +1,3 @@
1
1
  module Kiip
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Wenglewski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-05 00:00:00.000000000 Z
11
+ date: 2016-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  version: '0'
215
215
  requirements: []
216
216
  rubyforge_project:
217
- rubygems_version: 2.4.8
217
+ rubygems_version: 2.5.1
218
218
  signing_key:
219
219
  specification_version: 4
220
220
  summary: just another dotfiles tool