kameleon-builder 2.10.1 → 2.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40bafaeccf66d6d3149f1af122656d69ca563488fc51cb358e67a607f813d407
4
- data.tar.gz: 93d6c6c995fa330626a823c06026e9a3733c0dc72ee1cdc7feefc1d6f0db0362
3
+ metadata.gz: 5ba36ddda8ead18d06bc94412de565662a2cbed76a2ce71e4994e4f5ee665477
4
+ data.tar.gz: 8a1e67a68923b413654682b87e14e6c91102b57dc9fd4ed45164f0827b1483cb
5
5
  SHA512:
6
- metadata.gz: 4ff5b417aced3f8736f9d5d7dbe1f45092310667fbb352903fa9075844222d6e667e86881dca443367d1088d9dee7269d8f185c715ad9615957cda60985b7d07
7
- data.tar.gz: e69e617c0ee0eddf3d65dc2c2cef1b878222afbd9d0c7f392d57a93f164e84dd5cd217e8c4ac6f8b7673ad7ceb8355c7c0d60c57e555ba2141ed3211a6c2ca25
6
+ metadata.gz: 6993ca5f73661525c8a44133eb715d383144b75d5e4c9cc66f73aab1896643d9db09165ddc9af46e1474c2a82b856f1dc8a894582fb398f8d25ec472019878f1
7
+ data.tar.gz: 205ac5b41d50af596f7428196bfc1c1c6633e6408d5643e3d4e71f323f5117755e863e98432febcca98f0461b421d40a6a3ec08634da50a66f1afe101c38eba8
@@ -1,7 +1,7 @@
1
1
  [bumpversion]
2
2
  commit = True
3
3
  tag = True
4
- current_version = 2.10.1
4
+ current_version = 2.10.2
5
5
  parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+))?
6
6
  serialize =
7
7
  {major}.{minor}.{patch}.{release}
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
 
@@ -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> repository"
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
- register CLI::Repository, 'repository', 'repository', 'Manages repositories of recipes'
112
- # register CLI::Recipe, 'recipe', 'recipe', 'Manages the local recipes'
113
- register CLI::Template, 'template', 'template', 'Lists and imports templates'
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(*)
@@ -27,4 +27,5 @@ module Kameleon
27
27
  class TemplateNotFound < Error; status_code(9) ; end
28
28
  class CacheError < Error; status_code(10) ; end
29
29
  class ExportError < Error; status_code(11) ; end
30
+ class RepositoryError < Error; status_code(12) ; end
30
31
  end
@@ -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
- Kameleon.ui.info File.basename("#{repo_path}")
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
@@ -1 +1 @@
1
- 2.10.1
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.1
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-03-21 00:00:00.000000000 Z
15
+ date: 2020-04-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: childprocess