aro 0.1.4 → 0.1.6

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: a276927c911f1781041e6d5c274c1611f0a23a948edb9b0fb6bc17518d22eee5
4
- data.tar.gz: 415a4ad29297c5c8815127fb4bae7c5dc97f4f8eb12cda4aacf2235997cb895e
3
+ metadata.gz: 2d38dfc3076510642fc060178b2de03eb366c527ac6e88c2bfeb746f85b0e6b9
4
+ data.tar.gz: c58bdbb118b84d1bd05709cf19942cf7ac69c1ab66cbdb91b916fe42fb7b0ab0
5
5
  SHA512:
6
- metadata.gz: a91cb814964c27d4aa6c53aea311dc530ecd897d4534f19b3295ad8954c7611268102b8113dc4ecaea52d23fb975dbf890bcfbcfc575727741c497942f3ea36f
7
- data.tar.gz: b8270db12a879b8738d014f748929641d234234f61cbba5cc351907319d5616bfef2ae1f58616827930673703258841c2ee6c70d732ab247ae87941cf1bf0073
6
+ metadata.gz: 4cf670b3a0bfefd708c9a6286218a4474394eb10b9669e359f3eec157052e0f6762a88e9f93ee31299bea09f9d0a41e51dbbf5019e42f1870ece83093dad00fe
7
+ data.tar.gz: 9ca02e7c6b8f772ae6ff92b4f392c32c4d8fa830611af35d8ddd3b1b455536d2b1af37e4ea4ed2a1e3ab1f0ec49d930b30a3e2c0c1f1498e841feb05ead09549
data/.release CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # 1) update version and release notes (manually)
6
6
  # 2) test and build
7
- # $ rake make
7
+ # $ rake make && gem build
8
8
  # 3) build checksum
9
9
  # $ rake build:checksum
10
10
  # 4) create a commit
@@ -12,9 +12,9 @@
12
12
  # tag message format:
13
13
  # vx.x.x
14
14
  # <release_note_text>
15
- # $ gitaga vx.x.x && gush tag vx.x.x
15
+ # $ gitaga vx.x.x && gutaga vx.x.x
16
16
  # 6) push develop
17
17
  # 7) pull request develop -> master & merge
18
18
  # 8) checkout and pull master
19
- # 9) publish to rubygems
19
+ # 9) publish to rubygems (warning, must version up after this)
20
20
  # $ gem push pkg/aro-x.x.x.gem
data/aro.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = "https://github.com/i2097i/aro"
13
13
  spec.license = "MIT"
14
14
 
15
- spec.files = `git ls-files`.split("\n").reject{|f| f.match(%r{^(spec)/})}
15
+ spec.files = `git ls-files`.split("\n").reject{|f| f.match(%r{^(spec|pkg)/})}
16
16
  spec.bindir = "bin"
17
17
  spec.executables = ["aro"]
18
18
  spec.require_paths = ["lib", "bin/cli"]
data/bin/cli/config.rb CHANGED
@@ -53,7 +53,7 @@ module CLI
53
53
  description: I18n.t("cli.config.type_values_description"),
54
54
  validator: Proc.new{|unvalid, deff, key|
55
55
  CLI::Config.def_valid?(deff, key) &&
56
- deff[:possible_values].keys.include?(unvalid.to_sym)
56
+ deff[:possible_values].keys.include?(unvalid&.to_sym)
57
57
  }
58
58
  },
59
59
  }
@@ -197,11 +197,19 @@ module CLI
197
197
  end
198
198
 
199
199
  def source_config
200
- invalid_defs = validate_config
201
200
  Aro::P.say(I18n.t("cli.config.sourcing_config", name: CLI::Config::CONFIG_FILE_PATH))
202
- system("source #{CLI::Config::CONFIG_FILE_PATH}")
201
+ File.read(CLI::Config::CONFIG_FILE_PATH).split("\n").select{|line|
202
+ line.match?("export #{CLI::Config::VAR_PREFIX}")
203
+ }.map{|line|
204
+ line.gsub("export ", "").split("=")
205
+ }.each{|kv|
206
+ ENV[kv[0]] = kv[1]
207
+ }
208
+
209
+ # todo: implement
210
+ # invalid_defs = validate_config
203
211
  CLI::Config::DEF.keys.each{|dfk|
204
- next if invalid_defs.include?(dfk)
212
+ # next if invalid_defs.include?(dfk)
205
213
  Aro::P.say("$#{CLI::Config.var_key_with_suffix(dfk)}=#{CLI::Config.var_value_with_suffix(dfk)}")
206
214
  }
207
215
 
data/bin/cli/deck.rb CHANGED
@@ -39,9 +39,9 @@ module CLI
39
39
  Aro::Mancy.game.shuffle
40
40
  when CLI::LOAD_DECK_ACTIONS[:DRAW]
41
41
  Aro::P.say(I18n.t("cli.messages.drawing", name: Aro::Mancy.game.name))
42
- Aro::P.p.say(I18n.t("cli.messages.drawing_from_dimension", dimension: "#{CLI::Config.var_value_with_suffix(:DIMENSION)}"))
42
+ Aro::P.say(I18n.t("cli.messages.drawing_from_dimension", dimension: "#{CLI::Config.var_value_with_suffix(:DIMENSION)}"))
43
43
  Aro::Mancy.game.draw(
44
- is_dt_dimension: CLI::Config.var_value_with_suffix(:DIMENSION).to_sym == CLI::Config::DMS[:DEV_TAROT],
44
+ is_dt_dimension: CLI::Config.var_value_with_suffix(:DIMENSION)&.to_sym == CLI::Config::DMS[:DEV_TAROT],
45
45
  z_max: CLI::Config.var_value_with_suffix(:Z_MAX).to_i,
46
46
  z: CLI::Config.var_value_with_suffix(:Z)
47
47
  )
@@ -49,7 +49,7 @@ module CLI
49
49
  Aro::P.say(I18n.t("cli.messages.replacing_drawn", name: Aro::Mancy.game.name))
50
50
  Aro::Mancy.game.replace
51
51
  when CLI::LOAD_DECK_ACTIONS[:RESET]
52
- if Aro::AROYES != Aro::P.p.ask(I18n.t("cli.messages.confirmation_prompt", name: Aro::Mancy.game.name))
52
+ if Aro::AROYES.to_s != Aro::P.p.ask(I18n.t("cli.messages.confirmation_prompt", name: Aro::Mancy.game.name))
53
53
  Aro::P.say(I18n.t("cli.messages.understood", name: Aro::Mancy.game.name))
54
54
  exit(CLI::EXIT_CODES[:SUCCESS])
55
55
  end
@@ -1 +1 @@
1
- 5a6af41ca8e0e2eee62a129aca162bc709d5c3ded0c4ec7b6326fa6768d949313f320bd659cf00d5a0056c1adced4898fdd6d9c91c2a79f7d06018cc9cc61ad7
1
+ 5ef49535f30fa0fe1c89b806541f7e3c21f38311281264eb1b848a021f73711d8f3d429a4d26acf95c112c231dc824a391db863fbf79776c7dbd43fc54a1e7bf
@@ -0,0 +1 @@
1
+ 50df50a772a0a3c6d43f6427072c29c1f218b21fadda5029a17ed5ad44e2f06cce05596bf855e6028467f1dbc1932954f008bdddc2c76ddb39dc065980d4b1fb
data/lib/aro/c.rb CHANGED
@@ -3,7 +3,7 @@ module Aro
3
3
  ARO: Proc.new{Aro::IS_TEST.call ? ".aro_test" : ".aro"},
4
4
  }
5
5
 
6
- AROYES = "aroyes"
6
+ AROYES = :aroyes
7
7
 
8
8
  NUMERALS = {
9
9
  O: 0,
data/lib/aro/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Aro
2
- VERSION = :"0.1.4"
3
- RELEASE_NOTES = :"add multiple config variables, add much improved randomness"
2
+ VERSION = :"0.1.6"
3
+ RELEASE_NOTES = :"fix issue with corrupt card data."
4
4
  end
data/lib/aro.rb CHANGED
@@ -16,6 +16,9 @@ module Aro
16
16
 
17
17
  attr_accessor :game
18
18
 
19
+ O = 0
20
+ S = 1
21
+ N = 4
19
22
  OS = 2
20
23
  PS1 = Aro::Mancy.name
21
24
  NAME_FILE = :".name".to_s
data/lib/models/deck.rb CHANGED
@@ -196,7 +196,7 @@ class Aro::Deck < ActiveRecord::Base
196
196
  dt = nil
197
197
  return dt unless File.exist?(Aro::Deck::DEV_TAROT_FILE)
198
198
 
199
- File.open(Aro::Deck::DEV_TAROT_FILE, "r"){|dtf| dt = dtf.read(4)}
199
+ File.open(Aro::Deck::DEV_TAROT_FILE, "r"){|dtf| dt = dtf.read(Aro::Mancy::N)}
200
200
 
201
201
  # VERY IMPORTANT!
202
202
  Aro::P.say(I18n.t("cli.very_important", dev_tarot: dt))
@@ -244,31 +244,38 @@ class Aro::Deck < ActiveRecord::Base
244
244
  # get drawn
245
245
  drawn_arr = drawn&.split(Aro::Deck::CARD_DELIM) || []
246
246
 
247
- # use fallback randomness if /dev/tarot unavailable
248
- if !is_dt_dimension || !File.exist?(Aro::Deck::DEV_TAROT_FILE)
249
- dev_tarot = summon_ruby_facot(cards_arr)
250
- abs_dev_tarot = Aro::Deck.card_strip(dev_tarot)
251
- end
252
-
253
247
  sleeps = 0
254
248
  sleeps_max = z_max
255
249
 
256
250
  # find a card that is not already drawn
257
251
  while sleeps <= sleeps_max && dev_tarot.nil? do
258
- # preferred randomness
259
- dev_tarot = Aro::Deck.read_dev_tarot&.strip&.split("")
260
- if dev_tarot.present?
261
- abs_dev_tarot = dev_tarot[1] + Aro::NUMERALS.key(
262
- dev_tarot.select{|c| !dev_tarot.first(2).include?(c)}.join("").to_i
252
+ # use fallback randomness if /dev/tarot unavailable
253
+ if !is_dt_dimension || !File.exist?(Aro::Deck::DEV_TAROT_FILE)
254
+ dev_tarot = summon_ruby_facot(cards_arr).split("")
255
+ else
256
+ # preferred randomness
257
+ read_value = Aro::Deck.read_dev_tarot&.strip&.split("")
258
+ if read_value.count >= Aro::Mancy::N - 1
259
+ dev_tarot = read_value
260
+ end
261
+ end
262
+
263
+ unless dev_tarot.nil?
264
+ abs_dev_tarot = dev_tarot[Aro::Mancy::S] + Aro::NUMERALS.key(
265
+ dev_tarot.join("")[Aro::Mancy::OS..].to_i
263
266
  ).to_s
264
267
  if abs_cards_arr.include?(abs_dev_tarot)
265
268
  # dev_tarot is valid
266
- dev_tarot = dev_tarot[0] + abs_dev_tarot
269
+ dev_tarot = dev_tarot[Aro::Mancy::O] + abs_dev_tarot
270
+ else
271
+ dev_tarot = nil
267
272
  end
268
- else
273
+ end
274
+
275
+ if dev_tarot.nil?
269
276
  # dev_tarot is invalid
270
277
  sleeps += 1
271
- sleep(z)
278
+ sleep(z.to_i)
272
279
  end
273
280
  end
274
281
 
data/locale/en.usage.yml CHANGED
@@ -28,7 +28,7 @@ en:
28
28
  $ aro create <name>
29
29
 
30
30
  config
31
- manage your aro config - not yet implemented
31
+ todo: manage your aro config - not yet implemented
32
32
 
33
33
  deck
34
34
  perform operations on the deck(s) in current aro instance
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - i2097i
@@ -174,6 +174,7 @@ files:
174
174
  - bin/cli/deck.rb
175
175
  - bin/cli/usage.rb
176
176
  - checksums/aro-0.1.4.gem.sha512
177
+ - checksums/aro-0.1.5.gem.sha512
177
178
  - db/migrate/1763374647_create_decks.rb
178
179
  - db/migrate/1763432541_create_logs.rb
179
180
  - lib/aro.rb
@@ -189,11 +190,6 @@ files:
189
190
  - locale/en.cards.yml
190
191
  - locale/en.usage.yml
191
192
  - locale/en.yml
192
- - pkg/aro-0.1.0.gem
193
- - pkg/aro-0.1.1.gem
194
- - pkg/aro-0.1.2.gem
195
- - pkg/aro-0.1.3.gem
196
- - pkg/aro-0.1.4.gem
197
193
  - tasks/console.rake
198
194
  - tasks/make.rake
199
195
  homepage: https://github.com/i2097i/aro
data/pkg/aro-0.1.0.gem DELETED
Binary file
data/pkg/aro-0.1.1.gem DELETED
Binary file
data/pkg/aro-0.1.2.gem DELETED
Binary file
data/pkg/aro-0.1.3.gem DELETED
Binary file
data/pkg/aro-0.1.4.gem DELETED
Binary file