bun_bo 0.1.1 → 0.1.2

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: 5314115d40dd740496d02750b9ecba0d5c86193c1a44af593080e1c533286574
4
- data.tar.gz: 7d6fb67324ee7d783fb6d53f2e82dbc3130394dad6cf13c1f7c6359f22240f30
3
+ metadata.gz: e2515c4ea90ea2a3f96d7108c50a03a6251f9056a8662aaacfef32a1084929b7
4
+ data.tar.gz: 301210b6fd6b07d67c01ef9d5408ee94821d35a0620ab6c05dcd3d1c6c4b5892
5
5
  SHA512:
6
- metadata.gz: a57740e2fe09d2a49588c22ce572ef894fcc9f8875363a4b233e805b06e0710ad6c4ac0b185bbf85b79d1fe9784cd22ded4c9203f3da5da0d56b3bba7488aa27
7
- data.tar.gz: 22da0a3ee8c34a0104e9515d9f62117d3ab69568d40c107231ea5d6d36135be43148534aef73b5b48ff5d380dca44c9bbe4f63a33359da9e79fce46599260b4d
6
+ metadata.gz: 7bd0dd8efeaf3b540163deb31981d5b7fc6608d652754542b23f83eaf02e6bee45a174d3a238b19c3fe96e41d8e20a563d85e72204bd2ca99baea19508e7d81d
7
+ data.tar.gz: fd710a8fd238c329c40dceba4838466105f78245d816c97eef5e0b339fc6ed05e7f09ec3e72e225c3b523c4ded0c180c1c5b9be20b0f6c1ee1ebac636ba1730b
data/exe/bun_bo CHANGED
@@ -3,7 +3,5 @@
3
3
  require "bundler/setup"
4
4
  require "bun_bo"
5
5
 
6
- require 'fileutils'
7
-
8
6
  input_path = ARGV.first
9
7
  BunBo.new.run(input_path)
data/lib/bun_bo.rb CHANGED
@@ -1,17 +1,20 @@
1
1
  require "bun_bo/version"
2
+ require 'fileutils'
2
3
 
3
4
  class BunBo
4
5
  def run(input_path)
5
- if File.file?(input_path)
6
- folder_path, file_name = File.split(input_path)
7
- extension = File.extname(file_name)
8
- base_name = File.basename(file_name, extension)
6
+ input_path = Pathname.new(input_path)
9
7
 
10
- test_folder = File.join('spec', folder_path)
11
- test_path = File.join(test_folder, "#{base_name}_spec#{extension}")
8
+ if input_path.file?
9
+ folder_path, file_name = input_path.split
10
+ extension = file_name.extname
11
+ base_name = file_name.basename(extension)
12
+
13
+ test_folder = folder_path.sub(/^(app|lib)/, 'spec')
14
+ test_path = test_folder.join("#{base_name}_spec").sub_ext(".rb")
12
15
 
13
16
  FileUtils.mkdir_p(test_folder)
14
- File.write(test_path, '')
17
+ test_path.write('')
15
18
  else
16
19
  puts "File does not exists"
17
20
  end
@@ -1,3 +1,3 @@
1
1
  class BunBo
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bun_bo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hieu Nguyen