sscharter 0.2.0 → 0.2.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: ce79b0e7cd394c7481ae58378e26af8c6cd319a7a9dbce5b36d0882cdac69af3
4
- data.tar.gz: baa62e322601453959eaa93b353ee535f2ce56561894438c900694792a116f96
3
+ metadata.gz: d910ec574007b1cb1500a42a871e586666a358e736c211e1191414491f0279e7
4
+ data.tar.gz: eb7888975a5b9d4fdaad36bc5ccd165b17b9ac750937f69d9086f9c44d473dc1
5
5
  SHA512:
6
- metadata.gz: e1cb17ba611908ba3c2ec03d061e8f72e1f90ddcbd21fc7240bf0997b97ee608e0199b5e032084ccb470b2ab2aeecd9da89e1ef27caa85cd247349cc61964e16
7
- data.tar.gz: 59c5e7e375432ba5061807c29bc7a0a3959d4cc5b9b8b2b92bf9686938269b36d0973a881c90b61113ad2beb534a8ddeb88c21017748cb742fb9d93a512a8472
6
+ metadata.gz: 06c443975c5f6d858f052623fa32890e7bc5808c0359d566142fe02e7030c267fcb97a4b4a8159ffcd9192308aac76cf3dc70c1e18be84d989ff2f2c35a39b84
7
+ data.tar.gz: f59447ecfc433ae851969f1a2f4ffb76e9d63c9bb9a5598d2d06114c5912fcee4a4486071c9495c0b666b5813442eb7350638d0f52c78745278d157b32d938fa
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sscharter (0.2.0)
4
+ sscharter (0.2.2)
5
5
  filewatcher (~> 2.0)
6
6
  launchy (~> 2.5)
7
7
  rubyzip (~> 2.3)
@@ -16,7 +16,7 @@ GEM
16
16
  module_methods (~> 0.1.0)
17
17
  launchy (2.5.2)
18
18
  addressable (~> 2.8)
19
- minitest (5.19.0)
19
+ minitest (5.20.0)
20
20
  module_methods (0.1.0)
21
21
  public_suffix (5.0.3)
22
22
  rake (13.0.6)
data/lib/sscharter/cli.rb CHANGED
@@ -179,7 +179,7 @@ module Sunniesnow::Charter::CLI
179
179
  server.mount_proc "/#{config[:project_name]}.ssc" do |request, response|
180
180
  response['Content-Type'] = 'application/zip'
181
181
  response['Access-Control-Allow-Origin'] = '*'
182
- response.body = File.read File.join config[:build_dir], "#{config[:project_name]}.ssc"
182
+ response.body = File.read File.join(config[:build_dir], "#{config[:project_name]}.ssc"), binmode: true
183
183
  end
184
184
  url = CGI.escape "http://localhost:#{port}/#{config[:project_name]}.ssc"
185
185
  filewatcher = Filewatcher.new [config[:files_dir], config[:sources_dir], *config[:include]]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sunniesnow
4
4
  class Charter
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.2"
6
6
  end
7
7
  end
data/lib/sscharter.rb CHANGED
@@ -408,7 +408,6 @@ class Sunniesnow::Charter
408
408
  end
409
409
 
410
410
  def tip_point_chain *args, preserve_beat: true, **opts, &block
411
- raise ArgumentError, 'no block given' unless block
412
411
  tip_point :chain, *args, **opts do
413
412
  group preserve_beat: preserve_beat, &block
414
413
  end.tap { @current_tip_point += 1 }
@@ -416,7 +415,6 @@ class Sunniesnow::Charter
416
415
  alias tp_chain tip_point_chain
417
416
 
418
417
  def tip_point_drop *args, preserve_beat: true, **opts, &block
419
- raise ArgumentError, 'no block given' unless block
420
418
  tip_point :drop, *args, **opts do
421
419
  group preserve_beat: preserve_beat, &block
422
420
  end
@@ -426,9 +424,17 @@ class Sunniesnow::Charter
426
424
  def group preserve_beat: true, &block
427
425
  raise ArgumentError, 'no block given' unless block
428
426
  @groups.push result = []
429
- last_beat = @current_beat
427
+ unless preserve_beat
428
+ last_beat = @current_beat
429
+ last_offset = @current_offset
430
+ last_bpm_changes = @bpm_changes
431
+ end
430
432
  instance_eval &block
431
- beat! last_beat unless preserve_beat
433
+ unless preserve_beat
434
+ @current_beat = last_beat
435
+ @current_offset = last_offset
436
+ @bpm_changes = last_bpm_changes
437
+ end
432
438
  @groups.delete_if { result.equal? _1 }
433
439
  result
434
440
  end
@@ -530,6 +536,7 @@ class Sunniesnow::Charter
530
536
  end
531
537
  if direction.is_a? Symbol
532
538
  direction = DIRECTIONS[direction]
539
+ raise ArgumentError, "unknown direction #{direction}" unless direction
533
540
  elsif direction.is_a? Numeric
534
541
  warn 'Are you using degrees as angle unit instead of radians?' if direction != 0 && direction % 45 == 0
535
542
  direction = direction.to_f
@@ -554,11 +561,23 @@ class Sunniesnow::Charter
554
561
  end
555
562
 
556
563
  def big_text duration_beats = 0, text
564
+ unless duration_beats.is_a? Numeric
565
+ raise ArgumentError, 'duration_beats must be a number'
566
+ end
567
+ if duration_beats < 0
568
+ raise ArgumentError, 'duration must be non-negative'
569
+ end
570
+ if duration_beats.is_a? Float
571
+ warn 'Rational is recommended over Float for duration_beats'
572
+ end
557
573
  event :big_text, duration_beats.to_r, text: text.to_s
558
574
  end
559
575
 
560
576
  %i[grid hexagon checkerboard diamond_grid pentagon turntable].each do |method_name|
561
577
  define_method method_name do |duration_beats = 0|
578
+ unless duration_beats.is_a? Numeric
579
+ raise ArgumentError, 'duration_beats must be a number'
580
+ end
562
581
  if duration_beats < 0
563
582
  raise ArgumentError, 'duration must be non-negative'
564
583
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sscharter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ulysses Zhan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-31 00:00:00.000000000 Z
11
+ date: 2023-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip