xezat 0.3.2 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19e1eef962e59cf81c84a69ea321838d0b0542952073b429cb0f9af0d8cd7dd3
4
- data.tar.gz: 88a9a875473d8e11ab01651393740b06af772b9c1f7ce18e9e3fc74909971b1b
3
+ metadata.gz: 971a71dc0eae6338466af60e22d6cce153514be903f36ce3b8466cbe8e197f8d
4
+ data.tar.gz: 97ec5d3fd7386ae4022dc488e8fd1bb239629e91a54b606347fca99c3128378c
5
5
  SHA512:
6
- metadata.gz: cf83fa1fbc96dfd22a07d64c974fc3d279cd00a3021315d18948011d44354624d8e426c88bdd654bd63c27a63b01ece6f47a842ed9cba54fb77cf50fa1d754d2
7
- data.tar.gz: b4132baf3892fccce8e9b19f6701751878be50a74e08551cc601c921a1ccfe25f3b29f7730d160a7cda93c51306a95ba47e4234ce99a84754b40b4849a50f5e6
6
+ metadata.gz: a092f71a8b3f282c2d48dc736df3fc6081d8c1ec23bbb5de81f05db9a8e58e45eca00f193819e67d6680ff7c2ec8dcb0bd59c2fdafb16be47a2562669d6e5856
7
+ data.tar.gz: 7dda61ff0a0a7234486f085705b8bd2f0f2e19af108c8eb8c1696f224a66a33534069ffd159d76047dd4e31dd13dee32095d5795bdc054e9af744b05a9e4bb85
data/README.md CHANGED
@@ -1,39 +1,59 @@
1
1
  # Xezat
2
2
 
3
3
  [![Actions](https://github.com/fd00/xezat/actions/workflows/ruby.yml/badge.svg)](https://github.com/fd00/xezat/)
4
+ [![Gem Version](https://badge.fury.io/rb/xezat.svg)](https://badge.fury.io/rb/xezat)
4
5
 
5
- xezat helps you win at cygport.
6
+ Xezat is a helper tool for your daily packaging tasks with [Cygport](httpss://cygwin.com/cygport/).
6
7
 
7
- ## Installation
8
+ ## Features
8
9
 
9
- Add this line to your application's Gemfile:
10
+ Xezat provides the following subcommands through the `xezat` command:
10
11
 
11
- ```ruby
12
- gem 'xezat'
13
- ```
12
+ * `init`: Interactively generates a new `cygport` file.
13
+ * `bump`: Bumps the package version and updates the `README` file.
14
+ * `validate`: Validates that the `cygport` file and related files adhere to conventions.
15
+ * `port`: Copies the `cygport` to a Git repository.
16
+ * `announce`: Generates a template for ITP (Intent to Package) or `cygport` update announcements.
17
+ * `doctor`: Checks your system for potential problems.
18
+ * `generate`: Generates development files used by `cygport`.
19
+ * `debug`: Assists in debugging `cygport` files.
14
20
 
15
- And then execute:
21
+ You can check the details of each command with `xezat <command> --help`.
16
22
 
17
- $ bundle
23
+ ## Installation
18
24
 
19
- Or install it yourself as:
25
+ Install the gem:
20
26
 
21
- $ gem install xezat
27
+ ```bash
28
+ gem install xezat
29
+ ```
22
30
 
23
31
  ## Usage
24
32
 
25
- TODO: Write usage instructions here
33
+ ### 1. Creating a new package
34
+
35
+ ```bash
36
+ xezat init foo.cygport
37
+ ```
26
38
 
27
- ## Development
39
+ ### 2. Bumping the version
28
40
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
41
+ ```bash
42
+ xezat bump foo.cygport
43
+ ```
30
44
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
45
+ ### 3. Validating the package
46
+
47
+ ```bash
48
+ xezat validate foo.cygport
49
+ ```
32
50
 
33
51
  ## Contributing
34
52
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/fd00/xezat.
53
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/fd00/xezat](https://github.com/fd00/xezat).
54
+
55
+ This project utilizes Google Gemini for development assistance.
36
56
 
37
57
  ## License
38
58
 
39
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
59
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bashvar'
4
+ require 'open3'
5
+ require 'xezat'
6
+
7
+ module Xezat
8
+ def bashvar(cygport)
9
+ command = ['bash', File.expand_path(File.join(DATA_DIR, 'bashvar.sh')), cygport]
10
+ result, error, status = Open3.capture3(command.join(' '))
11
+ raise CygportProcessError, error unless status.success?
12
+
13
+ BashVar.parse(result, symbolize_names: true)
14
+ end
15
+ end
@@ -58,8 +58,10 @@ module Xezat
58
58
 
59
59
  def validate_category(category)
60
60
  categories_file = File.expand_path(File.join(DATA_DIR, 'categories.yaml'))
61
- Xezat.logger.error(" Category is invalid : #{category}") unless
62
- YAML.safe_load(File.open(categories_file), symbolize_names: true, permitted_classes: [Symbol]).include?(category.downcase)
61
+ valid_categories = YAML.safe_load(File.open(categories_file), symbolize_names: true, permitted_classes: [Symbol])
62
+ category.split.each do |cat|
63
+ Xezat.logger.error(" Category is invalid : #{cat}") unless valid_categories.include?(cat.downcase)
64
+ end
63
65
  end
64
66
 
65
67
  def validate_homepage(homepage)
@@ -3,14 +3,12 @@
3
3
  require 'English'
4
4
  require 'etc'
5
5
  require 'facets/file/atomic_write'
6
- require 'facets/string/word_wrap'
7
- require 'open3'
8
- require 'uri'
9
6
  require 'yaml'
10
7
  require 'xezat'
8
+ require 'xezat/bashvar'
11
9
 
12
10
  module Xezat
13
- def variables(cygport, var2yaml_fetcher: nil)
11
+ def variables(cygport)
14
12
  cygport_dir = File.dirname(File.absolute_path(cygport))
15
13
  cache_file = File.expand_path(File.join(cygport_dir, "#{File.basename(cygport, '.cygport')}.#{Etc.uname[:machine]}.yml"))
16
14
 
@@ -23,48 +21,13 @@ module Xezat
23
21
  end
24
22
  end
25
23
 
26
- result = if var2yaml_fetcher
27
- var2yaml_fetcher.call(cygport)
28
- else
29
- execute_var2yaml(cygport)
30
- end
31
-
32
- result.gsub!(/^.*\*\*\*.*$/, '')
33
-
34
- begin
35
- variables = YAML.safe_load(result, symbolize_names: true, permitted_classes: [Symbol]).each_value do |v|
36
- v.strip! if v.respond_to?(:strip)
37
- end
38
- rescue Psych::SyntaxError => e
39
- print_yaml(result)
40
- raise e
41
- end
42
-
43
- variables[:DESCRIPTION].word_wrap!(79)
24
+ vars = bashvar(cygport)
44
25
 
45
26
  File.atomic_write(cache_file) do |f|
46
27
  Xezat.logger.debug(' Write cache for variables')
47
- f.write(YAML.dump(variables))
48
- end
49
-
50
- variables
51
- end
52
-
53
- def print_yaml(result)
54
- lineno = 1
55
- result.split($INPUT_RECORD_SEPARATOR).each do |line|
56
- printf '%<lineno>5d | %<line>s%<ls>s', lineno:, line:, ls: $INPUT_RECORD_SEPARATOR
57
- lineno += 1
28
+ f.write(YAML.dump(vars))
58
29
  end
59
- end
60
-
61
- private
62
-
63
- def execute_var2yaml(cygport)
64
- command = ['bash', File.expand_path(File.join(DATA_DIR, 'var2yaml.sh')), cygport]
65
- result, error, status = Open3.capture3(command.join(' '))
66
- raise CygportProcessError, error unless status.success?
67
30
 
68
- result
31
+ vars
69
32
  end
70
33
  end
data/lib/xezat/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Xezat
4
- VERSION = '0.3.2'
4
+ VERSION = '0.4.0'
5
5
  end
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/bash
2
+
3
+ bashvar()
4
+ {
5
+ compgen -v | while read var; do declare -p "$var"; done
6
+ }
7
+
8
+ source ${CYGPORT:-/usr/bin/cygport} $* bashvar
@@ -2,6 +2,7 @@
2
2
  ------------------------------------------
3
3
  <%= variables[:DESCRIPTION] -%>
4
4
 
5
+
5
6
  Runtime requirements:
6
7
  <% info[:runtimes].each { |runtime| -%>
7
8
  <%= runtime %>
data/xezat.gemspec CHANGED
@@ -42,6 +42,7 @@ Gem::Specification.new do |spec|
42
42
  spec.require_paths = ['lib']
43
43
  spec.required_ruby_version = '>= 3.2.2'
44
44
 
45
+ spec.add_dependency 'bashvar', '>= 0.1.1'
45
46
  spec.add_dependency 'colorize', '>= 1.1.0'
46
47
  spec.add_dependency 'facets', '>= 3.1.0'
47
48
  spec.add_dependency 'github-linguist', '>= 9.1.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xezat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daisuke Fujimura (fd0)
@@ -9,6 +9,20 @@ bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bashvar
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 0.1.1
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 0.1.1
12
26
  - !ruby/object:Gem::Dependency
13
27
  name: colorize
14
28
  requirement: !ruby/object:Gem::Requirement
@@ -217,6 +231,7 @@ files:
217
231
  - README.md
218
232
  - exe/xezat
219
233
  - lib/xezat.rb
234
+ - lib/xezat/bashvar.rb
220
235
  - lib/xezat/command/announce.rb
221
236
  - lib/xezat/command/bump.rb
222
237
  - lib/xezat/command/bump/changelog.rb
@@ -282,6 +297,7 @@ files:
282
297
  - lib/xezat/variables.rb
283
298
  - lib/xezat/version.rb
284
299
  - share/xezat/autoconf-archive.yml
300
+ - share/xezat/bashvar.sh
285
301
  - share/xezat/categories.yaml
286
302
  - share/xezat/compilers.yaml
287
303
  - share/xezat/cygport_dep.sh
@@ -298,7 +314,6 @@ files:
298
314
  - share/xezat/template/pkgconfig/Makefile.am
299
315
  - share/xezat/template/pkgconfig/cmake.erb
300
316
  - share/xezat/template/pkgconfig/pkgconfig.erb
301
- - share/xezat/var2yaml.sh
302
317
  - xezat.gemspec
303
318
  homepage: https://github.com/fd00/xezat
304
319
  licenses:
@@ -1,33 +0,0 @@
1
- #!/bin/bash
2
-
3
- var2yaml()
4
- {
5
- for var in `compgen -A variable`
6
- do
7
- [ $var = 'BASH_COMMAND' ] && continue
8
- [ $var = 'COMP_WORDBREAKS' ] && continue
9
- [ $var = 'HOMEPATH' ] && continue
10
- [ $var = 'PERL_MB_OPT' ] && continue
11
- [ $var = 'PSModulePath' ] && continue
12
- [ $var = '_cygport_orig_env' ] && continue
13
- [[ ${!var} =~ ^[A-Za-z]:.* ]] && continue
14
-
15
- echo -n :$var:
16
- if [[ `declare -p $var` =~ "declare -a" ]]
17
- then
18
- echo
19
- x=`printf '${!%s[@]}' $var`
20
- eval "keys=$x"
21
- for key in $keys
22
- do
23
- x=`printf '${%s[%s]}' $var $key`
24
- eval "value=$x"
25
- echo " -" '"'$value'"'
26
- done
27
- else
28
- echo ' "'`echo "${!var}" | sed -e "s/\\n/ /g"`'"'
29
- fi
30
- done
31
- }
32
-
33
- source ${CYGPORT:-/usr/bin/cygport} $* var2yaml