kameleon-builder 2.10.1 → 2.10.2
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/.bumpversion.cfg +1 -1
- data/CHANGES +8 -0
- data/lib/kameleon/cli.rb +17 -12
- data/lib/kameleon/error.rb +1 -0
- data/lib/kameleon/repository.rb +42 -2
- data/version.txt +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ba36ddda8ead18d06bc94412de565662a2cbed76a2ce71e4994e4f5ee665477
|
4
|
+
data.tar.gz: 8a1e67a68923b413654682b87e14e6c91102b57dc9fd4ed45164f0827b1483cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6993ca5f73661525c8a44133eb715d383144b75d5e4c9cc66f73aab1896643d9db09165ddc9af46e1474c2a82b856f1dc8a894582fb398f8d25ec472019878f1
|
7
|
+
data.tar.gz: 205ac5b41d50af596f7428196bfc1c1c6633e6408d5643e3d4e71f323f5117755e863e98432febcca98f0461b421d40a6a3ec08634da50a66f1afe101c38eba8
|
data/.bumpversion.cfg
CHANGED
data/CHANGES
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
Kameleon CHANGELOG
|
2
2
|
==================
|
3
3
|
|
4
|
+
Version 2.10.2
|
5
|
+
--------------
|
6
|
+
|
7
|
+
Released on April 09th 2020
|
8
|
+
- Fix cli help for the repository and template sub-commands
|
9
|
+
- Add the git remote url and branch to kameleon repo list
|
10
|
+
- Add the 'kameleon repository remove' command
|
11
|
+
|
4
12
|
Version 2.10.1
|
5
13
|
-------------
|
6
14
|
|
data/lib/kameleon/cli.rb
CHANGED
@@ -21,16 +21,27 @@ module Kameleon
|
|
21
21
|
end
|
22
22
|
|
23
23
|
desc "list", "Lists available repositories."
|
24
|
+
method_option :git, :type => :boolean,
|
25
|
+
:default => true,
|
26
|
+
:desc => "show the git repository and branch each repository comes from"
|
24
27
|
def list
|
25
|
-
Kameleon::Repository.list
|
28
|
+
Kameleon::Repository.list(options)
|
26
29
|
end
|
27
30
|
|
28
|
-
desc "update <NAME>", "Updates repository named <NAME>
|
31
|
+
desc "update <NAME>", "Updates repository named <NAME> from git"
|
29
32
|
def update(name)
|
30
33
|
Kameleon::Repository.update(name)
|
31
34
|
end
|
32
35
|
map %w(-h --help) => :help
|
33
36
|
map %w(ls) => :list
|
37
|
+
|
38
|
+
desc "remove <NAME>", "Remove repository named <NAME>"
|
39
|
+
def remove(name)
|
40
|
+
Kameleon::Repository.remove(name)
|
41
|
+
end
|
42
|
+
map %w(-h --help) => :help
|
43
|
+
map %w(ls) => :list
|
44
|
+
map %w(rm) => :remove
|
34
45
|
end
|
35
46
|
|
36
47
|
|
@@ -108,9 +119,10 @@ module Kameleon
|
|
108
119
|
class Main < Thor
|
109
120
|
include Thor::Actions
|
110
121
|
|
111
|
-
|
112
|
-
|
113
|
-
|
122
|
+
desc 'repository <SUBCOMMAND>', 'Manages repositories of recipes'
|
123
|
+
subcommand 'repository', CLI::Repository
|
124
|
+
desc 'template <SUBCOMMAND>', 'Lists and imports templates'
|
125
|
+
subcommand 'template', CLI::Template
|
114
126
|
|
115
127
|
class_option :color, :type => :boolean, :default => Kameleon.default_values[:color],
|
116
128
|
:desc => "Enables colorization in output"
|
@@ -431,13 +443,6 @@ module Kameleon
|
|
431
443
|
Kameleon.ui.level = "verbose"
|
432
444
|
end
|
433
445
|
Kameleon.ui.verbose("The level of output is set to #{Kameleon.ui.level}")
|
434
|
-
|
435
|
-
opts = args[1]
|
436
|
-
cmd_name = args[2][:current_command].name
|
437
|
-
if opts.include? "--help" or opts.include? "-h"
|
438
|
-
Main.command_help(Kameleon.ui.shell, cmd_name)
|
439
|
-
raise Kameleon::Exit
|
440
|
-
end
|
441
446
|
end
|
442
447
|
|
443
448
|
def self.start(*)
|
data/lib/kameleon/error.rb
CHANGED
data/lib/kameleon/repository.rb
CHANGED
@@ -28,6 +28,7 @@ module Kameleon
|
|
28
28
|
def self.update(name)
|
29
29
|
check_git_binary
|
30
30
|
git_repo = File.join(Kameleon.env.repositories_path, name)
|
31
|
+
raise RepositoryError, "Repository not found '#{name}'" if not File.directory?(git_repo)
|
31
32
|
cmd = ["git", "--git-dir", File.join(git_repo, ".git"), "--work-tree",
|
32
33
|
git_repo, "pull", "--verbose"]
|
33
34
|
process = ChildProcess.build(*cmd)
|
@@ -37,10 +38,49 @@ module Kameleon
|
|
37
38
|
process.stop
|
38
39
|
end
|
39
40
|
|
40
|
-
def self.list
|
41
|
+
def self.list(kwargs = {})
|
41
42
|
Dir["#{Kameleon.env.repositories_path}/*"].each do |repo_path|
|
42
|
-
|
43
|
+
if kwargs[:git]
|
44
|
+
show_git_repository(repo_path)
|
45
|
+
else
|
46
|
+
Kameleon.ui.info File.basename(repo_path)
|
47
|
+
end
|
43
48
|
end
|
44
49
|
end
|
50
|
+
|
51
|
+
def self.remove(name)
|
52
|
+
repo_path = File.join(Kameleon.env.repositories_path, name)
|
53
|
+
raise RepositoryError, "Repository not found '#{name}'" if not File.directory?(repo_path)
|
54
|
+
Kameleon.ui.shell.say "Removing: ", :red, false
|
55
|
+
show_git_repository(repo_path)
|
56
|
+
FileUtils.rm_rf(repo_path)
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.show_git_repository(repo_path)
|
60
|
+
cmd = ["git", "remote", "-v"]
|
61
|
+
r, w = IO.pipe
|
62
|
+
process = ChildProcess.build(*cmd)
|
63
|
+
process.io.stdout = w
|
64
|
+
process.cwd = repo_path
|
65
|
+
process.start
|
66
|
+
w.close
|
67
|
+
url = r.readline.split[1]
|
68
|
+
process.wait
|
69
|
+
process.stop
|
70
|
+
cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
|
71
|
+
r, w = IO.pipe
|
72
|
+
process = ChildProcess.build(*cmd)
|
73
|
+
process.io.stdout = w
|
74
|
+
process.cwd = repo_path
|
75
|
+
process.start
|
76
|
+
w.close
|
77
|
+
branch = r.readline.chomp
|
78
|
+
process.wait
|
79
|
+
process.stop
|
80
|
+
Kameleon.ui.shell.say "#{File.basename("#{repo_path}")}", nil, false
|
81
|
+
Kameleon.ui.shell.say " <-", :magenta, false
|
82
|
+
Kameleon.ui.shell.say " #{url}", :cyan, false
|
83
|
+
Kameleon.ui.shell.say " (#{branch})", :yellow
|
84
|
+
end
|
45
85
|
end
|
46
86
|
end
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.10.
|
1
|
+
2.10.2
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kameleon-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.10.
|
4
|
+
version: 2.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salem Harrache
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2020-
|
15
|
+
date: 2020-04-09 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: childprocess
|