Sha256: cf9fd623fdad69962e0fd6bde41f15dca992873d2bd043015b05856b4479439d
Contents?: true
Size: 1.79 KB
Versions: 3
Compression:
Stored size: 1.79 KB
Contents
# frozen_string_literal: true require "colorize" require "fileutils" require "spout/helpers/framework" module Spout module Commands # Generates folder and file structure for a new spout data dictionary. class ProjectGenerator include Spout::Helpers::Framework def initialize(argv) generate_folder_structure!(argv) end def generate_folder_structure!(argv) skip_gemfile = !argv.delete("--skip-gemfile").nil? @project_name = argv[1].to_s.strip @full_path = File.join(@project_name) usage = <<-EOT Usage: spout new FOLDER The FOLDER must be empty or new. EOT if @full_path == "" || (Dir.exist?(@full_path) && (Dir.entries(@full_path) & [".gitignore", ".ruby-version", ".travis.yml", "Gemfile", "Rakefile", "domains", "variables", "test"]).size > 0) puts usage exit(0) end FileUtils.mkpath(@full_path) copy_file "gitignore", ".gitignore" copy_file "ruby-version", ".ruby-version" copy_file "travis.yml", ".travis.yml" evaluate_file "spout.yml.erb", ".spout.yml" evaluate_file "CHANGELOG.md.erb", "CHANGELOG.md" copy_file "Gemfile" copy_file "Rakefile" evaluate_file "README.md.erb", "README.md" copy_file "VERSION" directory "domains" copy_file "keep", "domains/.keep" directory "variables" copy_file "keep", "variables/.keep" directory "forms" copy_file "keep", "forms/.keep" directory "test" copy_file "test/dictionary_test.rb" copy_file "test/test_helper.rb" return if skip_gemfile puts " run".colorize(:green) + " bundle install".colorize(:light_cyan) Dir.chdir(@full_path) system "bundle install" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spout-0.13.0 | lib/spout/commands/project_generator.rb |
spout-0.13.0.beta2 | lib/spout/commands/project_generator.rb |
spout-0.13.0.beta1 | lib/spout/commands/project_generator.rb |