radon 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: 50b872015bdbf4bcca0695ca47f5d23eb1d80a4e
4
- data.tar.gz: 68565c66bbed27a8e3f32d30b60c22783bb3bff8
3
+ metadata.gz: 240689f1d64ccb2fea62599c74b70be2930cef48
4
+ data.tar.gz: f3b0f72a7992edb828eb51f76dbbdcfbc470a2d3
5
5
  SHA512:
6
- metadata.gz: effe2f350d3b5ee7521b72133ae81c25c4a9afa9fb4c0c5718224600dc812a11257e55d00d89283889e24c4126c8f2755d2a1d32f13a797e1636f0630b86cbd8
7
- data.tar.gz: 6f33205c3000b0a7a6fff94070aa20dc9f9dab4d9c6b2b226bc1d1bd39304192e673c9ebdcc9e4326e1d753375b14c990998c6a2538bdbbd2bf4900711c31c9d
6
+ metadata.gz: 127cf291010624f4569ccf758ec270523614fc2162daaf60bab894124b4850387ac585a19a5c450b17d18be6173f2a6205c147d314c85ce778810fae79106c43
7
+ data.tar.gz: de6d17c762ac6e58b77eae3c74dd248720d7d572cde3f381d1178d276b1e132e3406355ce19c8afdec9eccb18bddee61ee8b61f88645472c3640f14ad39ef1b9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- radon (0.1.2)
4
+ radon (0.1.4)
5
5
  paint
6
6
  rubyzip (~> 1.2)
7
7
 
data/README.md CHANGED
@@ -65,6 +65,15 @@ If you want to add an environment to radon, here are the steps:
65
65
  6. Add the environments to `@@all` in `environments.rb`
66
66
  7. Open a pull request
67
67
 
68
+ If the environment requires a project name (eg. ruby class name or file-names) you can put these token identifiers to be replaced during project creation:
69
+
70
+ | Identifier | Meaning |
71
+ | :-------------: |:-------------:|
72
+ | `{{NAME}}` | The dash-seperated project name (eg. `my-cool-project`) |
73
+ | `{{CAPSNAME}}` | The capitalized project name (eg. `MyCoolProject`) |
74
+ | `{{EMAIL}}` | The email of the user |
75
+ | `{{GHNAME}}` | The GitHub username of the user |
76
+
68
77
 
69
78
  ## Contributing
70
79
 
@@ -1,5 +1,5 @@
1
1
  # The version
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
 
4
4
  # The root of this project
5
5
  PROJECT_ROOT = File.absolute_path(File.join(File.dirname(__FILE__), "..", ".."))
@@ -1,14 +1,17 @@
1
1
  require "core/constants"
2
2
  module Radon
3
3
  class Environments
4
+
5
+ # The list of all supported environments and their associeted data paths
4
6
  @@all = {
5
7
  'gradle' => File.join(DATA_DIR, "gradle.zip"),
6
8
  'java' => File.join(DATA_DIR, "java.zip"),
7
9
  'maven' => File.join(DATA_DIR, "maven.zip"),
8
10
  'python' => File.join(DATA_DIR, "python.zip"),
9
- 'c' => File.join(DATA_DIR, "c.zip"),
10
- 'ruby (beta)' => File.join(DATA_DIR, "ruby.zip"),
11
- 'crystal'=> File.join(DATA_DIR, "crystal_app.zip")
11
+ 'c' => File.join(DATA_DIR, "c.zip"),
12
+ 'ruby' => File.join(DATA_DIR, "ruby.zip"),
13
+ 'crystal'=> File.join(DATA_DIR, "crystal_app.zip"),
14
+ 'go_s' => File.join(DATA_DIR, "go_s.zip")
12
15
  }
13
16
 
14
17
  # Gets all environments as an array of strings
@@ -21,25 +24,15 @@ class Environments
21
24
  @@all[key]
22
25
  end
23
26
 
27
+ # Extract the zip
24
28
  def self.extract(key, target)
25
- case key
26
- when 'gradle'
27
- extract_gradle(target)
28
- when 'java'
29
- extract_java(target)
30
- when 'python'
31
- extract_python(target)
32
- when 'ruby'
33
- extract_ruby(target)
34
- when 'maven'
35
- extract_maven(target)
36
- when 'c'
37
- extract_c(target)
38
- when 'crystal'
39
- extract_crystal(target)
29
+ envs = self.getAllNames
30
+ if envs.include? key
31
+ send "extract_#{key}", target
40
32
  else
41
33
  error("#{key} is not a supported environment.\nYou can suggest it be added at https://github.com/cbrnrd/radon/issues")
42
34
  end
43
35
  end
36
+
44
37
  end
45
38
  end
data/lib/core/extract.rb CHANGED
@@ -19,7 +19,7 @@ def extract_python(target)
19
19
  end
20
20
 
21
21
  def extract_ruby(target)
22
- extract_zip(Radon::Environments.getTargetOf('ruby (beta)'), target)
22
+ extract_zip(Radon::Environments.getTargetOf('ruby'), target)
23
23
  replace_all_tokens(target)
24
24
  end
25
25
 
@@ -32,6 +32,10 @@ def extract_crystal(target)
32
32
  replace_all_tokens(target)
33
33
  end
34
34
 
35
+ def extract_go_s(target)
36
+ extract_zip(Radon::Environments.getTargetOf('go_s'), target)
37
+ end
38
+
35
39
  # Extracts some zip data to the passed destination
36
40
  def extract_zip(file, destination)
37
41
  puts "Creating project under #{File.expand_path(destination)}" unless $quiet
data/lib/core/text.rb CHANGED
@@ -5,10 +5,11 @@ def vprint(*args)
5
5
  end
6
6
 
7
7
  def error(*args)
8
- puts Paint["ERROR", '#e74c3c'] + " - #{args}"
8
+ puts Paint["ERROR", '#e74c3c'] + " - #{args.join(' ')}"
9
9
  end
10
10
 
11
11
  def report_error_to_github(trace)
12
+ commit_string = File.directory?(File.join(PROJECT_ROOT, '.git')) ? "Commit `#{File.read(File.join(PROJECT_ROOT, '.git', 'refs', 'heads', 'master')).strip}`" : nil
12
13
  puts %Q{
13
14
  :::::::::::::::::: COPY BELOW ::::::::::::::::::
14
15
  ### Ruby version
@@ -31,6 +32,8 @@ def report_error_to_github(trace)
31
32
  ```
32
33
  #{trace}
33
34
  ```
35
+
36
+ #{commit_string}
34
37
  :::::::::::::::::: COPY ABOVE ::::::::::::::::::
35
38
  #{Paint["Whoops! Looks like you've found a bug in radon. Please copy the text above and open a new issue at ", '#e74c3c'] + Paint['https://github.com/cbrnrd/radon/issues', :bold, :bright]}
36
39
  }
@@ -72,7 +75,7 @@ def classify(name)
72
75
  return name.slice(0,1).capitalize + name.slice(1..-1)
73
76
  end
74
77
 
75
- # Replaces `find` with `repl` in every file and directory
78
+ # Replaces 'find' with 'repl' in every file and directory
76
79
  def find_and_replace_all(target_dir, find, repl)
77
80
  files = Dir[File.join(target_dir,'**','*')]
78
81
  files.each do |file_name|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - cbrnrd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-07 00:00:00.000000000 Z
11
+ date: 2018-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paint