class FWToolkit::Project
Public Instance Methods
conf_gemset(project_root=Dir.pwd)
click to toggle source
# File lib/fwtoolkit/cli/project.rb, line 58 def conf_gemset(project_root=Dir.pwd) @project_name = File.basename(project_root) destination_root = project_root say 'Configuring Gemset' directory "templates/default_project/gemset", destination_root inside(destination_root) do bundle_update end end
create(project_name)
click to toggle source
# File lib/fwtoolkit/cli/project.rb, line 18 def create(project_name) invoke :new, ["swift", project_name, ""] end
new(project_language, project_name, class_prefix="")
click to toggle source
# File lib/fwtoolkit/cli/project.rb, line 23 def new(project_language, project_name, class_prefix="") unless project_language == "swift" or project_language == "objc" say_status :error, "Project language should be either swift or objc", :red return end if project_language == "objc" and class_prefix == "" say_status :error, "Objc projects require a class prefix", :red return end clean_project_name = project_name.gsub("-", "_") destination_root = File.join(Dir.pwd, clean_project_name) say "Creating new project in: #{File.expand_path destination_root}" invoke :conf_gemset, [destination_root] invoke FWToolkit::Bitrise, 'ios', [destination_root, clean_project_name] invoke FWToolkit::Xcode, 'new', [project_language, clean_project_name, class_prefix.upcase, File.join(Dir.pwd, clean_project_name)] invoke FWToolkit::Cocoapods, 'install', [destination_root] git_repo = GitClient::Repository.new destination_root if(git_repo.initialized?) say_status :skip, 'The git repository is already initialized', :yellow else invoke FWToolkit::Git, 'new', [destination_root] end end
update(project_root=Dir.pwd)
click to toggle source
# File lib/fwtoolkit/cli/project.rb, line 72 def update(project_root=Dir.pwd) bundle_update invoke FWToolkit::Git, 'update', [project_root] invoke FWToolkit::Cocoapods, 'install', [project_root] end
Private Instance Methods
bundle_update()
click to toggle source
# File lib/fwtoolkit/cli/project.rb, line 82 def bundle_update if File.exists? 'Gemfile' say 'Installing bundle' begin retried ||= false run! "gem install bundler", :capture => true run! "bundle install", :capture => true rescue Thor::Error retried = true retry unless retried end else say 'No gemfile found' end end