class RBT::CreateSnapcraftFile
Public Class Methods
[](i = ARGV)
click to toggle source
Public Instance Methods
add( i = '', add_newline = true )
click to toggle source
add_apps()
click to toggle source
add_confinement( use_this_confinement = 'strict' )
click to toggle source
#¶ ↑
add_confinement
¶ ↑
Confinement describes the level of confinement that can be applied to the given app.
Can be either ‘devmode’ or ‘strict’.
Unconfined applications, specified with ‘devmode’, can only be released to the hidden “edge” channel.
#¶ ↑
# File lib/rbt/generate_files/create_snapcraft_file.rb, line 206 def add_confinement( use_this_confinement = 'strict' ) add('confinement: '+use_this_confinement) end
add_everything()
click to toggle source
add_grade( use_this_grade = 'stable' )
click to toggle source
add_name()
click to toggle source
add_newline()
click to toggle source
add_parts()
click to toggle source
#¶ ↑
add_parts
(parts tag)¶ ↑
This method denotes the necessary parts (components) of our program at hand.
#¶ ↑
# File lib/rbt/generate_files/create_snapcraft_file.rb, line 280 def add_parts heredoc_variable = <<-EOF parts: #{name_of_this_individual_program?}: # See 'snapcraft plugins' for more information. plugin: #{plugin_type?} source: #{remote_url?} EOF add(heredoc_variable) end
add_program_description()
click to toggle source
#¶ ↑
add_program_description
(desc tag)¶ ↑
#¶ ↑
# File lib/rbt/generate_files/create_snapcraft_file.rb, line 332 def add_program_description description_to_use = "description: |#{N}".dup _ = @dataset.description? _.split(N).each {|line| description_to_use << ' '+line+N } add(description_to_use.strip.chomp) end
add_program_licence()
click to toggle source
add_program_summary()
click to toggle source
add_program_version()
click to toggle source
add_the_proper_base()
click to toggle source
#¶ ↑
add_the_proper_base
¶ ↑
This will add a String such as:
'base: core18'
The base keyword declares which base snap to use with your project. A base snap is a special kind of snap that provides a run-time environment alongside a minimal set of libraries that are common to most applications.
For more documentation see:
https://snapcraft.io/docs/ruby-applications
#¶ ↑
# File lib/rbt/generate_files/create_snapcraft_file.rb, line 324 def add_the_proper_base add('base: core18') add_newline end
binaries?()
click to toggle source
generate_the_snapcraft_file( into = into? )
click to toggle source
into?()
click to toggle source
licence?()
click to toggle source
name_of_this_individual_program?()
click to toggle source
notify_the_user_that_we_will_create_a_new_snapcraft_file_next( _ = programs? )
click to toggle source
#¶ ↑
notify_the_user_that_we_will_create_a_new_snapcraft_file_next
¶ ↑
#¶ ↑
# File lib/rbt/generate_files/create_snapcraft_file.rb, line 344 def notify_the_user_that_we_will_create_a_new_snapcraft_file_next( _ = programs? ) result = 'Creating a snapcraft file next for the program'.dup if _.is_a?(Array) and (_.size > 1) result << 's' end if _.is_a? Array _ = _.join(', ').strip end result << " called #{royalblue(_)}." opne result end
plugin_type?()
click to toggle source
program_name?()
click to toggle source
#¶ ↑
program_name?¶ ↑
#¶ ↑
# File lib/rbt/generate_files/create_snapcraft_file.rb, line 143 def program_name? @program_name end
Also aliased as: programs?
program_version?()
click to toggle source
remote_url?()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Base#reset
# File lib/rbt/generate_files/create_snapcraft_file.rb, line 52 def reset super() infer_the_namespace # ======================================================================= # # === @snapcraft_file_content # # The following instance variable, a String, is the one that is used # to store all content that will be written into the snapcraft yaml # file. It will be used to store the file in the current directory. # ======================================================================= # @snapcraft_file_content = ''.dup # ======================================================================= # # === :store_into_this_file # # Denote into which file we will store that content. # ======================================================================= # @internal_hash[:store_into_this_file] = 'snapcraft.yaml' end
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/generate_files/create_snapcraft_file.rb, line 404 def run programs?.each {|this_program| reset try_to_find_corresponding_program(this_program) # <- Must come first as it sets the @dataset variable. set_name_of_this_individual_program(this_program) set_store_into_this_file( this_program+'-'+program_version?+'-snapcraft' ) notify_the_user_that_we_will_create_a_new_snapcraft_file_next( this_program ) add_everything generate_the_snapcraft_file } end
set_name_of_this_individual_program(i)
click to toggle source
set_program_name(i = '')
click to toggle source
#¶ ↑
set_program_name
¶ ↑
Denote onto which program we will work on.
#¶ ↑
# File lib/rbt/generate_files/create_snapcraft_file.rb, line 85 def set_program_name(i = '') if i.nil? opne 'Please provide a valid name for a program to this class.' exit end i = [i].flatten.compact if i.first.is_a?(String) and i.first.include?(',') i = i.map {|entry| if entry.include? ',' entry = entry.split(',') end entry }.flatten.compact end @program_name = i end
set_store_into_this_file(i)
click to toggle source
short_desc?()
click to toggle source
short_name?()
click to toggle source
try_to_find_corresponding_program( program_name = program_name? )
click to toggle source
#¶ ↑
try_to_find_corresponding_program
¶ ↑
This method attempts to find a corresponding entry from the individual yaml files.
#¶ ↑
# File lib/rbt/generate_files/create_snapcraft_file.rb, line 153 def try_to_find_corresponding_program( program_name = program_name? ) @dataset = RBT::Cookbooks::SanitizeCookbook.new(program_name) { :fast } end