Class: Origen::CodeGenerators::GemSetup

Inherits:
Base
  • Object
show all
Defined in:
lib/origen/code_generators/gem_setup.rb

Instance Method Summary collapse

Methods inherited from Base

banner, inherited, name, namespace

Methods included from Actions

#add_config, #add_source, #comment_config, #config, #environment, #gem, #gem_group, #generate, #git, #initialize, #lib, #rake, #rakefile, #readme

Instance Method Details

#create_gemspec_fileObject


8
9
10
11
# File 'lib/origen/code_generators/gem_setup.rb', line 8

def create_gemspec_file
  @summary = ask 'Describe your plugin in a few words:'
  template 'templates/code_generators/gemspec.rb', File.join(Origen.root, "#{Origen.app.name}.gemspec")
end

#create_master_require_fileObject


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/origen/code_generators/gem_setup.rb', line 13

def create_master_require_file
  file = "#{Origen.root}/lib/#{Origen.app.name}.rb"
  if File.exist?(file)
    prepend_to_file file, <<-END
require "origen"
require_relative "../config/application.rb"
require_relative "../config/environment.rb"

END
  else
    create_file file do
      <<-END
require "origen"
require_relative "../config/application.rb"
require_relative "../config/environment.rb"
END
    end
  end
end

#verify_semverObject


33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/origen/code_generators/gem_setup.rb', line 33

def verify_semver
  unless Origen.app.version.semantic?
    puts <<-END

Warning, you application is not currently using semantic (1.2.3) versioning, this must be used if
you want to publish your plugin as a gem.

To upgrade your application to semantic versioning run the following command:

  origen add semver

END
  end
end