Class: Logirel::CliHelper
- Inherits:
-
Object
- Object
- Logirel::CliHelper
- Includes:
- Queries
- Defined in:
- lib/logirel/cli_helper.rb
Instance Method Summary collapse
-
#files_selection(folders) ⇒ Object
folders: hash (as defined above), of folder paths.
- #folders_selection ⇒ Object
-
#initialize(root_dir) ⇒ CliHelper
constructor
A new instance of CliHelper.
- #metadata_interactive(selected_projs, selected_folders) ⇒ Object
-
#parse_folders(src) ⇒ Object
src: relative path!.
- #parse_folders_inner(src) ⇒ Object
- #say_goodbye ⇒ Object
Constructor Details
#initialize(root_dir) ⇒ CliHelper
Returns a new instance of CliHelper.
8 9 10 |
# File 'lib/logirel/cli_helper.rb', line 8 def initialize root_dir @root_dir = root_dir end |
Instance Method Details
#files_selection(folders) ⇒ Object
folders: hash (as defined above), of folder paths
55 56 57 58 59 60 61 |
# File 'lib/logirel/cli_helper.rb', line 55 def files_selection folders puts "Looking at src folder: '#{folders[:src]}'." first_sln = Dir.glob(File.join(@root_dir, folders[:src],"*.sln")).first || "" { :sln => StrQ.new("sln file", File.join(folders[:src], File.basename(first_sln))).exec } end |
#folders_selection ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/logirel/cli_helper.rb', line 31 def folders_selection puts "" puts "Directories Selection" puts "---------------------" puts "Current dir: #{@root_dir}, #{Dir.entries(@root_dir).keep_if{|x| x != '.' && x != '..' && File.directory?(File.join(@root_dir, x)) }. empty? ? 'which is empty.' : 'which contains folders.'}" puts "" build_dir = StrQ.new("Build Output Directory", "build").exec { :src => StrQ.new("Source Directory. Default (src) contains (#{parse_folders_inner('src').inspect})", 'src').exec, :buildscripts => StrQ.new("Buildscripts Directory", "buildscripts").exec, :build => build_dir, :tools => StrQ.new("Tools Directory", "tools").exec, :tests => StrQ.new("Test Output Directory", "#{build_dir}/tests").exec, :nuget => StrQ.new("NuGet Directory", "#{build_dir}/nuget").exec, :nuspec => StrQ.new("NuSpec Directory", "#{build_dir}/nuspec").exec } end |
#metadata_interactive(selected_projs, selected_folders) ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/logirel/cli_helper.rb', line 63 def selected_projs, selected_folders puts "" puts "Project Meta-Data Definitions" puts "-----------------------------" puts "Let's set up some meta-data!" puts "" selected_projs.map { |p| p, selected_folders[:src] } end |
#parse_folders(src) ⇒ Object
src: relative path!
13 14 15 16 17 18 19 |
# File 'lib/logirel/cli_helper.rb', line 13 def parse_folders src puts "" puts "Projects Selection" puts "---------------------" puts "Choose what projects to include (don't include test-projects):" parse_folders_inner src end |
#parse_folders_inner(src) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/logirel/cli_helper.rb', line 21 def parse_folders_inner src src = File.join(@root_dir, src, '*') Dir. glob(src). keep_if { |i| projs = File.join(i, "*.{csproj,vbproj,fsproj}") File.directory? i and Dir.glob(projs).length > 0 }.map { |x| File.basename(x) } end |
#say_goodbye ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/logirel/cli_helper.rb', line 72 def say_goodbye puts "" puts "SCAFFOLDING DONE! Now run 'bundle install' to install any dependencies for your albacore rakefile," puts " and git commit to commit changes! *** REMEMBER THAT YOU NEED NuGet at: '[tools]/nuget.exe' ***" puts " to build nugets." puts "" puts "Footnote:" puts "If you hack a nice task or deployment script - feel free to send a pull request to https://github.com/haf/logirel," puts "to make it available for everyone and get support on it through the community for free!" puts "" end |