codeshift 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: 79ac8e019aba3f98b8fc70579fc6157e42bb3b5216e6e89e49ffc76afa7add43
4
- data.tar.gz: a725766cef32fd63569c14fd15b95d6f496f65e97d4573f4bd5bc4644f6926f6
3
+ metadata.gz: 6af6f02701bdb6430dd72cfc5dbd43b0e0e16c7382905d0c951c13366d60acde
4
+ data.tar.gz: 500607afbfeea607ca65d5c95eb3030c6a37adbf8bb22092a6e06ce6a68b1d63
5
5
  SHA512:
6
- metadata.gz: a61da5d476616ee9d1f0a49f900ea1e4664699cc90b9235574880d711bb8927ee7a1a4d08eac3b9e067bcfdfddf12dfae830a205a5a5c6c5319c6227c6182311
7
- data.tar.gz: f3241f8f6579c94bb1f9f2a60f8754dc40fc3d0783a6c70fedf4a0a38f493bdcafeac5200eaa57faa69129f463068721d916c2f481c3529b0128d2d9a2f59875
6
+ metadata.gz: 8e0613d86f951f5c664f9fa092b6c1f7c5a49e05fbe5b8c0aa58f1f67a1a10fd6df80359b94db2ecb293c601d467586b8c862d998d3f08749cf33e0bc171d4af
7
+ data.tar.gz: 43593a3b6f35c47ba04c810ce86124723d18500c0b4b60644996bc6800361415ad7feecf785989e4e395e88a48db62b046fe1fb0d4c8db5d2c59abd6eb9a3bcf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codeshift (0.1.0)
4
+ codeshift (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/codeshift/cli.rb CHANGED
@@ -1,8 +1,12 @@
1
1
  require 'optparse'
2
+ require 'codeshift/codeshift_options'
3
+ require 'codeshift/codeshift_transformer'
4
+ require 'codeshift/version'
2
5
 
3
6
  module CodeShift
4
7
  class CLI
5
8
  def initialize
9
+ @options = Codeshift::CodeshiftOptions.new
6
10
  OptionParser.new do |opts|
7
11
  opts.banner = "Usage: codeshift -t <transform-file> [path]"
8
12
 
@@ -10,11 +14,35 @@ module CodeShift
10
14
  puts Codeshift::VERSION
11
15
  exit
12
16
  end
13
- end
17
+
18
+ opts.on("-tTRANSFORM", "--transform=TRANSFORM", "path to the transform file. Can be either a local path or url\n (default: ./transform.rb)") do |f|
19
+
20
+ @options.transform = f
21
+ end
22
+
23
+ opts.on("-h", "--help", "Prints this help") do
24
+ puts opts
25
+ exit
26
+ end
27
+ end.parse!
28
+
29
+ @files = ARGV
14
30
  end
15
31
 
16
32
  def run
17
- puts "hello world"
33
+ puts "Codeshift =>"
34
+ #puts paths
35
+ #puts @options.transform
36
+ paths = @files.length > 0 ? @files : []
37
+ 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)
42
+ output = Codeshift::CodeshiftTransformer.new(code, transform).transform
43
+ File.write(file_path, output)
44
+ end
45
+ end
18
46
  end
19
47
  end
20
48
  end
@@ -1,3 +1,3 @@
1
1
  module Codeshift
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: codeshift
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
  - Rajasegar Chandran