vipergeng 0.2.9 → 0.2.10

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: 15712c025513c2f63ff424bfeffe884cc53a0d65
4
- data.tar.gz: d49eb462b7baa55cfd6e4ca3c8307eb7e532e9eb
3
+ metadata.gz: 87848ec8c717c548f9d672ede902fde174afcadb
4
+ data.tar.gz: da48031f137acb2676327504988312c896c3064a
5
5
  SHA512:
6
- metadata.gz: 674b189163b4ed2a155795de4f58427cc4797697ff1a3248d38627735fc18512bfe33ed4cc00bf337670e20a9d299b495fe3701186610b6df44c28604a003049
7
- data.tar.gz: 187b3086c254cc899550979052a752f17111a97b357abdd1576fe2204156a803a341fe669e990676741ae9b74b889612edb220067b7401ef39ea9993aad42617
6
+ metadata.gz: ff32954813335b7baa3097656327de0d9473915171a8dbe1f555a1e9ae756f98b78a7ca8985725092574c81d53af0839e8b1ad894643b93a1d6975ac23c6e652
7
+ data.tar.gz: f0c5aa9c7a530e873171e79a996f0a270452f864d2cc1247277247bca03883d4bdfa51b91c47ed7e6b9dbee22340f427b1e726a3d8a9cd01f801169ceae618aa
@@ -7,27 +7,31 @@ module Vipergen
7
7
  AUTHOR_REPLACEMENT_KEY = "___FULLUSERNAME___"
8
8
  YEAR_REPLACEMENT_KEY = "___YEAR___"
9
9
  COMPANY_REPLACEMENT_KEY = "___ORGANIZATIONNAME___"
10
+ PROJECT_REPLACEMENT_KEY = "___PROJECTNAME___"
11
+ FILE_REPLACEMENT_KEY= "___FILENAME___"
12
+ DATE_REPLACEMENT_KEY= "___DATE___"
10
13
 
11
14
  # Main method that generate the VIPER files structure
12
- def self.generate_viper(template, language, name, path, author, company)
15
+ def self.generate_viper(template, language, name, path, author, company, project)
13
16
  puts "Generating VIPER-Module"
14
17
  puts "Template: #{template}"
15
18
  puts "Language: #{language}"
16
19
  puts "Name: #{name}"
17
20
  puts "Path: #{path}"
18
21
  puts "Author: #{author}"
19
- puts "Company: #{company}"
22
+ puts "Company: #{company}"
23
+ puts "Project: #{project}"
20
24
  path_from = Vipergen::FileManager.path_from(template, language)
21
25
  path_to = Vipergen::FileManager.destination_viper_path(path, name)
22
26
  Vipergen::FileManager.copy(path_from, path_to)
23
27
  files = Vipergen::FileManager.files_in_path(path_to)
24
- rename_files(files, name, author, company)
28
+ rename_files(files, name, author, company, project)
25
29
  end
26
30
 
27
31
  # Rename all the files in the files array
28
32
  # - It renames the name of the file
29
33
  # - It renames the content of the file
30
- def self.rename_files(files, name, author, company)
34
+ def self.rename_files(files, name, author, company, project)
31
35
  files.each do |file|
32
36
  raise SyntaxError unless file.include? (Vipergen::Generator::REPLACEMENT_KEY)
33
37
  rename_file(file, name, author, company)
@@ -37,15 +41,15 @@ module Vipergen
37
41
  # Rename a given file
38
42
  # - It renames the name of the file
39
43
  # - It renames the content of the file
40
- def self.rename_file(file, name, author, company)
44
+ def self.rename_file(file, name, author, company, project)
41
45
  new_path = file.gsub((Vipergen::Generator::REPLACEMENT_KEY), name)
42
46
  Vipergen::FileManager.move(file, new_path)
43
- rename_file_content(new_path, name, author, company)
47
+ rename_file_content(new_path, name, author, company, project)
44
48
  end
45
49
 
46
50
  # Rename the file content
47
51
  # @return: An String with the every VIPER replaced by 'name'
48
- def self.rename_file_content(filename, name, author, company)
52
+ def self.rename_file_content(filename, name, author, company, project)
49
53
  # Reading content
50
54
  file = File.open(filename, "rb")
51
55
  content = file.read
@@ -56,6 +60,9 @@ module Vipergen
56
60
  content = content.gsub((Vipergen::Generator::AUTHOR_REPLACEMENT_KEY), author)
57
61
  content = content.gsub((Vipergen::Generator::YEAR_REPLACEMENT_KEY), "#{Time.new.year}")
58
62
  content = content.gsub((Vipergen::Generator::COMPANY_REPLACEMENT_KEY), company)
63
+ content = content.gsub((Vipergen::Generator::PROJECT_REPLACEMENT_KEY), project)
64
+ content = content.gsub((Vipergen::Generator::FILE_REPLACEMENT_KEY), File.basename(filename,File.extname(filename)))
65
+ content = content.gsub((Vipergen::Generator::DATE_REPLACEMENT_KEY), "#{Time.new.month}/#{Time.new.day}/#{Time.new.year}")
59
66
 
60
67
  # Saving content with replaced string
61
68
  File.open(filename, "w+") do |file|
@@ -1,4 +1,4 @@
1
1
  module Vipergen
2
2
  NAME = "vipergeng"
3
- VERSION = "0.2.9"
3
+ VERSION = "0.2.10"
4
4
  end
@@ -9,8 +9,9 @@ module Vipergen
9
9
  option :path, :required => true, :type => :string , :desc => "Path where the output module is going to be saved"
10
10
  option :author, :required => false, :default => 'VIPER', :type => :string , :desc => "Author to be specified on the file's header. Otherwise VIPER will be used"
11
11
  option :company, :required => false, :default => 'Company', :type => :string, :desc => "Company to be specified on the file's header. Otherwise Company will be used"
12
+ option :project, :required => false, :default => 'Project', :type => :string, :desc => "Project to be specified on the file's header. Otherwise Project will be used"
12
13
  def generate(name)
13
- Vipergen::Generator.generate_viper(options[:template], options[:language], name, options[:path], options[:author], options[:company])
14
+ Vipergen::Generator.generate_viper(options[:template], options[:language], name, options[:path], options[:author], options[:company], options[:project])
14
15
  end
15
16
 
16
17
  desc "templates", "Get a list of available templates"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vipergeng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Piñera