cybertron 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +31 -13
- data/lib/cybertron/cli.rb +7 -4
- data/lib/cybertron/generate_command.rb +7 -7
- data/lib/cybertron/version.rb +1 -1
- data/lib/templates/{readme.tt → README.tt} +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6b97b07cec13fe3e9ca75e59db7e0940598fc6d825633e8c908233f445f4574
|
4
|
+
data.tar.gz: 90383889d4fab83d32f6734d5936c4db28659e5099fd96f027c5fd1dc451f521
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9979dd01c76a371273fcc7a2b6b8e12a508af70bbedb0b18a409f07c68a0cc8627925fd6977196e46ff4ea5020e2eb0e13a9ca22afdbc831953b07051fb4d7ce
|
7
|
+
data.tar.gz: 0a261619aa84a1982d59bb12b1f8cef938be233396ad2aca878a128c9013b2e94e85c8d66cf37ba18d07cd6a73899ce7a7f05a29209778f26f5aceb9632d0df0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
# cybertron
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/cybertron.svg)](https://badge.fury.io/rb/cybertron)
|
4
|
+
[![Build Status](https://travis-ci.org/rajasegar/cybertron.svg?branch=master)](https://travis-ci.org/rajasegar/cybertron)
|
5
|
+
![](https://ruby-gem-downloads-badge.herokuapp.com/cybertron?type=total&style=plastic&color=brightgreen&total_label=)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/github/rajasegar/cybertron/badge.svg?branch=master)](https://coveralls.io/github/rajasegar/cybertron?branch=master)
|
7
|
+
|
4
8
|
|
5
9
|
cybertron is a command line tool for generating, testing and publishing
|
6
10
|
[converters](https://github.com/rajasegar/awesome-ruby-ast#converters) aka
|
7
|
-
[Codemods](https://github.com/facebook/codemod) for Ruby.
|
11
|
+
[Codemods](https://github.com/facebook/codemod) for Ruby inspired by [codemod-cli](https://github.com/rwjblue/codemod-cli) for Javascript by [Robert Jackson](https://github.com/rwjblue)
|
8
12
|
|
9
13
|
**INFO**:
|
10
14
|
You can use a tool like [codeshift](https://github.com/rajasegar/codeshift) to run your codemods/transforms against your Ruby codebase.
|
@@ -12,20 +16,10 @@ For writing transforms you can also make use of the [Ruby AST Explorer](https://
|
|
12
16
|
|
13
17
|
## Installation
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
gem 'cybertron'
|
19
|
+
```sh
|
20
|
+
$ gem install cybertron
|
19
21
|
```
|
20
22
|
|
21
|
-
And then execute:
|
22
|
-
|
23
|
-
$ bundle
|
24
|
-
|
25
|
-
Or install it yourself as:
|
26
|
-
|
27
|
-
$ gem install cybertron
|
28
|
-
|
29
23
|
## Usage
|
30
24
|
|
31
25
|
### Create a new codemod project
|
@@ -105,6 +99,30 @@ Rakefile
|
|
105
99
|
```
|
106
100
|
$ cybertron spec
|
107
101
|
```
|
102
|
+
This will run all the specs in the spec folder, by comparing the input and output
|
103
|
+
fixtures against themselves for each and every transform.
|
104
|
+
|
105
|
+
### Finding help or usage instructions
|
106
|
+
To display the help message and usage instructions, just invoke `cybertron`
|
107
|
+
without any arguments
|
108
|
+
|
109
|
+
```sh
|
110
|
+
$ cybertron
|
111
|
+
```
|
112
|
+
|
113
|
+
To display help about any particular command,
|
114
|
+
```sh
|
115
|
+
$ cybertron help <command-name>
|
116
|
+
```
|
117
|
+
|
118
|
+
For example, to know more about the `generate` command:
|
119
|
+
```sh
|
120
|
+
$ cybertron help generate
|
121
|
+
```
|
122
|
+
|
123
|
+
## Other related tools
|
124
|
+
- [ruby-ast-explorer](https://github.com/rajasegar/ruby-ast-explorer)
|
125
|
+
- [codeshift](https://github.com/rajasegar/codeshift)
|
108
126
|
|
109
127
|
## Development
|
110
128
|
|
data/lib/cybertron/cli.rb
CHANGED
@@ -31,10 +31,13 @@ module Cybertron
|
|
31
31
|
puts "Creating new project: #{name}"
|
32
32
|
FileUtils.mkdir_p "#{name}/transforms"
|
33
33
|
FileUtils.mkdir_p "#{name}/spec"
|
34
|
-
template 'rspec.tt', "#{name}/.rspec"
|
35
|
-
template 'spec_helper.tt',
|
36
|
-
|
37
|
-
template '
|
34
|
+
template 'rspec.tt', File.absolute_path("#{name}/.rspec")
|
35
|
+
template 'spec_helper.tt',
|
36
|
+
File.absolute_path("#{name}/spec/spec_helper.rb")
|
37
|
+
template 'Rakefile.tt',
|
38
|
+
File.absolute_path("#{name}/Rakefile")
|
39
|
+
template 'README.tt',
|
40
|
+
File.absolute_path("#{name}/README.md")
|
38
41
|
end
|
39
42
|
|
40
43
|
desc 'generate', 'Generate fixtures and transforms'
|
@@ -26,11 +26,11 @@ module Cybertron
|
|
26
26
|
puts "Creating new transform: #{name}"
|
27
27
|
FileUtils.mkdir_p "transforms/#{name}"
|
28
28
|
FileUtils.mkdir_p "transforms/#{name}/fixtures"
|
29
|
-
template 'transforms/transform.tt', "transforms/#{name}/transform.rb"
|
30
|
-
template 'transforms/spec.tt', "spec/#{name}_spec.rb"
|
31
|
-
template 'transforms/fixture_input.tt', "transforms/#{name}/fixtures/basic_input.rb"
|
32
|
-
template 'transforms/fixture_output.tt', "transforms/#{name}/fixtures/basic_output.rb"
|
33
|
-
template 'transforms/README.tt', "transforms/#{name}/README.md"
|
29
|
+
template 'transforms/transform.tt', File.absolute_path("transforms/#{name}/transform.rb")
|
30
|
+
template 'transforms/spec.tt', File.absolute_path("spec/#{name}_spec.rb")
|
31
|
+
template 'transforms/fixture_input.tt', File.absolute_path("transforms/#{name}/fixtures/basic_input.rb")
|
32
|
+
template 'transforms/fixture_output.tt', File.absolute_path("transforms/#{name}/fixtures/basic_output.rb")
|
33
|
+
template 'transforms/README.tt', File.absolute_path("transforms/#{name}/README.md")
|
34
34
|
end
|
35
35
|
|
36
36
|
desc 'fixture <transform-name> <fixture-name>', 'Generate a new fixture for a transform'
|
@@ -38,8 +38,8 @@ module Cybertron
|
|
38
38
|
@codemod = codemod
|
39
39
|
@name = name
|
40
40
|
puts "Creating new fixture: #{name} for #{codemod}"
|
41
|
-
template 'transforms/fixture_input.tt', "transforms/#{codemod}/fixtures/#{name}_input.rb"
|
42
|
-
template 'transforms/fixture_output.tt', "transforms/#{codemod}/fixtures/#{name}_output.rb"
|
41
|
+
template 'transforms/fixture_input.tt', File.absolute_path("transforms/#{codemod}/fixtures/#{name}_input.rb")
|
42
|
+
template 'transforms/fixture_output.tt', File.absolute_path("transforms/#{codemod}/fixtures/#{name}_output.rb")
|
43
43
|
end
|
44
44
|
|
45
45
|
|
data/lib/cybertron/version.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cybertron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajasegar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -106,8 +106,8 @@ files:
|
|
106
106
|
- lib/cybertron/generate_command.rb
|
107
107
|
- lib/cybertron/options.rb
|
108
108
|
- lib/cybertron/version.rb
|
109
|
+
- lib/templates/README.tt
|
109
110
|
- lib/templates/Rakefile.tt
|
110
|
-
- lib/templates/readme.tt
|
111
111
|
- lib/templates/rspec.tt
|
112
112
|
- lib/templates/spec_helper.tt
|
113
113
|
- lib/templates/transforms/README.tt
|