benry-cmdopt 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile.rb CHANGED
@@ -1,92 +1,11 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
 
4
- project = "benry-cmdopt"
5
- release = ENV['RELEASE'] || "0.0.0"
6
- copyright = "copyright(c) 2021 kuwata-lab.com all rights reserved"
7
- license = "MIT License"
4
+ PROJECT = "benry-cmdopt"
5
+ RELEASE = ENV['RELEASE'] || "0.0.0"
6
+ COPYRIGHT = "copyright(c) 2021 kwatch@gmail.com"
7
+ LICENSE = "MIT License"
8
8
 
9
- target_files = Dir[*%W[
10
- README.md CHANGES.md MIT-LICENSE.txt Rakefile.rb
11
- lib/**/*.rb
12
- test/**/*_test.rb
13
- #{project}.gemspec
14
- ]]
9
+ #RUBY_VERSIONS = ["3.2", "3.1", "3.0", "2.7", "2.6", "2.5", "2.4", "2.3"]
15
10
 
16
-
17
- require 'rake/clean'
18
- CLEAN << "build"
19
- CLOBBER << Dir.glob("#{project}-*.gem")
20
-
21
-
22
- task :default => :help
23
-
24
-
25
- desc "show help"
26
- task :help do
27
- puts "rake help # help"
28
- puts "rake test # run test"
29
- puts "rake package RELEASE=X.X.X # create gem file"
30
- puts "rake publish RELEASE=X.X.X # upload gem file"
31
- puts "rake clean # remove files"
32
- end
33
-
34
-
35
- desc "do test"
36
- task :test do
37
- sh "ruby", *Dir.glob("test/*.rb")
38
- end
39
-
40
-
41
- desc "create package"
42
- task :package do
43
- release != "0.0.0" or
44
- raise "specify $RELEASE"
45
- ## copy
46
- dir = "build"
47
- rm_rf dir if File.exist?(dir)
48
- mkdir dir
49
- target_files.each do |file|
50
- dest = File.join(dir, File.dirname(file))
51
- mkdir_p dest, :verbose=>false unless File.exist?(dest)
52
- cp file, "#{dir}/#{file}"
53
- end
54
- ## edit
55
- Dir.glob("#{dir}/**/*").each do |file|
56
- next unless File.file?(file)
57
- File.open(file, 'rb+') do |f|
58
- s1 = f.read()
59
- s2 = s1
60
- s2 = s2.gsub(/\$Release[:].*?\$/, "$"+"Release: #{release} $")
61
- s2 = s2.gsub(/\$Copyright[:].*?\$/, "$"+"Copyright: #{copyright} $")
62
- s2 = s2.gsub(/\$License[:].*?\$/, "$"+"License: #{license} $")
63
- #
64
- if s1 != s2
65
- f.rewind()
66
- f.truncate(0)
67
- f.write(s2)
68
- end
69
- end
70
- end
71
- ## build
72
- chdir dir do
73
- sh "gem build #{project}.gemspec"
74
- end
75
- mv "#{dir}/#{project}-#{release}.gem", "."
76
- end
77
-
78
-
79
- desc "upload gem file to rubygems.org"
80
- task :publish do
81
- release != "0.0.0" or
82
- raise "specify $RELEASE"
83
- #
84
- gemfile = "#{project}-#{release}.gem"
85
- print "** Are you sure to publish #{gemfile}? [y/N]: "
86
- answer = $stdin.gets().strip()
87
- if answer.downcase == "y"
88
- sh "gem push #{gemfile}"
89
- sh "git tag ruby-#{project}-#{release}"
90
- sh "git push --tags"
91
- end
92
- end
11
+ Dir.glob('./task/*-task.rb').each {|x| require x }
data/benry-cmdopt.gemspec CHANGED
@@ -1,30 +1,32 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |spec|
4
- spec.name = 'benry-cmdopt'
5
- spec.version = '$Release: 1.0.0 $'.split()[1]
6
- spec.author = 'kwatch'
7
- spec.email = 'kwatch@gmail.com'
4
+ spec.name = "benry-cmdopt"
5
+ spec.version = "$Release: 2.0.0 $".split()[1]
6
+ spec.author = "kwatch"
7
+ spec.email = "kwatch@gmail.com"
8
8
  spec.platform = Gem::Platform::RUBY
9
- spec.homepage = 'https://github.com/kwatch/benry/tree/ruby/benry-cmdopt'
10
- spec.summary = "Command option parser, like `optparse.rb`"
11
- spec.description = <<-'END'
12
- Command option parser, like `optparse.rb`.
9
+ spec.homepage = "https://kwatch.github.io/benry-ruby/benry-cmdopt.html"
10
+ spec.summary = "Command option parser, much better than `optparse.rb`"
11
+ spec.description = <<-"END"
12
+ Command option parser, much simpler and better than `optparse.rb`.
13
+
14
+ Why not `optparse.rb`? See #{spec.homepage}#why-not-optparserb for details.
13
15
  END
14
- spec.license = 'MIT'
16
+ spec.license = "MIT"
15
17
  spec.files = Dir[
16
- 'README.md', 'CHANGES.md', 'MIT-LICENSE',
17
- 'Rakefile.rb', 'benry-cmdopt.gemspec',
18
- 'bin/*',
19
- 'lib/**/*.rb',
20
- 'test/**/*.rb',
18
+ "README.md", "MIT-LICENSE", "CHANGES.md",
19
+ "Rakefile.rb", "#{spec.name}.gemspec",
20
+ "lib/**/*.rb", "test/**/*.rb", "task/**/*.rb",
21
+ #"bin/*", "examples/**/*",
22
+ "doc/*.html", "doc/css/*",
21
23
  ]
22
- #spec.executables = ['benry-cmdopt']
23
- spec.bindir = 'bin'
24
- spec.require_path = 'lib'
25
- spec.test_files = Dir['test/**/*_test.rb']
26
- #spec.extra_rdoc_files = ['README.md', 'CHANGES.md']
24
+ #spec.executables = []
25
+ spec.bindir = "bin"
26
+ spec.require_path = "lib"
27
+ spec.test_files = Dir["test/**/*_test.rb"] # or: ["test/run_all.rb"]
28
+ #spec.extra_rdoc_files = ["README.md", "CHANGES.md"]
27
29
 
28
- spec.add_development_dependency 'minitest' , '~> 5.8'
29
- spec.add_development_dependency 'minitest-ok' , '~> 0.3'
30
+ spec.required_ruby_version = ">= 2.3"
31
+ spec.add_development_dependency "oktest" , "~> 1"
30
32
  end