def run_init_command(args): """Initialize the envirionment.""" report("Setting up HackApp development env", icon=Icons.lollipop, section=True) report("Starting setup. This is going to take a while, go grab a coffee", color="magenta", section=True, icon=Icons.coffee) print "" sleep(3) if not has_command("pod"): report("Setting up CocoaPods (we may need your password for this)", section=True) run_command("sudo gem install cocoapods --no-ri --no-rdoc") report_success("Installed cocoapods!") report("Testing for brew", section=True) if not has_command("brew"): report("Please install brew to setup the env (go to http://brew.sh/)", color="red") return report_success("Found brew!") report("Updating brew packages", section=True) run_command("brew update") report("Installing iojs", section=True) run_command("brew unlink node") run_command("brew install iojs") run_command("brew link iojs --force") run_command("brew install watchman") run_command("brew install flow") report_success("Installed iojs") report("Instaling global npm packages", section=True) run_command("npm install -g react-native-cli gulp") report("Instaling project npm packages (this may take a while)", section=True) run_command("npm install", hide_output=True) report_success("Installed all node dependencies!") run_patch_es6_modules_command(args) report("Updating pods") run_command("pod install") report_success("All done!") run_command('open HackApp.xcworkspace')
def run_patch_es6_modules_command(args): """patches RN 0.9 to support multiline imports""" if react_native_version() != "0.9.0-rc": report("Non supported react-native version, skipping packager patching.") return patterns_file = "node_modules/react-native/packager/" + \ "react-packager/src/DependencyResolver/replacePatterns.js" content = open(patterns_file).read() if AFTER_PATCH_VERSION in content: report("Your version was already patched, skipping packager patching.") return if BEFORE_PATCH_VERSION not in content: report("Can't find replacement target, skipping packager patching.") return content = content.replace(BEFORE_PATCH_VERSION, AFTER_PATCH_VERSION) open(patterns_file,'w').write(content) report_success("Successfuly patched packager.")
def run_patch_es6_modules_command(args): """patches RN 0.9 to support multiline imports""" if react_native_version() != "0.9.0-rc": report( "Non supported react-native version, skipping packager patching.") return patterns_file = "node_modules/react-native/packager/" + \ "react-packager/src/DependencyResolver/replacePatterns.js" content = open(patterns_file).read() if AFTER_PATCH_VERSION in content: report("Your version was already patched, skipping packager patching.") return if BEFORE_PATCH_VERSION not in content: report("Can't find replacement target, skipping packager patching.") return content = content.replace(BEFORE_PATCH_VERSION, AFTER_PATCH_VERSION) open(patterns_file, 'w').write(content) report_success("Successfuly patched packager.")
def run_atom_init_command(args): """Installing atom related packages.""" run_command( 'apm install linter linter-eslint pigments react tree-view-git-status') report_success("Installed atom packages!") run_command("atom .")
def run_atom_init_command(args): """Installing atom related packages.""" run_command('apm install linter linter-eslint pigments react tree-view-git-status') report_success("Installed atom packages!") run_command("atom .")