Class: Smithy::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/smithy/package.rb

Constant Summary collapse

PackageFileNames =
{
:exception   => ".exceptions",
:description => "description.markdown",
:support     => "support",
:versions    => "versions" }
BuildFileNames =
{
:notes        => "build-notes",
:dependencies => "dependencies",
:build        => "rebuild",
:test         => "retest",
:env          => "remodule" }
ExecutableBuildFileNames =
[
  BuildFileNames[:build],
  BuildFileNames[:link],
  BuildFileNames[:test],
  BuildFileNames[:env]
]
BuildFileERBs =
[
BuildFileNames[:env] ]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Package

Returns a new instance of Package.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/smithy/package.rb', line 54

def initialize(args = {})
  @root = File.dirname(Smithy::Config.full_root)
  @arch = File.basename(Smithy::Config.full_root)

  if args[:path].try(:downcase) == 'last'
    @path = Smithy::Config.last_prefix
  else
    @path = Package.normalize_name(args[:path])
  end
  @path =~ /(.*)\/(.*)\/(.*)$/
  @name = $1
  @version = $2
  @build_name = $3
  @group = Smithy::Config.file_group

  @group_writable = Smithy::Config.group_writable?
  @group_writable = args[:group_writable] if args.has_key?(:group_writable)
end

Instance Attribute Details

#archObject

Returns the value of attribute arch.



40
41
42
# File 'lib/smithy/package.rb', line 40

def arch
  @arch
end

#build_nameObject

Returns the value of attribute build_name.



40
41
42
# File 'lib/smithy/package.rb', line 40

def build_name
  @build_name
end

#groupObject

Returns the value of attribute group.



41
42
43
# File 'lib/smithy/package.rb', line 41

def group
  @group
end

#nameObject

Returns the value of attribute name.



40
41
42
# File 'lib/smithy/package.rb', line 40

def name
  @name
end

#rootObject

Returns the value of attribute root.



40
41
42
# File 'lib/smithy/package.rb', line 40

def root
  @root
end

#versionObject

Returns the value of attribute version.



40
41
42
# File 'lib/smithy/package.rb', line 40

def version
  @version
end

Class Method Details

.all(args = {}) ⇒ Object



585
586
587
588
589
590
591
592
593
594
595
# File 'lib/smithy/package.rb', line 585

def self.all(args = {})
  name    = args[:name]    || '*'
  version = args[:version] || '*'
  build   = args[:build]   || '*'
  # Array of full paths to rebuild scripts
  software =  Dir.glob(Smithy::Config.full_root+"/#{name}/#{version}/#{build}/#{BuildFileNames[:build]}")
  software += Dir.glob(Smithy::Config.full_root+"/#{name}/#{version}/#{build}/.valid")
  # Remove rebuild from each path
  software.collect!{|s| s.gsub(/\/(#{BuildFileNames[:build]}|\.valid)$/, '')}
  software.sort!
end

.all_web(args = {}) ⇒ Object



597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
# File 'lib/smithy/package.rb', line 597

def self.all_web(args = {})
  # Find all software with descriptions
  descriptions_dir = Smithy::Config.full_root
  descriptions_dir = Smithy::Config.descriptions_root if Smithy::Config.descriptions_root
  software = Dir.glob(descriptions_dir+"/*/description*")

  software.collect!{|s| File.dirname(s) }
  software.uniq!

  # Remove any with noweb in their exceptions file
  software.reject! do |s|
    ! Description.publishable?(s)
  end
  software.sort!
  return software
end

.alternate_builds(version_directory) ⇒ Object



533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/smithy/package.rb', line 533

def self.alternate_builds(version_directory)
  version = File.basename(version_directory)
  builds = Dir.glob(version_directory+"/*")
  # Delete anything that isn't a directory
  builds.reject! { |b| ! File.directory?(b) }
  builds.reject! { |b| b =~ /#{ModuleFile::PackageModulePathName}/ }
  # Get the directory name from the full path
  builds.collect! { |b| File.basename(b) }

  stubbed_builds = YAML.load_file(File.join(File.dirname(version_directory), ".versions")).stringify_keys rescue {}
  if stubbed_builds[version]
    if stubbed_builds[version].is_a? String
      builds += [ stubbed_builds[version] ]
    else
      builds += stubbed_builds[version]
    end
  end
  builds.uniq!

  return builds.sort
end

.alternate_versions(application_directory) ⇒ Object



559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/smithy/package.rb', line 559

def self.alternate_versions(application_directory)
  versions = Dir.glob(application_directory+"/*")
  # Delete anything that isn't a directory
  versions.reject! { |b| ! File.directory?(b) }
  # Get the directory name from the full path
  versions.collect! { |b| File.basename(b) }

  stubbed_builds = YAML.load_file(File.join(application_directory, ".versions")).stringify_keys rescue {}
  versions += stubbed_builds.keys
  versions.uniq!

  return versions.sort
end

.create_stubs_from_modules(stub_packages, system_module_defaults, options = {}) ⇒ Object



614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
# File 'lib/smithy/package.rb', line 614

def self.create_stubs_from_modules(stub_packages, system_module_defaults, options = {})
  notice "Generating stubs for the following modules:"
  Format.print_column_list(stub_packages)
  proceed = "no"
  while proceed == "no" do
    prompt = Readline.readline("Generate the above packages? [yn] ")
    case prompt.downcase
    when "y"
      proceed = true
    when "n"
      proceed = false
    end
  end

  raise "aborting package generation" if proceed == false

  stub_packages.each do |module_name|
    name, version = module_name.split("/")
    p = Package.new :path => "#{name}/#{version}/universal"
    p.create :stub => true, :dry_run => options[:"dry-run"]

    default_module = ""
    possible_defaults = system_module_defaults.select{ |m| m =~ %r{\/#{name}\/} }
    defaulted = possible_defaults.select{ |m| m =~ %r{\(default\)$} }
    if defaulted.size > 0
      default_module = defaulted.first
    else
      default_module = possible_defaults.last
    end

    help_content = modulehelp(name)
    #help_content.gsub!(/^[\t ]+/, '')
    help_content.gsub!(/^--* Module Specific Help.*-$/, '')
    help_content.gsub!(/^===================================================================$/, '')
    help_content.gsub!(/\A\n*/, '')
    help_content = """# #{name}

Categories:

## Description

The following information is available by running `module help #{name}`

~~~~~~~~~~~~~~~~~~~~~
#{help_content}
~~~~~~~~~~~~~~~~~~~~~
"""

    help_dest = File.join(p.application_directory, "description.markdown")

    ops = {:noop => options[:"dry-run"] ? true : false}
    FileOperations.install_from_string(help_content, help_dest, ops)
    FileOperations.set_group help_dest, p.group, ops
    FileOperations.make_group_writable help_dest, ops if p.group_writable?
  end
end

.normalize_name(name) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/smithy/package.rb', line 43

def self.normalize_name(name)
  name = Dir.pwd if name == "."
  name_split = name.split('/')
  name_version_build = []
  name_version_build << name_split[-3]
  name_version_build << name_split[-2]
  name_version_build << name_split[-1]
  name_version_build.compact!
  return File.join(name_version_build)
end

.search(query = '') ⇒ Object



577
578
579
# File 'lib/smithy/package.rb', line 577

def self.search(query = '')
  Package.all.select{|s| s =~ /#{query}/}
end

.search_by_name(name) ⇒ Object



581
582
583
# File 'lib/smithy/package.rb', line 581

def self.search_by_name(name)
  Package.all(:name => name)
end

Instance Method Details

#alternate_buildsObject



529
530
531
# File 'lib/smithy/package.rb', line 529

def alternate_builds
  Package.alternate_builds(self.version_directory)
end

#alternate_versionsObject



555
556
557
# File 'lib/smithy/package.rb', line 555

def alternate_versions
  Package.alternate_builds(self.application_directory)
end

#application_directoryObject



188
189
190
# File 'lib/smithy/package.rb', line 188

def application_directory
  File.join(@root, @arch, @name)
end

#build_support_files(alternate_source) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/smithy/package.rb', line 108

def build_support_files(alternate_source)
  file_list = []
  BuildFileNames.each do |name, file|
    src = File.join(@@smithy_bin_root, "etc/templates/build", file)
    src += ".erb" if BuildFileERBs.include?(file)

    if alternate_source && Dir.exists?(alternate_source)
      alt_src = File.join(alternate_source, file)
      src     = alt_src if File.exists? alt_src
    end

    file_list << { :name => name, :src => src, :dest => File.join(prefix, file) }
  end
  return file_list
end

#create(args = {}) ⇒ Object



403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/smithy/package.rb', line 403

def create(args = {})
  notice "New #{args[:stub] ? "stub " : ""}#{prefix}"
  notice_warn "Dry Run! (no files will be created or changed)" if args[:dry_run]
  options = {:noop => false, :verbose => false}
  options[:noop] = true if args[:dry_run]

  if args[:stub]
    [application_directory].each do |dir|
      FileOperations.make_directory dir, options
      FileOperations.set_group dir, group, options
      FileOperations.make_group_writable dir, options if group_writable?
    end

    update_version_table_file(options)
  else

    directories.each do |dir|
      #if dir == prefix
        FileOperations.make_directory dir, options
        FileOperations.set_group dir, group, options
        FileOperations.make_group_writable dir, options if group_writable?
      #end
    end

    if args[:formula]
      update_version_table_file(options)
      return
    end

    all_files = build_support_files(args[:existing])
    all_files = package_support_files + all_files if args[:web] || args[:stub]

    all_files.each do |file|
      if file[:src] =~ /\.erb$/
        FileOperations.render_erb :erb => file[:src], :binding => get_binding, :options => options, :destination => file[:dest]
      elsif file[:name] == :description
        d = Description.new(:package => self)
        original_dest = file[:dest]
        file[:dest] = d.description_file_path
        FileOperations.make_directory(d.path, options) if d.global_description
        FileOperations.install_file(file[:src], file[:dest], options)
        FileOperations.make_symlink(file[:dest], original_dest, options) if d.global_description
      else
        FileOperations.install_file file[:src], file[:dest], options
      end

      FileOperations.set_group file[:dest], group, options
      FileOperations.make_group_writable file[:dest], options if group_writable?
      FileOperations.make_executable file[:dest], options if file[:dest] =~ /(#{ExecutableBuildFileNames.join('|')})/
    end

  end
end

#create_lock_fileObject



208
209
210
211
212
213
214
215
216
217
218
# File 'lib/smithy/package.rb', line 208

def create_lock_file
  if File.exists? lock_file
    notice_fail "#{lock_file} exists, is someone else building this package? If not, use --force or delete and rerun."
    return false
  else
    FileUtils.touch(lock_file)
    FileOperations.set_group(lock_file, group)
    FileOperations.make_group_writable(lock_file) if group_writable?
    return true
  end
end

#create_valid_build_fileObject



228
229
230
231
232
233
234
235
# File 'lib/smithy/package.rb', line 228

def create_valid_build_file
  unless File.exists? valid_build_file
    FileUtils.touch(valid_build_file)
    FileOperations.set_group(valid_build_file, group)
    FileOperations.make_group_writable(valid_build_file) if group_writable?
    return true
  end
end

#delete_lock_fileObject



220
221
222
# File 'lib/smithy/package.rb', line 220

def delete_lock_file
  FileUtils.rm_f(lock_file)
end

#delete_valid_build_fileObject



237
238
239
# File 'lib/smithy/package.rb', line 237

def delete_valid_build_file
  FileUtils.rm_f(valid_build_file)
end

#directoriesObject



196
197
198
# File 'lib/smithy/package.rb', line 196

def directories
  [ application_directory, version_directory, prefix ]
end

#extract(args = {}) ⇒ Object



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/smithy/package.rb', line 324

def extract(args = {})
  archive = args[:archive]
  temp_dir = File.join(prefix,"tmp")

  notice "Extracting to #{source_directory}"

  return if args[:dry_run]

  overwrite = Smithy::Config.global.try(:[], :force) ? true : "unknown"
  overwrite = true if args[:overwrite]
  if File.exists?(source_directory)
    while overwrite == "unknown" do
      prompt = Readline.readline(" "*FILE_NOTICE_COLUMNS+"Overwrite? (enter \"h\" for help) [ynh] ")
      case prompt.downcase
      when "y"
        overwrite = true
      when "n"
        overwrite = false
      when "h"
        indent = " "*FILE_NOTICE_COLUMNS
        puts indent+"y - yes, delete existing folder and re-extract"
        puts indent+"n - no, do not overwrite"
        puts indent+"h - help, show this help"
      when "q"
        raise "Abort new package"
      end
    end
  else
    overwrite = true
  end

  if overwrite
    FileUtils.rm_rf temp_dir
    FileUtils.rm_rf source_directory
    FileUtils.mkdir temp_dir
    FileUtils.cd temp_dir

    magic_bytes = nil
    File.open(archive) do |f|
      magic_bytes = f.read(4)
    end
    case magic_bytes
    when /^PK\003\004/ # .zip archive
      `unzip #{archive}`
    else
      `tar xf #{archive}`
    end

    extracted_files = Dir.glob('*')
    if extracted_files.count == 1
      FileUtils.mv extracted_files.first, source_directory
    else
      FileUtils.cd prefix
      FileUtils.mv temp_dir, source_directory
    end

    FileUtils.rm_rf temp_dir

    FileOperations.set_group source_directory, @group, :recursive => true
    FileOperations.make_group_writable source_directory, :recursive => true if group_writable?
  end
end

#get_bindingObject



73
74
75
# File 'lib/smithy/package.rb', line 73

def get_binding
  binding
end

#group_writable?Boolean

Returns:

  • (Boolean)


124
125
126
# File 'lib/smithy/package.rb', line 124

def group_writable?
  @group_writable
end

#lock_fileObject



204
205
206
# File 'lib/smithy/package.rb', line 204

def lock_file
  File.join(prefix, ".lock")
end

#module_load_prgenvObject



457
458
459
460
461
462
463
464
465
466
# File 'lib/smithy/package.rb', line 457

def module_load_prgenv
  output = ""
  ModuleFile::compilers.each do |e|
    if build_name =~ e[:regex]
      output = "module load #{e[:prg_env]}"
      break
    end
  end
  return output
end

#package_support_filesObject



83
84
85
86
87
88
89
90
91
# File 'lib/smithy/package.rb', line 83

def package_support_files
  file_list = []
  PackageFileNames.each do |name, file|
    file_list << { :name => name,
      :src  => File.join(@@smithy_bin_root, "etc/templates/package", file),
      :dest => File.join(application_directory, file) }
  end
  return file_list
end

#prefixObject



144
145
146
# File 'lib/smithy/package.rb', line 144

def prefix
  File.join(@root, @arch, @name, @version, @build_name)
end

#prefix_exists!Object



150
151
152
# File 'lib/smithy/package.rb', line 150

def prefix_exists!
  raise "The package #{prefix} does not exist!" unless prefix_exists?
end

#prefix_exists?Boolean

Returns:

  • (Boolean)


147
148
149
# File 'lib/smithy/package.rb', line 147

def prefix_exists?
  Dir.exist? prefix
end

#publishable?Boolean

Returns:

  • (Boolean)


573
574
575
# File 'lib/smithy/package.rb', line 573

def publishable?
  Description.publishable?(application_directory)
end

#qualified_nameObject



140
141
142
# File 'lib/smithy/package.rb', line 140

def qualified_name
  [@name, @version, @build_name].join('/')
end

#rebuild_scriptObject



158
159
160
# File 'lib/smithy/package.rb', line 158

def rebuild_script
  File.join(prefix, BuildFileNames[:build])
end

#rebuild_script_exists!Object



164
165
166
# File 'lib/smithy/package.rb', line 164

def rebuild_script_exists!
  raise "The script #{rebuild_script} does not exist!" unless rebuild_script_exists?
end

#rebuild_script_exists?Boolean

Returns:

  • (Boolean)


161
162
163
# File 'lib/smithy/package.rb', line 161

def rebuild_script_exists?
  File.exist?(rebuild_script)
end

#remodule_scriptObject



178
179
180
# File 'lib/smithy/package.rb', line 178

def remodule_script
  File.join(prefix, BuildFileNames[:env])
end

#remodule_script_exists!Object



184
185
186
# File 'lib/smithy/package.rb', line 184

def remodule_script_exists!
  raise "The script #{remodule_script} does not exist!" unless remodule_script_exists?
end

#remodule_script_exists?Boolean

Returns:

  • (Boolean)


181
182
183
# File 'lib/smithy/package.rb', line 181

def remodule_script_exists?
  File.exist?(remodule_script)
end

#repair(args = {}) ⇒ Object



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
# File 'lib/smithy/package.rb', line 468

def repair(args = {})
  notice "Repair #{prefix} #{args[:dry_run] ? "(dry run)" : ""}"
  options = {:noop => false, :verbose => false}
  options[:noop] = true if args[:dry_run]
  options[:verbose] = true if args[:dry_run] || args[:verbose]

  missing_package   = []
  missing_build = []

  notice "Checking support files"
  (package_support_files+build_support_files).each do |file|
    f = file[:dest]

    if File.exists?(f)
      if File.size(f) == 0
        puts "empty ".rjust(12).color(:yellow) + f
      else
        puts "exists ".rjust(12) + f
      end
      FileOperations.make_executable file[:dest], options if f =~ /#{ExecutableBuildFileNames.join('|')}/
    else
      puts "missing ".rjust(12).color(:red) + f

      missing_package << File.basename(f) if PackageFileNames.values.include?(File.basename(f))
      missing_build << File.basename(f) if BuildFileNames.values.include?(File.basename(f))
    end
  end

  notice "Creating missing files" if !missing_package.empty? || !missing_build.empty?

  if !missing_package.empty?
    package_support_files.each do |file|
      if missing_package.include?(file[:name])
        FileOperations.install_file file[:src], file[:dest], options
        FileOperations.set_group file[:dest], group, options
        FileOperations.make_group_writable file[:dest], options if group_writable?
      end
    end
  end

  if !missing_build.empty?
    build_support_files.each do |file|
      if missing_build.include?(file[:name])
        FileOperations.install_file file[:src], file[:dest], options
        FileOperations.set_group file[:dest], group, options
        FileOperations.make_group_writable file[:dest], options if group_writable?
      end
    end
  end

  notice "Setting permissions for #{prefix}"

  FileOperations.set_group prefix, group, options.merge(:recursive => true)
  FileOperations.make_group_writable prefix, options.merge(:recursive => true) if group_writable?

  [version_directory, application_directory].each do |dir|
    FileOperations.set_group dir, group, options
    FileOperations.make_group_writable dir, options if group_writable?
  end
end

#retest_scriptObject



168
169
170
# File 'lib/smithy/package.rb', line 168

def retest_script
  File.join(prefix, BuildFileNames[:test])
end

#retest_script_exists!Object



174
175
176
# File 'lib/smithy/package.rb', line 174

def retest_script_exists!
  raise "The script #{retest_script} does not exist!" unless retest_script_exists?
end

#retest_script_exists?Boolean

Returns:

  • (Boolean)


171
172
173
# File 'lib/smithy/package.rb', line 171

def retest_script_exists?
  File.exist?(retest_script)
end

#run_script(args = {}) ⇒ Object



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/smithy/package.rb', line 241

def run_script(args ={})
  case args[:script]
  when :build
    rebuild_script_exists!
    script = rebuild_script
    notice "Building #{prefix}"
  when :test
    retest_script_exists!
    script = retest_script
    notice "Testing #{prefix}"
  else
    return nil
  end

  notice_warn "Dry Run! (scripts will not run)" if args[:dry_run]

  ENV['SMITHY_PREFIX'] = prefix
  ENV['SW_BLDDIR'] = prefix

  unless args[:disable_logging]
    if args[:log_name]
      log_file_path = File.join(prefix, args[:log_name])
      log_file = File.open(log_file_path, 'w') unless args[:dry_run]

      FileOperations.set_group(log_file, group)
      FileOperations.make_group_writable(log_file) if group_writable?
    end
    if args[:dry_run] || log_file != nil
      notice "Logging to #{log_file_path}"
    end
  end

  unless args[:dry_run]
    if args[:force]
      delete_lock_file
      create_lock_file
    else
      return unless create_lock_file
    end

    stdout, stderr = '',''
    exit_status = 0

    begin
      t = Open4.background(script, 0=>'', 1=>stdout, 2=>stderr)
      while t.status do
        process_ouput(stdout, stderr, args[:suppress_stdout], log_file)
        sleep 0.25
      end

      exit_status = t.exitstatus # this will throw an exception if != 0
    rescue => exception
      exit_status = exception.exitstatus
    end
    # There is usually some leftover output
    process_ouput(stdout, stderr, args[:suppress_stdout], log_file)

    log_file.close unless log_file.nil?

    if exit_status == 0
      notice_success "SUCCESS #{prefix}"
    else
      notice_fail "FAILED #{prefix}"
    end

    case args[:script]
    when :build
      set_file_permissions_recursive if exit_status == 0
    when :test
    end

    delete_lock_file
  end
end

#set_file_permissions_recursiveObject



316
317
318
319
320
321
322
# File 'lib/smithy/package.rb', line 316

def set_file_permissions_recursive
  if group_writable?
    notice "Setting permissions on installed files"
    FileOperations.set_group prefix, @group, :recursive => true
    FileOperations.make_group_writable prefix, :recursive => true if group_writable?
  end
end

#software_rootObject



200
201
202
# File 'lib/smithy/package.rb', line 200

def software_root
  File.join(@root, @arch)
end

#source_directoryObject



154
155
156
# File 'lib/smithy/package.rb', line 154

def source_directory
  File.join(prefix,"source")
end

#update_version_table_file(options) ⇒ Object



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/smithy/package.rb', line 387

def update_version_table_file(options)
  version_table_file = File.join(application_directory, ".versions")
  version_table = YAML.load_file(version_table_file).stringify_keys rescue {}
  if version_table[version].is_a? String
    version_table[version] = [ build_name.encode('UTF-8') ]
  elsif version_table[version].is_a? Array
    version_table[version] << build_name.encode('UTF-8') unless version_table[version].include?(build_name.encode('UTF-8'))
  else
    version_table.merge!({version.encode('UTF-8') => build_name.encode('UTF-8')})
  end

  FileOperations.install_from_string version_table.to_yaml, version_table_file, options.merge({:force => true})
  FileOperations.set_group version_table_file, group, options
  FileOperations.make_group_writable version_table_file, options if group_writable?
end

#valid?Boolean

Returns:

  • (Boolean)


128
129
130
131
132
133
134
135
136
137
138
# File 'lib/smithy/package.rb', line 128

def valid?
  # Name format validation
  if @name.nil? || @version.nil? || @build_name.nil? || @name.include?('/') || @version.include?('/') || @build_name.include?('/')
    raise "The package name \"#{@path}\" must be of the form: NAME/VERSION/BUILD"
    return false
  end

  # If good, save as last prefix
  Smithy::Config.save_last_prefix(qualified_name)
  return true
end

#valid_build_fileObject



224
225
226
# File 'lib/smithy/package.rb', line 224

def valid_build_file
  File.join(prefix, ".valid")
end

#version_directoryObject



192
193
194
# File 'lib/smithy/package.rb', line 192

def version_directory
  File.join(@root, @arch, @name, @version)
end