module RailsBase::Commands
This module provides commands implementation
Public Class Methods
add_feature(feature)
click to toggle source
# File lib/rs-rails-base/commands.rb, line 23 def self.add_feature(feature) if feature.nil? display_menu else feature_case(feature) end end
clone_project(version, uri, to_folder)
click to toggle source
# File lib/rs-rails-base/commands.rb, line 64 def self.clone_project(version, uri, to_folder) command = "git clone -b #{version.strip!} --depth 1 #{uri} #{to_folder} &> /dev/null 2>&1" system(command) end
feature_case(feature)
click to toggle source
# File lib/rs-rails-base/commands.rb, line 31 def self.feature_case(feature) case feature when FEATURE_OPTIONS[:facebook] RailsBase::Features.facebook puts 'Mark is happy' when FEATURE_OPTIONS[:twilio] RailsBase::Features.twilio puts 'now start messaging' when FEATURE_OPTIONS[:chat] RailsBase::Features.chat puts 'now go and start talking' when 'all', 'All' FEATURE_OPTIONS.each do |k, v| puts "Installing #{v}" RailsBase::Features.send(k) puts "Feature #{v} installed" end puts 'All set' else puts 'Please select a valid option' end end
new_project()
click to toggle source
# File lib/rs-rails-base/commands.rb, line 8 def self.new_project say_something('Getting ready to get an amazing project') answer = RailsBase::CliActions.ask_for_something('What would be the name for project folder?') if Dir.exist?(answer) say_something('Please dont use same project again and again') else final_version = manage_tags RailsBase::GitActions.fetch_from_remote(final_version) clone_project(final_version, RailsBase::REMOTE_URI, answer) remove_git_configuration(answer) end FileUtils.cd("#{Dir.pwd}/#{answer}") say_something('Download complete') end
remove_git_configuration(project_folder)
click to toggle source
# File lib/rs-rails-base/commands.rb, line 69 def self.remove_git_configuration(project_folder) git_config = project_folder + '/.git' FileUtils.rm_rf(git_config) end