codeshift 0.1.3 → 0.1.4

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: 3b5b1f7425f32b67e65b8ce7b0b2e22061495570b95600d8c6114b8a86ebbedd
4
- data.tar.gz: 055d30acead1d71b2af0c0e9895adcf2cc64c13e600548b713bd108831fb3b23
3
+ metadata.gz: e9bec08f9af71588e83552ba7820875ff85f89c9582250ac093d2945c765599d
4
+ data.tar.gz: 979cd551ab1884d24a7234d3a8a053a631dfee729cea3ccb6f9d994263824752
5
5
  SHA512:
6
- metadata.gz: 77e1cdb4e9a99b634acbe0feeb5f6286ae439ed401f0df13a234f628def50a03900bd4eabb644fd879451b67fa1466cd3dd8520aedeb55aa57601ec12f9bb848
7
- data.tar.gz: 847fd2a32bb79bcefdc3df64c5d0c1914f368ebe72ccf13f51f840d347bea43aa9decbe1e048330894d424e50c8fb0dbe37c7d57578696676ec08ba9f5f5b0ff
6
+ metadata.gz: 3a8499b6af79b25c065586ea257740652f766e22b58c0e8962a9f18414e0eee2d554aa6455303043f2bc17ff6e4e95363f62baf056f95c05ed4817e3e8c3bef3
7
+ data.tar.gz: d66ba6b9f7aded016d2238f0feb5ce570f3f57ba7d9953763e12520430ac64fcae573cb9fedd17b3823e17587828cd56843313c309cda8ca0c306be4b69dc739
data/lib/codeshift/cli.rb CHANGED
@@ -2,6 +2,7 @@ require 'optparse'
2
2
  require 'codeshift/codeshift_options'
3
3
  require 'codeshift/codeshift_transformer'
4
4
  require 'codeshift/version'
5
+ require 'open-uri'
5
6
 
6
7
  module CodeShift
7
8
  class CLI
@@ -30,17 +31,22 @@ module CodeShift
30
31
  end
31
32
 
32
33
  def run
33
- puts "Codeshift =>"
34
- #puts paths
35
- #puts @options.transform
36
34
  paths = @files.length > 0 ? @files : []
37
35
  paths.each do |path|
38
- Dir.glob(path) do |file_path|
39
- puts "Processing: #{file_path}"
40
- code = File.read(file_path)
41
- transform = File.read(@options.transform)
36
+ if File.directory?(path)
37
+ Dir.glob(path) do |file_path|
38
+ puts "Processing: #{file_path}"
39
+ code = File.read(file_path)
40
+ transform = open(@options.transform) { |f| f.read }
41
+ output = Codeshift::CodeshiftTransformer.new(code, transform).transform
42
+ File.write(file_path, output)
43
+ end
44
+ else
45
+ puts "Processing: #{path}"
46
+ code = File.read(path)
47
+ transform = open(@options.transform) { |f| f.read }
42
48
  output = Codeshift::CodeshiftTransformer.new(code, transform).transform
43
- File.write(file_path, output)
49
+ File.write(path, output)
44
50
  end
45
51
  end
46
52
  end
@@ -1,3 +1,3 @@
1
1
  module Codeshift
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeshift
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajasegar Chandran
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-27 00:00:00.000000000 Z
11
+ date: 2019-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler