Class: Commandly::CLI
- Inherits:
-
Thor
- Object
- Thor
- Commandly::CLI
- Defined in:
- lib/commandly/cli.rb
Class Method Summary collapse
-
.exit_on_failure? ⇒ Boolean
Set exit code of failing command if failure.
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
Set exit code of failing command if failure
9 10 11 |
# File 'lib/commandly/cli.rb', line 9 def self.exit_on_failure? true end |
Instance Method Details
#new(project_name) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/commandly/cli.rb', line 26 def new(project_name) project_path = File.(project_name) raise Error, set_color("ERROR: #{project_path} already exists.", :red) if File.exist?(project_path) generator = Commandly::Generator.new generator.destination_root = project_path remote = false if [:templateURL] remote = true say "Git cloning from git repository: #{[:templateURL]}" Git.clone([:templateURL], project_path) # Remove .git directory `rm -rf #{project_path}/.git` end if [:ios] say "Creating iOS project at #{project_path}" generator.invoke(:copy_ios_templates) unless remote generator.invoke(:find_replace_ios_text) generator.invoke(:rename_ios_files) `rm -rf #{project_path}/android` unless [:android] end if [:android] say "Creating Android project at #{project_path}" generator.invoke(:copy_android_templates) unless remote generator.invoke(:find_replace_android_text) generator.invoke(:rename_android_files) `rm -rf #{project_path}/ios` unless [:ios] end if [:ios].nil? && [:android].nil? say "Creating iOS and Android project at #{project_path}" generator.invoke(:copy_ios_templates) unless remote generator.invoke(:find_replace_ios_text) generator.invoke(:rename_ios_files) generator.invoke(:copy_android_templates) unless remote generator.invoke(:find_replace_android_text) generator.invoke(:rename_android_files) end end |