xot 0.1.14 → 0.1.21

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: ab59b087ca48e4e990ea9682756028862bbc02b98807acc71f2662e040c28a88
4
- data.tar.gz: be1ad1d429076759e7c78f52254d3c386f081aabb5075978e88c17b59d793bc0
3
+ metadata.gz: f77c894412ab67f7e6b9859e907eedf0f391335c90e82ec8010f166d7dfb844f
4
+ data.tar.gz: 26308967ff7d5b66b73066867b0eec0a7f688d7992802ebc62f636e48b5ecb5e
5
5
  SHA512:
6
- metadata.gz: cc3804e39fe3ed248d935ce6b588b13fe4ed46b41230a5595198abe6035a80eca9e632b1afa948f60a922b59df866cad7847417bc773476e2884009ca06d7923
7
- data.tar.gz: f09aeaece1cee31ff9a3ae4271f0b9a40d683437415520ad57b223af470c9b5de74beba79abfddf1827cde3bd62a62d9c0c3f54bde3cc728e78b821544e98482
6
+ metadata.gz: 394093cf97d126818caf660c7cfbe73f3d61808773ce292285276804f5c29b60e7891f6bf93465c74cb921ce91dd049116bf860fd96a26c05cee48e689e231f2
7
+ data.tar.gz: 4b624853ee62ab0f6b7a606535d8606d087eb049d4cdc38c8e418e78f5c36f98f0be08e2b80705ad5fdd2111c2f5a0ee3d7aaa5294cbb88ffd1823a4c4751d38
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.14
1
+ 0.1.21
@@ -54,9 +54,6 @@ namespace Xot
54
54
  }// Types
55
55
 
56
56
 
57
- enum {UNKNOWN = 0};
58
-
59
-
60
57
  using namespace Types;
61
58
 
62
59
 
@@ -46,17 +46,29 @@ namespace Xot
46
46
  namespace ErrorFunctions
47
47
  {
48
48
 
49
- void xot_error (const char* file, int line, const char* format = NULL, ...);
49
+ [[noreturn]]
50
+ void xot_error (
51
+ const char* file, int line, const char* format = NULL, ...);
50
52
 
51
- void argument_error (const char* file, int line, const char* format = NULL, ...);
53
+ [[noreturn]]
54
+ void argument_error (
55
+ const char* file, int line, const char* format = NULL, ...);
52
56
 
53
- void index_error (const char* file, int line, const char* format = NULL, ...);
57
+ [[noreturn]]
58
+ void index_error (
59
+ const char* file, int line, const char* format = NULL, ...);
54
60
 
55
- void invalid_state_error (const char* file, int line, const char* format = NULL, ...);
61
+ [[noreturn]]
62
+ void invalid_state_error (
63
+ const char* file, int line, const char* format = NULL, ...);
56
64
 
57
- void system_error (const char* file, int line, const char* format = NULL, ...);
65
+ [[noreturn]]
66
+ void system_error (
67
+ const char* file, int line, const char* format = NULL, ...);
58
68
 
59
- void not_implemented_error (const char* file, int line, const char* format = NULL, ...);
69
+ [[noreturn]]
70
+ void not_implemented_error (
71
+ const char* file, int line, const char* format = NULL, ...);
60
72
 
61
73
  }// ErrorFunctions
62
74
 
@@ -175,7 +175,7 @@ module Xot
175
175
  namespace :test do
176
176
  ::Rake::TestTask.new :full do |t|
177
177
  t.libs << lib_dir
178
- t.test_files = FileList["#{test_dir}/test_*.rb"] - test_alones - test_excludes
178
+ t.test_files = FileList["#{test_dir}/**/test_*.rb"] - test_alones - test_excludes
179
179
  t.verbose = true
180
180
  end
181
181
 
@@ -10,6 +10,7 @@ module Xot
10
10
 
11
11
  module Rake
12
12
 
13
+ VERSION_NAME = 'VERSION'
13
14
 
14
15
  def modules ()
15
16
  env(:MODULES, []).map {|m| m::Module}
@@ -83,6 +84,60 @@ module Xot
83
84
  paths
84
85
  end
85
86
 
87
+ def filter_file (path, &block)
88
+ File.write path, block.call(File.read path)
89
+ end
90
+
91
+ def cd_sh (dir, cmd)
92
+ Dir.chdir dir do
93
+ $stderr.puts "(in #{Dir.pwd})"
94
+ sh cmd
95
+ end
96
+ end
97
+
98
+ def modified_files (dir: '.', hash: '@')
99
+ `git diff --name-only #{hash} -- #{dir}`.lines.map &:chomp
100
+ end
101
+
102
+ def version_path (dir = nil)
103
+ dir ? "#{dir}/#{VERSION_NAME}" : VERSION_NAME
104
+ end
105
+
106
+ def get_version (dir = nil)
107
+ File.readlines(version_path dir).first.chomp
108
+ end
109
+
110
+ def bump_version (index, version = get_version)
111
+ nums = version.split('.').map &:to_i
112
+ nums << 0 until nums.size > index
113
+ nums[index] += 1
114
+ nums.map!.with_index {|num, i| i > index ? 0 : num}
115
+ nums.pop while nums.last == 0 && nums.size >= 3
116
+ nums.join '.'
117
+ end
118
+
119
+ def bump_version_file (index, dir: nil)
120
+ newver = bump_version index, get_version(dir)
121
+ File.write version_path(dir), newver
122
+ newver
123
+ end
124
+
125
+ def update_and_tag_version (index, dir: nil, &block)
126
+ raise 'modified files exist' unless modified_files.empty?
127
+
128
+ message = ENV['message']
129
+ raise 'no message' unless message
130
+
131
+ newver = bump_version_file index, dir: dir
132
+ raise 'version is not updated' unless modified_files == [version_path(dir)]
133
+
134
+ block.call if block
135
+
136
+ sh %( git add -u )
137
+ sh %( git commit -m "#{message}" )
138
+ sh %( git tag -a -m "#{message}" v#{newver} )
139
+ end
140
+
86
141
  def compile_erb (path, out)
87
142
  open(path) do |input|
88
143
  open(out, 'w') do |output|
@@ -165,8 +220,13 @@ module Xot
165
220
  end
166
221
 
167
222
  def make_cflags (flags = '')
223
+ warning_opts = %w[
224
+ no-unknown-pragmas
225
+ no-deprecated-register
226
+ no-reserved-user-defined-literal
227
+ ]
168
228
  s = flags.dup
169
- s << ' -Wno-unknown-pragmas -Wno-reserved-user-defined-literal'
229
+ s << warning_opts.map {|s| " -W#{s}"}.join
170
230
  s << ' -std=c++11' if gcc?
171
231
  s << ' -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7' if clang?
172
232
  s << ' ' + RbConfig::CONFIG['debugflags'] if debug?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-23 00:00:00.000000000 Z
11
+ date: 2020-12-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This library include some useful utility classes and functions for development
14
14
  with C++.
@@ -72,7 +72,7 @@ files:
72
72
  homepage: https://github.com/xord/xot
73
73
  licenses: []
74
74
  metadata: {}
75
- post_install_message:
75
+ post_install_message:
76
76
  rdoc_options: []
77
77
  require_paths:
78
78
  - lib
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubygems_version: 3.0.3
91
- signing_key:
91
+ signing_key:
92
92
  specification_version: 4
93
93
  summary: A Utility library for C++ developemt.
94
94
  test_files: