cnvrg 0.0.141 → 0.0.142

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: 926f82dfe1bfcf71e51c1218b90c197dcd9ee717
4
- data.tar.gz: 87668443ad37a85c376c92c38599a23b2475e036
3
+ metadata.gz: 7f3ba812e5bf66ccca1986f737c625b53c75d5b0
4
+ data.tar.gz: 7c1b005345d57ba58963a4876f00ff8c696a7a56
5
5
  SHA512:
6
- metadata.gz: c7996005a060813f1b2405a60b020bcc6ea56cc97ea8f165e903958a588a2de4178f7588ac64bbc4a5a2dbde43deeccd49fe959b065905e85171cef8a2d0cd51
7
- data.tar.gz: c9ce755b4f9e3ed0a2d400c3d7bbe3a14f318a1b8fed87b9fd31d8facda64cca78e28d75de923d7d23cb97b465afb620b95463570a98354aa0f03887ee137d25
6
+ metadata.gz: ce33216128fd56fc342b100a7f5f9d63028281114c9f8fd933f1244250a57cdeff3ae98481a5e13e81a25d986f4ec04de8a21f684ca4c2b9eaa074c36f7d2a94
7
+ data.tar.gz: d3bba3d2a25768d00b8e5cdeb09d25cf935367a38368e0164f5fd7cfe76370b7bfd3cbd45cb967684eb6e5c5ab2c0bd3af54e6e3bca2785b6ad71c26d2d4af65
data/lib/cnvrg/cli.rb CHANGED
@@ -738,7 +738,7 @@ module Cnvrg
738
738
  method_option :ignore, :type => :array, :aliases => ["-i", "--i"], :desc => "ignore following files"
739
739
  method_option :new_branch, :type => :boolean, :aliases => ["-nb", "--nb"], :desc => "create new branch of commits"
740
740
  method_option :verbose, :type => :boolean, :aliases => ["--v"], :default => false
741
- method_option :sync, :type => :boolean, :aliases => ["--v"], :default => false
741
+ method_option :sync, :type => :boolean, :aliases => ["--s"], :default => false
742
742
 
743
743
  def upload(link=false, sync=false)
744
744
 
@@ -755,6 +755,12 @@ module Cnvrg
755
755
  end
756
756
  new_branch = options["new_branch"] || false
757
757
 
758
+ if options["sync"] or sync
759
+ new_branch_exp = @project.get_new_branch
760
+ if new_branch_exp
761
+ new_branch = new_branch_exp
762
+ end
763
+ end
758
764
  result = @project.compare_idx(new_branch)
759
765
  commit = result["result"]["commit"]
760
766
  if !link
@@ -770,7 +776,7 @@ module Cnvrg
770
776
  result = result["result"]["tree"]
771
777
  if result["added"].empty? and result["updated_on_local"].empty? and result["deleted"].empty?
772
778
  log_end(0)
773
- say "Project is up to date", Thor::Shell::Color::GREEN unless options["sync"]
779
+ say "Project is up to date", Thor::Shell::Color::GREEN unless (options["sync"] or sync)
774
780
  return true
775
781
  end
776
782
  update_count = 0
@@ -784,7 +790,7 @@ module Cnvrg
784
790
  say "Updating #{update_total} files", Thor::Shell::Color::BLUE
785
791
  end
786
792
  else
787
- say "Syncing files", Thor::Shell::Color::BLUE unless options["sync"]
793
+ say "Syncing files", Thor::Shell::Color::BLUE unless (options["sync"] or sync)
788
794
 
789
795
  end
790
796
 
@@ -880,7 +886,7 @@ module Cnvrg
880
886
  end
881
887
  say "Total of #{update_count} / #{update_total} files.", Thor::Shell::Color::GREEN
882
888
  else
883
- say "#{check} Changes were updated successfully", Thor::Shell::Color::GREEN unless options["sync"]
889
+ say "#{check} Changes were updated successfully", Thor::Shell::Color::GREEN unless (options["sync"] or sync)
884
890
 
885
891
  end
886
892
 
@@ -915,7 +921,7 @@ module Cnvrg
915
921
  desc 'download', 'Download updated files'
916
922
  method_option :new_branch, :type => :boolean, :aliases => ["-nb", "--nb"], :desc => "create new branch of commits"
917
923
  method_option :verbose, :type => :boolean, :aliases => ["--v"], :default => false
918
- method_option :sync, :type => :boolean, :aliases => ["--v"], :default => false
924
+ method_option :sync, :type => :boolean, :aliases => ["--s"], :default => false
919
925
 
920
926
  def download
921
927
  begin
@@ -1326,12 +1332,10 @@ module Cnvrg
1326
1332
  end
1327
1333
  if sync_after
1328
1334
  # Sync after run
1329
- if !commit.nil?
1330
- invoke :sync, [], :new_branch => true
1331
1335
 
1332
- else
1333
- invoke :sync, [], :new_branch => false
1334
- end
1336
+ download()
1337
+ upload(link=false, sync=true)
1338
+
1335
1339
  end
1336
1340
  end_commit = @project.last_local_commit
1337
1341
 
@@ -1341,6 +1345,7 @@ module Cnvrg
1341
1345
  log_end(0)
1342
1346
  end
1343
1347
  rescue => e
1348
+ puts e
1344
1349
  log_end(-1, e.message)
1345
1350
  if container
1346
1351
  container.stop()
data/lib/cnvrg/project.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'fileutils'
2
2
  module Cnvrg
3
3
  class Project
4
- attr_reader :slug, :owner, :title, :local_path
4
+ attr_reader :slug, :owner, :title, :local_path, :working_dir
5
5
 
6
6
  RemoteURL ||= "https://cnvrg.io"
7
7
 
@@ -12,6 +12,7 @@ module Cnvrg
12
12
  @title = config[:project_name]
13
13
  @slug = config[:project_slug]
14
14
  @owner = config[:owner]
15
+ @working_dir = project_home
15
16
  rescue => e
16
17
  end
17
18
 
@@ -205,6 +206,26 @@ module Cnvrg
205
206
  end
206
207
  return true
207
208
  end
209
+ def update_is_new_branch(new_branch)
210
+ config = YAML.load_file(@working_dir+"/.cnvrg/config.yml")
211
+ config[:new_branch] = new_branch
212
+ File.open(@working_dir+"/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
213
+ end
214
+ def get_new_branch
215
+ begin
216
+ config = YAML.load_file(@working_dir+"/.cnvrg/config.yml")
217
+ return config[:new_branch]
218
+ rescue =>e
219
+ return false
220
+
221
+ end
222
+ end
223
+
224
+ def remove_new_branch
225
+ config = YAML.load_file(@working_dir+"/.cnvrg/config.yml")
226
+ new_config = config.except(:new_branch)
227
+ File.open(@working_dir+"/.cnvrg/config.yml", "w+") { |f| f.write new_config.to_yaml }
228
+ end
208
229
 
209
230
  def generate_idx
210
231
  if File.exists? "#{self.local_path}/.cnvrg/idx.yml"
@@ -268,6 +289,7 @@ module Cnvrg
268
289
  end
269
290
  response = Cnvrg::API.request("users/#{self.owner}/projects/#{self.slug}/commit/compare", 'POST', {current_commit: commit})
270
291
  CLI.is_response_success(response)
292
+ update_is_new_branch(response["result"]["new_branch"])
271
293
  return response["result"]["new_branch"]
272
294
  end
273
295
 
data/lib/cnvrg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Cnvrg
2
- VERSION = '0.0.141'
2
+ VERSION = '0.0.142'
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cnvrg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.141
4
+ version: 0.0.142
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yochay Ettun
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-25 00:00:00.000000000 Z
12
+ date: 2017-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler