fanforce-app-factory 2.0.0.rc19 → 2.0.0.rc20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2beed20d90586f791c24b947af4c4ce6a5d7b57f
4
- data.tar.gz: fb0a346fe303278e934d93270d9388b9877eb8d7
3
+ metadata.gz: 17ece4c5cc5a95c54cdff33adbdcefebee46719a
4
+ data.tar.gz: 288e641f3a7e4c34d61907a18d24f05586c2a4ab
5
5
  SHA512:
6
- metadata.gz: 8e89a8661c9e292dfc757f4178dd4ff3823700b70a7331430b49e02e8ddee77648113de63c7dd90a904e65b109aa4a5a529366b87d5c936b444b9b1e715efa27
7
- data.tar.gz: 797b1fb3a86e95bc7cd5279033b58a5db23b2107ddd80a2d50eec9331dec2f63fa4191e5ce378f6173a70ed9c4b48c7336fe96069a7f71824aa1a246dd158053
6
+ metadata.gz: 24dc4476764b83874f53756b9bd22a9fc67a27c10dd5a5cf049c643db6def68fa20424d8b27cb7cd0922f8554bd44da5ee33cebe270742dbd3816372d72ea92f
7
+ data.tar.gz: c41a43a975a592b0aafb330d65916451652caa13b0db3ddc5281a2df3dd1cd58f6dca214ded1f593e1e12ecf20636bd84b05f268519ab1da85fd8396691a64ab
@@ -1,5 +1,6 @@
1
1
  require 'bitbucket_rest_api'
2
2
  require 'rest_client'
3
+ require 'open3'
3
4
 
4
5
  class Fanforce::AppFactory::CLI::Bitbucket
5
6
  include Fanforce::AppFactory::CLI::Utils
@@ -45,22 +46,24 @@ class Fanforce::AppFactory::CLI::Bitbucket
45
46
  end
46
47
 
47
48
  def setup_git_remote(repo_name)
48
- if (`git remote`).split(/\r?\n/).include?(config[:bitbucket][:user])
49
- puts "#{'Updated '.format(:green,:bold)}" + "git remote for #{config[:bitbucket][:user]}"
50
- `git remote rm #{config[:bitbucket][:user]}`
51
- elsif (`git remote`).split(/\r?\n/).include?('bitbucket')
52
- `git remote rm bitbucket`
53
- puts "#{'Removed '.format(:red,:bold)}" + "git remote for #{config[:bitbucket][:user]}"
54
- puts "#{'Created '.format(:green,:bold)}" + 'git remote for bitbucket'
55
- else
56
- puts "#{'Created '.format(:green,:bold)}" + 'git remote for bitbucket'
57
- end
49
+ Dir.chdir(app.dir) do
50
+ if console_command('git remote').split(/\r?\n/).include?('bitbucket')
51
+ log "#{'Found '.format(:green,:bold)}" + 'git remote for bitbucket'
52
+ else
53
+ console_command("git remote add bitbucket git@bitbucket.org:#{config[:bitbucket][:user]}/#{repo_name}.git")
54
+ console_command('git fetch bitbucket')
55
+ log "#{'Created '.format(:green,:bold)}" + 'git remote for bitbucket'
56
+ end
58
57
 
59
- `git remote add bitbucket git@bitbucket.org:#{config[:bitbucket][:user]}/#{repo_name}.git`
60
- `git branch -u bitbucket/master` if `git rev-parse --abbrev-ref master@{upstream}`.include?('fatal')
58
+ upstream_error = Open3.popen3('git rev-parse --abbrev-ref master@{upstream}')[2].gets.to_s
59
+ if upstream_error.include?('fatal')
60
+ console_command('git branch -u bitbucket/master')
61
+ log "#{'Connected '.format(:green,:bold)}" + 'upstream to bitbucket/master'
62
+ end
61
63
 
62
- puts "#{'Pushing '.format(:green,:bold)}" + "latest commit to #{config[:bitbucket][:user]}..."
63
- console_command('git push bitbucket --all')
64
+ log "#{'Pushing '.format(:green,:bold)}" + "latest commit to #{config[:bitbucket][:user]}..."
65
+ console_command('git push bitbucket --all', true)
66
+ end
64
67
  end
65
68
 
66
69
  def create_repo(repo_name)
@@ -14,7 +14,7 @@ class Fanforce::AppFactory::CLI::Bundler
14
14
  puts 'DONE'
15
15
  end
16
16
 
17
- console_command('bundle')
17
+ console_command('bundle', true)
18
18
  puts 'DONE'.format(:green)
19
19
  end
20
20
 
@@ -9,7 +9,7 @@ module Fanforce::AppFactory::CLI::Utils
9
9
 
10
10
  @@config = nil
11
11
 
12
- def console_command(command, print_now=true)
12
+ def console_command(command, print_now=false)
13
13
  output = []
14
14
  PTY.spawn(command) do |stdin, stdout, pid|
15
15
  stdin.each { |line| output << line; print line if print_now }
@@ -13,7 +13,7 @@ class Fanforce::AppFactory::CLI::Scripts
13
13
  def setup(type=:all)
14
14
  app = Fanforce::CLI::App.new(Fanforce::CLI::DIR)
15
15
  type = type.to_s.downcase.to_sym
16
- error 'Unknown setup type', :setup if ![:all,:bundler,:pow,:git,:env,:uranium].include?(type)
16
+ error 'Unknown setup type', :setup if ![:all,:bundler,:pow,:git,:bitbucket,:env,:uranium].include?(type)
17
17
 
18
18
  if !File.exists?("#{app.dir}/config.ru")
19
19
  error "This does not seem to be a valid app directory since it's missing config.ru"
@@ -132,17 +132,20 @@ class Fanforce::AppFactory::CLI::Scripts
132
132
  end
133
133
  end
134
134
 
135
- def install_factory_gem_locally(version, local_path)
136
- return if !local_path
135
+ def install_factory_gem_locally(version, local_gem_path)
136
+ return if !local_gem_path
137
137
  gem_filepath = nil
138
- Dir.chdir(local_path) do
138
+ Dir.chdir(local_gem_path) do
139
139
  system 'git add -A'
140
140
  system 'rake build'
141
- Dir.glob("#{local_path}/pkg/*.gem").each do |file|
141
+ Dir.glob("#{local_gem_path}/pkg/*.gem").each do |file|
142
142
  break gem_filepath = file if file.include?(version)
143
143
  end
144
144
  end
145
- system "gem install #{gem_filepath}"
145
+ Dir.chdir(Fanforce::CLI::DIR) do
146
+ log "INSTALLING #{gem_filepath}..."
147
+ system "gem install #{gem_filepath}"
148
+ end
146
149
  end
147
150
 
148
151
  end
@@ -15,11 +15,12 @@ class Fanforce::AppFactory::CLI::Scripts
15
15
 
16
16
  Fanforce::CLI.register(self, :setup,
17
17
  ['*all/TYPE', 'Setup bundle, pow, git, and env variables'],
18
- ['bundler', 'Ensure bundler is installed then run bundle'],
19
- ['pow', 'Ensure pow domains are setup correctly'],
20
- ['git', 'Ensure git repository is initialized'],
21
- ['env', 'Create ENV variables from local .env folder'],
22
- ['uranium', 'Register config.json with uranium and add environ']
18
+ ['bundler', 'Ensure bundler is installed then run bundle'],
19
+ ['pow', 'Ensure pow domains are setup correctly'],
20
+ ['git', 'Ensure git repository is initialized'],
21
+ ['bitbucket', 'Setup remote repository on bitbucket'],
22
+ ['env', 'Create ENV variables from local .env folder'],
23
+ ['uranium', 'Register config.json with uranium and add environ']
23
24
  ) { require_relative 'cli/scripts/setup' }
24
25
 
25
26
  ########################################################################################################################
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  class AppFactory
3
- VERSION = '2.0.0.rc19'
3
+ VERSION = '2.0.0.rc20'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-app-factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc19
4
+ version: 2.0.0.rc20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark