dcm 0.0.9 → 0.0.11

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: dbf6bcb7bd2efaa34c2e3d53788c57162f2c81d33fe843c11fc94bf543c987f0
4
- data.tar.gz: 1990cc9be7ad32ae74d961f853ec500bdbe7f02e2a412a805ab2201bad10a5ff
3
+ metadata.gz: 24fe5532820ef2590dd51fcb42433a4a3972b716ce5f77269653a58d33f93435
4
+ data.tar.gz: 96b84123a8fe6b36916aa1648729373f896712a0a2e6a8b5301854896091c409
5
5
  SHA512:
6
- metadata.gz: 5acfc4e7067d8d1fc4e18bfcf5a597baaf1e9599732c1bdb876eda635ca81d3dbfd7eea0c64923dce36ffb313bc6ca3a4ac495872211ca7e14c5e0d50c397752
7
- data.tar.gz: db4d5ca37d87e0598615dbe97f48d45a419d1bfd9494f94e38d70bbc8f554b284e5974548a2e2c7f54d5e62ceff622547cc74a7f3594a1b062b568b768bf01be
6
+ metadata.gz: 6725d774fdaa8b235463a141a3b3d504d4fbc5b52e77f8dc1f0fd0b5d56388b4381f4dd718f43b7a0c588ae4aeb1d64e816bb4f1c849709274facff262872657
7
+ data.tar.gz: ca12146d598edd1b8264eb19c766416c945e99df79d0ed1c020b68ef64fba92ce738416e9f4e0e05b1ceb6471b27e6e43a1a7244b394b7af6192358a0cbb9e7f
data/lib/cli.rb CHANGED
@@ -18,6 +18,8 @@ module Dcm
18
18
 
19
19
  class CLI < Thor
20
20
 
21
+ ALLOWED_FILTERKEYS = [:swfk_id, :typekey, :devkey]
22
+
21
23
  desc "show FILE", "Show all labels in FILE"
22
24
  option :oneline, type: :boolean, aliases: ["-l"]
23
25
  def show(file=nil)
@@ -40,20 +42,20 @@ module Dcm
40
42
  loop { LabelSelector.choose_from(list) }
41
43
  end
42
44
 
43
- desc "creta2begu ID CODING FILE", "Convert a hierarchical DCM to a flat DCM"
44
- def creta2begu(id, codingpath, file)
45
+ desc "creta2begu FILTER CODING FILE", "Convert a hierarchical DCM to a flat DCM"
46
+ def creta2begu(expr, codingpath, file)
45
47
  list = parse_file(file)
46
48
 
47
- puts Codinginfo.new([id], codingpath)
49
+ puts Codinginfo.new(codingpath, parse_filter(expr))
48
50
  .flatten_list(list)
49
51
  .to_dcm
50
52
  end
51
53
 
52
- desc "begu2creta IDS CODING FILE", "Convert a flat DCM to a hierarchical DCM"
53
- def begu2creta(ids, codingpath, file)
54
+ desc "begu2creta FILTER CODING FILE", "Convert a flat DCM to a hierarchical DCM"
55
+ def begu2creta(expr, codingpath, file)
54
56
  list = parse_file(file)
55
57
 
56
- puts Codinginfo.new(ids.split(","), codingpath)
58
+ puts Codinginfo.new(codingpath, parse_filter(expr))
57
59
  .unflatten_list(list)
58
60
  .to_dcm
59
61
  end
@@ -254,6 +256,18 @@ module Dcm
254
256
  Ecu::LabelList.new([label])
255
257
  end
256
258
 
259
+ def check_filter(expr)
260
+ return if ALLOWED_FILTERKEYS.include?(expr.split(":").first)
261
+
262
+ fail "Unknown filter expression #{expr}. Possible keys are #{ALLOWED_FILTERKEYS.join(", ")}. Use key:value1,value2 syntax."
263
+ end
264
+
265
+ def parse_filter(expr)
266
+ expr
267
+ .split(":")
268
+ .then { { _1.to_sym => _2.split(",") } }
269
+ end
270
+
257
271
  def display_list(list:, detail:, format: :tty)
258
272
  case format
259
273
  when :tty
data/lib/codinginfo.rb CHANGED
@@ -25,8 +25,8 @@ class Codinginfo
25
25
  def to_s = "#{name}=#{value}"
26
26
  def ==(other) = name == other.name
27
27
 
28
- def merge(other)
29
- fail "Cannot merge #{name} with #{other.name}" unless self == other
28
+ def combine(other)
29
+ fail "Cannot combine #{name} with #{other.name}" unless self == other
30
30
 
31
31
  self.class.new \
32
32
  name: name,
@@ -47,7 +47,7 @@ class Codinginfo
47
47
  end
48
48
  end
49
49
 
50
- def initialize(ids, filepath)
50
+ def initialize(filepath, filter)
51
51
  @doc = SimpleXlsxReader.open(filepath)
52
52
  @headers = []
53
53
  @variants = []
@@ -56,11 +56,8 @@ class Codinginfo
56
56
  overview_sheet
57
57
  .rows
58
58
  .each do |row|
59
- parse_headers(row) if @headers.empty?
60
- next if @headers.empty?
61
- next if row[1].nil? || row[3].nil?
62
- next unless ids.any? { row[1].match?(/#{_1}/i) }
63
- next unless row[3].match?(/CVAR/)
59
+ next unless headers_parsed?(row)
60
+ next unless matches_filter?(row, *filter.to_a.first)
64
61
 
65
62
  @variants << Variant.new(@headers, row)
66
63
  end
@@ -88,6 +85,14 @@ class Codinginfo
88
85
  .tap { fail "Cannot find sheet Parameterdefinition" if _1.nil? }
89
86
  end
90
87
 
88
+ def matches_filter?(row, key, values)
89
+ return false unless row[3]
90
+ return false unless row[3].match?(/CVAR/)
91
+ return false unless @headers.include?(key)
92
+
93
+ values.any? { row[@headers.index(key)].match?(/#{_1}/i) }
94
+ end
95
+
91
96
  def variant
92
97
  fail "No variant matching #{id} found!" if @variants.empty?
93
98
  fail "More than one variant matching #{id} found!" if @variants.size > 1
@@ -99,11 +104,11 @@ class Codinginfo
99
104
  Ecu::LabelList.new \
100
105
  list.flat_map { |label|
101
106
  if has_cvar_assignment?(label)
102
- @variants.map { label.with(name: add_cvar_prefix(label, _1)) }
107
+ @variants.map { label.with(name: add_cvar_prefix(label.name, _1)) }
103
108
  else
104
109
  label
105
110
  end
106
- }
111
+ }.uniq
107
112
  end
108
113
 
109
114
  def flatten_list(list)
@@ -124,28 +129,33 @@ class Codinginfo
124
129
  variant.cvars.any? { label.name.match?(_1.label_prefix) }
125
130
  end
126
131
 
127
- def add_cvar_prefix(label, variant)
132
+ def add_cvar_prefix(name, variant)
128
133
  variant
129
134
  .cvars
130
- .find { _1 == @assignments[label.name] }
131
- .then { _1.merge(@assignments[label.name]) }
132
- .then { _1.label_prefix + label.name }
135
+ .find { _1 == @assignments[name] }
136
+ .then { _1.combine(@assignments[name]) }
137
+ .then { _1.label_prefix + name }
133
138
  end
134
139
 
135
140
  def remove_cvar_prefix(name)
136
141
  name.sub(CVAR_PREFIX_REGEXP, "")
137
142
  end
138
143
 
139
- def parse_headers(row)
140
- return unless row[1]&.match?(/SWFK-ID/)
141
- return unless row[1]&.match?(/CVAR_BeguData/)
142
- return unless row[2]&.match?(/Kommentar/)
144
+ def headers_parsed?(row)
145
+ return true if @headers.any?
146
+
147
+ return false unless row[1]&.match?(/SWFK-ID/)
148
+ return false unless row[1]&.match?(/CVAR_BeguData/)
149
+ return false unless row[2]&.match?(/Kommentar/)
143
150
 
144
151
  @headers = row
145
152
  .map(&:chomp)
146
153
  .map(&:lstrip)
147
154
  .map(&:strip)
148
155
  .map { _1.sub(/\n.*/, "") }
149
- .tap { _1[0] = "typestr" }
156
+ .tap { _1[0] = :typestr }
157
+ .tap { _1[1] = :swfk_id }
158
+ .tap { _1[4] = :typekey }
159
+ .tap { _1[6] = :devkey }
150
160
  end
151
161
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dcm
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dcm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Mueller
@@ -70,33 +70,11 @@ description: Provides an wrapper for exporting/importing labels in *.dcm format
70
70
  email:
71
71
  - jonas@tigger.cloud
72
72
  executables:
73
- - bundle
74
- - cucumber
75
- - cucumber-html-formatter
76
73
  - dcm
77
- - gherkin
78
- - gherkin-ruby
79
- - htmldiff
80
- - ldiff
81
- - protoc-gen-ruby
82
- - rpc_server
83
- - rspec
84
- - thor
85
74
  extensions: []
86
75
  extra_rdoc_files: []
87
76
  files:
88
- - bin/bundle
89
- - bin/cucumber
90
- - bin/cucumber-html-formatter
91
77
  - bin/dcm
92
- - bin/gherkin
93
- - bin/gherkin-ruby
94
- - bin/htmldiff
95
- - bin/ldiff
96
- - bin/protoc-gen-ruby
97
- - bin/rpc_server
98
- - bin/rspec
99
- - bin/thor
100
78
  - lib/cli.rb
101
79
  - lib/codinginfo.rb
102
80
  - lib/core_ext.rb
data/bin/bundle DELETED
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'bundle' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "rubygems"
12
-
13
- m = Module.new do
14
- module_function
15
-
16
- def invoked_as_script?
17
- File.expand_path($0) == File.expand_path(__FILE__)
18
- end
19
-
20
- def env_var_version
21
- ENV["BUNDLER_VERSION"]
22
- end
23
-
24
- def cli_arg_version
25
- return unless invoked_as_script? # don't want to hijack other binstubs
26
- return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
- bundler_version = nil
28
- update_index = nil
29
- ARGV.each_with_index do |a, i|
30
- if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
- bundler_version = a
32
- end
33
- next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
- bundler_version = $1
35
- update_index = i
36
- end
37
- bundler_version
38
- end
39
-
40
- def gemfile
41
- gemfile = ENV["BUNDLE_GEMFILE"]
42
- return gemfile if gemfile && !gemfile.empty?
43
-
44
- File.expand_path("../../gems.rb", __FILE__)
45
- end
46
-
47
- def lockfile
48
- lockfile =
49
- case File.basename(gemfile)
50
- when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
- else "#{gemfile}.lock"
52
- end
53
- File.expand_path(lockfile)
54
- end
55
-
56
- def lockfile_version
57
- return unless File.file?(lockfile)
58
- lockfile_contents = File.read(lockfile)
59
- return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
- Regexp.last_match(1)
61
- end
62
-
63
- def bundler_version
64
- @bundler_version ||=
65
- env_var_version || cli_arg_version ||
66
- lockfile_version
67
- end
68
-
69
- def bundler_requirement
70
- return "#{Gem::Requirement.default}.a" unless bundler_version
71
-
72
- bundler_gem_version = Gem::Version.new(bundler_version)
73
-
74
- requirement = bundler_gem_version.approximate_recommendation
75
-
76
- return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77
-
78
- requirement += ".a" if bundler_gem_version.prerelease?
79
-
80
- requirement
81
- end
82
-
83
- def load_bundler!
84
- ENV["BUNDLE_GEMFILE"] ||= gemfile
85
-
86
- activate_bundler
87
- end
88
-
89
- def activate_bundler
90
- gem_error = activation_error_handling do
91
- gem "bundler", bundler_requirement
92
- end
93
- return if gem_error.nil?
94
- require_error = activation_error_handling do
95
- require "bundler/version"
96
- end
97
- return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
- warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
- exit 42
100
- end
101
-
102
- def activation_error_handling
103
- yield
104
- nil
105
- rescue StandardError, LoadError => e
106
- e
107
- end
108
- end
109
-
110
- m.load_bundler!
111
-
112
- if m.invoked_as_script?
113
- load Gem.bin_path("bundler", "bundle")
114
- end
data/bin/cucumber DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'cucumber' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("cucumber", "cucumber")
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'cucumber-html-formatter' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("cucumber-html-formatter", "cucumber-html-formatter")
data/bin/gherkin DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'gherkin' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("cucumber-gherkin", "gherkin")
data/bin/gherkin-ruby DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'gherkin-ruby' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("cucumber-gherkin", "gherkin-ruby")
data/bin/htmldiff DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'htmldiff' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("diff-lcs", "htmldiff")
data/bin/ldiff DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'ldiff' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("diff-lcs", "ldiff")
data/bin/protoc-gen-ruby DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'protoc-gen-ruby' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("protobuf-cucumber", "protoc-gen-ruby")
data/bin/rpc_server DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rpc_server' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("protobuf-cucumber", "rpc_server")
data/bin/rspec DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rspec' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rspec-core", "rspec")
data/bin/thor DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'thor' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("thor", "thor")