bgem 0.0.8 → 0.0.9

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bgem.rb +4 -24
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f58220570f36a054b4389676b2fc0e1e234e74f4
4
- data.tar.gz: 499f65c4d8c68f3ba4783bc18228d3338a6d56ab
3
+ metadata.gz: 96d672340c2e0219779613ee0f119d5c568b1aea
4
+ data.tar.gz: d9687b5b9e364c51ea83422fd9c44ba95fad9a9a
5
5
  SHA512:
6
- metadata.gz: d5ce15f902ab43ec3dce419e54cd9aece4a2f389408381d5a90ae524a8f43e627f92eba429e049607b4aaca2248b733ce060f2cabe50d6c28e88cf27bc4a6dbd
7
- data.tar.gz: 8a1717e4608a8aa7d47b1ebfd2a8b40662b416c1555f419dcfa0a0ba567f0c288c3aff57e83eded4dd11d0477536a6adc062ebce526ce4d22f03781195c1922b
6
+ metadata.gz: b107053c821883afa1c8af1266e9069bff8d8c74d0761af551403f50fbbdaacbcf77587a9afb7c8522ecc153ba3fcdf3a1a18ac86ca4d9b05382b680243b0a44
7
+ data.tar.gz: a8aa6cca73e13fa4ff93ba59d6e37711feb14436d3392f8c9655e5d141b08ffdf8e1e66131dd618dfd50e6ca6f1c471cf54e591e78556dbee7c3ea9f6b6e99d9
@@ -16,27 +16,12 @@ module Bgem
16
16
  class << self
17
17
  def run config_file = CONFIG_FILE
18
18
  config = Config.new config_file
19
- target = TargetFile.new config.output, config.scope&.reverse
19
+ target = TargetFile.new config.output, config.scope
20
20
  target.write SourceFile.new(config.entry).to_s
21
21
  target
22
22
  end
23
23
  end
24
24
 
25
- module CLI
26
- def self.run
27
- options = parse_argv
28
- target = TargetFile.new *options[:output], options[:scope]
29
- target.write SourceFile.new(*options[:input]).to_s
30
- end
31
-
32
- def self.parse_argv
33
- ARGV.map do |string|
34
- key, _colon, value = string.partition ':'
35
- [key.to_sym, value]
36
- end.to_h
37
- end
38
- end
39
-
40
25
  class Config
41
26
  def initialize config_file
42
27
  @entry, @output, @scope = SOURCE_FILE, 'output.rb', nil
@@ -108,21 +93,16 @@ module Bgem
108
93
  end
109
94
 
110
95
  class TargetFile
111
- def initialize path = 'output.rb', scope = nil
96
+ def initialize path = 'output.rb', scope
112
97
  @path = Pathname path
113
- @scope = case scope
114
- when Array
115
- scope
116
- when String
117
- eval scope
118
- end
98
+ @scope = scope
119
99
  end
120
100
 
121
101
  def write string
122
102
  @path.dirname.mkpath
123
103
 
124
104
  if @scope
125
- @scope.reverse_each do |head_of_constant_definition|
105
+ @scope.each do |head_of_constant_definition|
126
106
  string = "#{head_of_constant_definition}\n#{string.indent INDENT}\nend"
127
107
  end
128
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bgem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoly Chernow