confc 0.1.0 → 0.2.0
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 +4 -4
- data/README.md +32 -0
- data/confc.gemspec +4 -2
- data/lib/confc/cli.rb +3 -10
- data/lib/confc/load_config.rb +31 -0
- data/lib/confc/version.rb +1 -1
- metadata +41 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcff39b515da905c95db2633bcf1d1e39c5e94e885cec7e3bf1259ad177b7554
|
4
|
+
data.tar.gz: d25d12de3ac4ec68c7c9372d6499a2d893a621d6022b6c5eb8b6200f69ebe16a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb0ccf7ce8b3edf78e71ba6c4ef1edec98aa21032b842134bb5b931bb406ff00bcc4f0d6c58b55d733b190b4945f65fa6127d6ae2a9b59f466d4e6921dfd40db
|
7
|
+
data.tar.gz: cb249f7fa9ec56fb83fb0d0fb156ee862c7b4abc967f72ed9cb544c0767220a4067dd0ad87dcd1b4fcc60094d58705a0f92de1362739f6e24fdf88bef91e2a11
|
data/README.md
CHANGED
@@ -28,6 +28,38 @@ Clone your default configuration files to current working directory.
|
|
28
28
|
-h, --help Show help
|
29
29
|
```
|
30
30
|
|
31
|
+
## Configuration
|
32
|
+
|
33
|
+
You can configure **ConfC** via `.confcrc`, `.confcrc.json`, `.confcrc.yml` or `.confcrc.yaml` file.
|
34
|
+
More information about configuration file can be found from [mysticonfig](https://git.io/mysticonfig).
|
35
|
+
|
36
|
+
### .confcrc
|
37
|
+
- **path**
|
38
|
+
Type: `String`
|
39
|
+
Default: **$HOME** (Your **home** directory)
|
40
|
+
|
41
|
+
Path to directory that contain your default configuration files.
|
42
|
+
|
43
|
+
- **files**
|
44
|
+
Type: `Array<String>`
|
45
|
+
Default: Files name in [files.yaml](./files.yaml)
|
46
|
+
|
47
|
+
List of target files name that you want to clone.
|
48
|
+
|
49
|
+
> If you have your own configuration files and don't want to use files from [files.yaml](./files.yaml), just replace it with your files name by this option.
|
50
|
+
|
51
|
+
- **overwrite**
|
52
|
+
Type: `Boolean`
|
53
|
+
Default: `false`
|
54
|
+
|
55
|
+
Force to overwrite files if it exists.
|
56
|
+
|
57
|
+
- **verbose**
|
58
|
+
Type: `Boolean`
|
59
|
+
Default: `false`
|
60
|
+
|
61
|
+
Display verbose information.
|
62
|
+
|
31
63
|
## Related
|
32
64
|
|
33
65
|
- [ConfC](https://github.com/gluons/ConfC) - 🆕 Start new project with your default configs. (Node.js version)
|
data/confc.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = ['confc.gemspec', 'LICENSE', 'Gemfile', 'files.yaml']
|
16
16
|
s.files += Dir['*.md', 'bin/*', 'lib/**/*']
|
17
17
|
s.executables = ['confc']
|
18
|
-
s.required_ruby_version = '>= 2.
|
18
|
+
s.required_ruby_version = '>= 2.2.2'
|
19
19
|
s.author = 'Saran Tanpituckpong'
|
20
20
|
s.license = 'MIT'
|
21
21
|
s.homepage = 'https://gluons.github.io/ConfC.gem/'
|
@@ -23,8 +23,10 @@ Gem::Specification.new do |s|
|
|
23
23
|
'bug_tracker_uri' => 'https://github.com/gluons/ConfC.gem/issues'
|
24
24
|
}
|
25
25
|
|
26
|
+
s.add_runtime_dependency 'activesupport', '~> 5.1', '>= 5.1.5'
|
27
|
+
s.add_runtime_dependency 'mysticonfig', '~> 0.1.0'
|
26
28
|
s.add_runtime_dependency 'rainbow', '~> 3.0'
|
27
|
-
s.add_runtime_dependency 'tty-prompt', '~> 0.
|
29
|
+
s.add_runtime_dependency 'tty-prompt', '~> 0.15.0'
|
28
30
|
|
29
31
|
s.add_development_dependency 'aruba', '~> 0.14.3'
|
30
32
|
s.add_development_dependency 'rake', '~> 12.3'
|
data/lib/confc/cli.rb
CHANGED
@@ -6,6 +6,7 @@ require_relative 'conf_clone'
|
|
6
6
|
require_relative 'files'
|
7
7
|
require_relative 'get_existent_files'
|
8
8
|
require_relative 'gethome'
|
9
|
+
require_relative 'load_config'
|
9
10
|
require_relative 'to_filenames'
|
10
11
|
require_relative 'version'
|
11
12
|
|
@@ -14,17 +15,10 @@ BANNER = <<-BANNER.freeze
|
|
14
15
|
Usage: #{Rainbow('confc').green} [options] [filenames...]
|
15
16
|
|
16
17
|
Clone your default configuration files to current working directory.
|
18
|
+
|
17
19
|
BANNER
|
18
20
|
# rubocop:enable Layout/IndentHeredoc
|
19
21
|
|
20
|
-
DEFAULT_OPTIONS = {
|
21
|
-
files: ConfC.files,
|
22
|
-
path: ConfC.gethome,
|
23
|
-
overwrite: false,
|
24
|
-
yes: false,
|
25
|
-
verbose: false
|
26
|
-
}.freeze
|
27
|
-
|
28
22
|
AWW = '(。◕‿◕。)'.freeze
|
29
23
|
|
30
24
|
##
|
@@ -43,7 +37,6 @@ module ConfC
|
|
43
37
|
|
44
38
|
confc_options = {
|
45
39
|
overwrite: options[:overwrite],
|
46
|
-
yes: options[:yes],
|
47
40
|
verbose: options[:verbose]
|
48
41
|
}
|
49
42
|
existent_files = ConfC.get_existent_files(options[:path], files)
|
@@ -55,7 +48,7 @@ module ConfC
|
|
55
48
|
##
|
56
49
|
# Parse CLI ARGV.
|
57
50
|
def self.parse(argv)
|
58
|
-
options =
|
51
|
+
options = ConfC.load_config
|
59
52
|
|
60
53
|
parser = OptionParser.new do |opts|
|
61
54
|
opts.banner = BANNER
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'active_support/core_ext/hash/keys'
|
2
|
+
require 'mysticonfig'
|
3
|
+
|
4
|
+
require_relative 'files'
|
5
|
+
require_relative 'gethome'
|
6
|
+
|
7
|
+
DEFAULT_CONFIG = {
|
8
|
+
'path' => ConfC.gethome,
|
9
|
+
'files' => ConfC.files,
|
10
|
+
'overwrite' => false,
|
11
|
+
'verbose' => false,
|
12
|
+
'yes' => false
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
##
|
16
|
+
# ConfC
|
17
|
+
module ConfC
|
18
|
+
##
|
19
|
+
# Load ConfC configuration.
|
20
|
+
def self.load_config
|
21
|
+
loader = Mysticonfig::Loader.new('confc', DEFAULT_CONFIG)
|
22
|
+
config = loader.load
|
23
|
+
if config.empty?
|
24
|
+
DEFAULT_CONFIG.symbolize_keys
|
25
|
+
else
|
26
|
+
# Truncate un-related config
|
27
|
+
config = config.select { |k, _| DEFAULT_CONFIG.keys.include? k }
|
28
|
+
config.symbolize_keys
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/confc/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saran Tanpituckpong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 5.1.5
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 5.1.5
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: mysticonfig
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.1.0
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.1.0
|
13
47
|
- !ruby/object:Gem::Dependency
|
14
48
|
name: rainbow
|
15
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -30,14 +64,14 @@ dependencies:
|
|
30
64
|
requirements:
|
31
65
|
- - "~>"
|
32
66
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
67
|
+
version: 0.15.0
|
34
68
|
type: :runtime
|
35
69
|
prerelease: false
|
36
70
|
version_requirements: !ruby/object:Gem::Requirement
|
37
71
|
requirements:
|
38
72
|
- - "~>"
|
39
73
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
74
|
+
version: 0.15.0
|
41
75
|
- !ruby/object:Gem::Dependency
|
42
76
|
name: aruba
|
43
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,6 +152,7 @@ files:
|
|
118
152
|
- lib/confc/get_existent_files.rb
|
119
153
|
- lib/confc/gethome.rb
|
120
154
|
- lib/confc/interrupt_handler.rb
|
155
|
+
- lib/confc/load_config.rb
|
121
156
|
- lib/confc/to_filenames.rb
|
122
157
|
- lib/confc/version.rb
|
123
158
|
homepage: https://gluons.github.io/ConfC.gem/
|
@@ -133,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
168
|
requirements:
|
134
169
|
- - ">="
|
135
170
|
- !ruby/object:Gem::Version
|
136
|
-
version: 2.
|
171
|
+
version: 2.2.2
|
137
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
173
|
requirements:
|
139
174
|
- - ">="
|
@@ -141,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
176
|
version: '0'
|
142
177
|
requirements: []
|
143
178
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.7.
|
179
|
+
rubygems_version: 2.7.5
|
145
180
|
signing_key:
|
146
181
|
specification_version: 4
|
147
182
|
summary: Start new project with your default configs.
|