dotpack 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d91e034bbf9fe2cbc60810e9d92802b9a898926b
4
+ data.tar.gz: 668694ab480f5a3aed4b2779fca06e367e313fdd
5
+ SHA512:
6
+ metadata.gz: c487ae199c5e25fcabfb124ec0a1e47424f6c24fc21e7d250bc9322a6a6c8285a5f7abf47334560d61012978ca9677ea981cdfb5a651dc2ec60a6289fa4fde35
7
+ data.tar.gz: eca911cac58a3d541a3a5c34a4e21e949093da7a53567d5dc31dafb31c20b29076a5ff34f5caa5c6915916762e63094a5249133e2c1b2232de7d1eeb0f1a0d29
data/exe/dotpack ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'dotpack'
4
+
5
+ Dotpack::Cli::App.start
@@ -0,0 +1,10 @@
1
+ require 'thor'
2
+ require 'dotpack/cli/flavor'
3
+
4
+ module Dotpack
5
+ module Cli
6
+ class App < Thor
7
+ register(Cli::Flavor, 'flavor', 'flavor <command>', 'Add, remove or list flavors.')
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,36 @@
1
+ require 'thor'
2
+ require 'colorize'
3
+ require 'dotpack/config'
4
+
5
+ module Dotpack
6
+ module Cli
7
+ class Flavor < Thor
8
+ desc('add [ARGS]', 'Add flavors.')
9
+ def add(*args)
10
+ args.each do |a|
11
+ a = a.downcase
12
+ next if Config.flavors.include? a
13
+ Config.flavors << a
14
+ puts "Added flavor: #{a}".bold
15
+ end
16
+ Config.save
17
+ end
18
+
19
+ desc('remove [ARGS]', 'Remove flavors.')
20
+ def remove(*args)
21
+ args.each do |a|
22
+ a = a.downcase
23
+ next unless Config.flavors.include? a
24
+ Config.flavors.delete a
25
+ puts "Removed flavor: #{a}".bold
26
+ end
27
+ Config.save
28
+ end
29
+
30
+ desc('list', 'List used flavors.')
31
+ def list
32
+ puts Config.flavors
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,2 @@
1
+ require 'dotpack/cli/app'
2
+ require 'dotpack/cli/flavor'
@@ -0,0 +1,39 @@
1
+ require 'fileutils'
2
+
3
+ module Dotpack
4
+ module Config
5
+ BASE_DIR = Dir.home + '/.dotpack'
6
+ FLAVORS_PATH = BASE_DIR + '/flavors'
7
+
8
+ @flavors = []
9
+ @flavors_cached = false
10
+
11
+ def self.flavors
12
+ cache_flavors
13
+ return @flavors
14
+ end
15
+
16
+ def self.save
17
+ save_flavors
18
+ end
19
+
20
+ def self.save_flavors
21
+ return unless @flavors_cached
22
+ File.open(FLAVORS_PATH, 'w') do |file|
23
+ @flavors.each{|f| file.puts f}
24
+ end
25
+ end
26
+
27
+ private
28
+ def self.cache_flavors
29
+ return if @flavors_cached
30
+
31
+ FileUtils.mkdir_p BASE_DIR
32
+ unless File.exist? FLAVORS_PATH
33
+ FileUtils.touch FLAVORS_PATH
34
+ end
35
+ @flavors = File.read(FLAVORS_PATH).split
36
+ @flavors_cached = true
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module Dotpack
2
+ VERSION = "0.1.0"
3
+ end
data/lib/dotpack.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'dotpack/version'
2
+ require 'dotpack/cli'
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dotpack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nax
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-04 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.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
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: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.19'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.19'
55
+ - !ruby/object:Gem::Dependency
56
+ name: colorize
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.7'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.7'
69
+ description:
70
+ email:
71
+ - max.bacoux@gmail.com
72
+ executables:
73
+ - dotpack
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - exe/dotpack
78
+ - lib/dotpack.rb
79
+ - lib/dotpack/cli.rb
80
+ - lib/dotpack/cli/app.rb
81
+ - lib/dotpack/cli/flavor.rb
82
+ - lib/dotpack/config.rb
83
+ - lib/dotpack/version.rb
84
+ homepage: https://github.com/Nax/dotpack
85
+ licenses:
86
+ - MIT
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.6.4
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: A dotfile manager using ERB.
108
+ test_files: []