rexer 0.11.0 → 0.11.1

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: 86612492af231c5ed6d00b8fe44c305a62013b2aeb3571bbb70c4d53e8ed6b30
4
- data.tar.gz: 1cf5c21eb32b9a30829c1dcc9b823902dd9a560190a44ae9976288f4c340e5f3
3
+ metadata.gz: b367d481c9b2b2c3acee47b4070f5f65b014c0de97841b556d40edf1ca5626c7
4
+ data.tar.gz: fce6d233a643fa0779e03a11f2a37de8781bcb1bfbaf44a7d33a85103d5033fb
5
5
  SHA512:
6
- metadata.gz: da47f60be431db339d94dbaa944b4732495cc2f29088413826a3828c03c6e140fa438c967f38ed68881058f89d2caff0c3751adf569c9110579e508c29016135
7
- data.tar.gz: 4c48a3ebffb2341d93adde02983cb9019587e00f0be83060f57237967c07fa955a94e2ba34a129392d33be3bc862b557586b931dc02ad4e74135556f17dc239c
6
+ metadata.gz: c2577989d226043cdf48d55f4ef3ecfdfc02b030723ec449a5d27d78501a6ade52dee4bd61ddcc0fba67e1e741167bac698cde9333cd985e34196a8891791b67
7
+ data.tar.gz: f5c069c050a4dc5f260c3949af7d5db1cdb47136bf4f19848d0c70302a4a96565303a260e43c066218e051c5040f862d8932ef29b5f7a8470553bece488e0900
data/README.md CHANGED
@@ -204,6 +204,25 @@ In the above case, the `bin/rails redmine:plugins:migrate` command is executed a
204
204
 
205
205
  ## Developing
206
206
 
207
+ ### Running the command
208
+
209
+ You can run the command in your local environment without installing the gem as follows.
210
+
211
+ Setting up the development environment.
212
+
213
+ ```
214
+ $ git clone <this repository>
215
+ $ cd rexer
216
+ $ bundle install
217
+ ```
218
+
219
+ Running the command.
220
+
221
+ ```
222
+ $ cd /path/to/your-local-redmine-source
223
+ $ /your-local-rexer-source/bin/dev state
224
+ ```
225
+
207
226
  ### Running tests
208
227
 
209
228
  First, you need to build the docker image for the integration tests.
@@ -233,6 +252,36 @@ rake standard
233
252
  rake standard:fix
234
253
  ```
235
254
 
255
+ ### Profiling
256
+
257
+ Print the call-stack profile.
258
+
259
+ ```
260
+ $ PROFILE=s /your-local-rexer-source/bin/dev state
261
+ ...
262
+
263
+ == Profile ==
264
+ ==================================
265
+ Mode: wall(1000)
266
+ Samples: 298 (1.97% miss rate)
267
+ GC: 36 (12.08%)
268
+ ==================================
269
+ TOTAL (pct) SAMPLES (pct) FRAME
270
+ 261 (87.6%) 147 (49.3%) Kernel#require
271
+ ...
272
+ ```
273
+
274
+ Print the benchmark.
275
+
276
+ ```
277
+ $ PROFILE=b /your-local-rexer-source/bin/dev state
278
+ ...
279
+
280
+ == Benchmark ==
281
+ user system total real
282
+ 0.253115 0.030599 0.283714 ( 0.283681)
283
+ ```
284
+
236
285
  ## Contributing
237
286
 
238
287
  Bug reports and pull requests are welcome on GitHub at https://github.com/hidakatsuya/rexer.
data/bin/dev CHANGED
@@ -2,4 +2,39 @@
2
2
 
3
3
  require_relative "../lib/rexer"
4
4
 
5
- Rexer::Cli.start(ARGV)
5
+ def with_profiling(profile = false)
6
+ case ENV["PROFILE"]
7
+
8
+ # PROFILE=s dev state
9
+ when "s", "stack"
10
+ require "stackprof"
11
+
12
+ profile = StackProf.run(mode: :wall, interval: 1000) do
13
+ yield
14
+ end
15
+
16
+ puts
17
+ puts "== Profile =="
18
+ StackProf::Report.new(profile).print_text
19
+
20
+ # PROFILE=b dev state
21
+ when "b", "bench"
22
+ require "benchmark"
23
+
24
+ bench = Benchmark.measure do
25
+ yield
26
+ end
27
+
28
+ puts
29
+ puts "== Benchmark =="
30
+ puts Benchmark::CAPTION
31
+ puts bench
32
+
33
+ else
34
+ yield
35
+ end
36
+ end
37
+
38
+ with_profiling(ENV["PROFILE"]) do
39
+ Rexer::Cli.start(ARGV)
40
+ end
@@ -1,5 +1,3 @@
1
- require "paint"
2
-
3
1
  module Rexer
4
2
  module Commands
5
3
  class Init
@@ -63,7 +63,7 @@ module Rexer
63
63
  end
64
64
 
65
65
  def build_source(opts)
66
- type = opts.keys.find { Rexer::Source.const_defined?(_1.capitalize) }
66
+ type = opts.keys.find { Rexer::Source.names.include?(_1) }
67
67
  Source.new(type, opts[type]) if type
68
68
  end
69
69
  end
@@ -1,6 +1,10 @@
1
1
  module Rexer
2
2
  module Source
3
3
  class Base
4
+ def self.inherited(subclass)
5
+ Source.names << subclass.name.split("::").last.downcase.to_sym
6
+ end
7
+
4
8
  # Load the source to the given path.
5
9
  def load(_path)
6
10
  raise "Not implemented"
data/lib/rexer/source.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  module Rexer
2
2
  module Source
3
+ def self.names = @names ||= []
4
+
3
5
  def self.from_definition(source)
4
6
  const_get(source.type.capitalize).new(**source.options)
5
7
  end
data/lib/rexer/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rexer
2
- VERSION = "0.11.0"
2
+ VERSION = "0.11.1"
3
3
  end
data/lib/rexer.rb CHANGED
@@ -32,3 +32,4 @@ require "zeitwerk"
32
32
 
33
33
  loader = Zeitwerk::Loader.for_gem
34
34
  loader.setup
35
+ loader.eager_load
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katsuya Hidaka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-07 00:00:00.000000000 Z
11
+ date: 2024-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor