qc 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b159745ecb461362b83ce2d4b572c8bf07e596cd
4
- data.tar.gz: 79822dc34a1b9c62bbe03138ba639bc8ac2811bf
3
+ metadata.gz: 34a307ccaef5a7dc299ed283d6f229402adbb021
4
+ data.tar.gz: 5cfb5ad18b2e6b3e7b62d11c30ebdbca63d818e7
5
5
  SHA512:
6
- metadata.gz: ea1ae9deeeb23d4f3c3054960fcb093a9e0fd77a0483abef8fe0a97091de3759b1ac7f83f286cb48651460a5f2b926848a9770f034b6c05407206f52d6581410
7
- data.tar.gz: c282299c009a0f12452e78baad8d690b0fa6c26da02b10c0ce68ac0ce83af36f40b973dc6a04fb7e6750b7820817f54aaa607613e63764ca19d86ff658f43188
6
+ metadata.gz: 7ed552c60e6926e6de18866afbbc3e6dce432885de8f9344f277f94eea1191016b2750a1d151a2c608b07ef1fc803260c5139caf57fbeb38bd6763fce844af5e
7
+ data.tar.gz: 4d5cd11ed858542aab4da989bba74d5f35f247d95593379745f797051fcd52157731304288ca691fa40638c201126d105de74118b09b838662af5d766221b857
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qc (0.6.2)
4
+ qc (0.6.3)
5
5
  rest-client (~> 2.0.2)
6
6
  vcr (~> 3.0.3)
7
7
  webmock (~> 3.1.0)
data/README.md CHANGED
@@ -12,6 +12,8 @@ Qc is distributed as a ruby gem. You can install it with:
12
12
  gem install qc
13
13
  ```
14
14
 
15
+ Qc requires Ruby version 2.3 or greater.
16
+
15
17
  ## Workflow
16
18
 
17
19
  1. Run `qc login` for introducing your QuantConnect credentials
data/bin/qc CHANGED
@@ -3,5 +3,5 @@
3
3
  $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
4
4
  require 'qc'
5
5
 
6
- status = Qc::Console.new.run(ARGV) ? 0 : 1
6
+ status = Qc::CLI.new.run(ARGV) ? 0 : 1
7
7
  exit status
@@ -0,0 +1,10 @@
1
+ # Qc Changelog
2
+
3
+ ## 6.0.3
4
+
5
+ - Fix: Weird initial character in synced files #3
6
+ - Removes `awesome-print` dependency #2
7
+ - Adds option to ignore files in `.qc/settings.yml` #4
8
+
9
+
10
+
data/lib/qc.rb CHANGED
@@ -2,7 +2,6 @@ require 'fileutils'
2
2
  require 'yaml'
3
3
  require 'rest-client'
4
4
  require 'json'
5
- require 'awesome_print'
6
5
  require 'optparse'
7
6
 
8
7
  Dir[File.join(__dir__, "qc/**/*.rb")].each { |f| require f }
@@ -1,5 +1,5 @@
1
1
  module Qc
2
- class Console
2
+ class CLI
3
3
  def initialize
4
4
  end
5
5
 
@@ -1,6 +1,7 @@
1
1
  module Qc
2
2
  class CommandRunner
3
3
  DEFAULT_FILE_EXTENSIONS = 'cs,py'
4
+ DEFAULT_IGNORED_FILES = ['AssemblyInfo.cs']
4
5
 
5
6
  SUPPORTED_COMMANDS =%i(login logout init push compile backtest open)
6
7
  COMPILE_POLLING_DELAY_IN_SECONDS = 2
@@ -43,10 +44,17 @@ module Qc
43
44
  if ::File.exist?(project_settings_file)
44
45
  YAML.load(::File.open(project_settings_file))
45
46
  else
46
- Qc::ProjectSettings.new
47
+ build_fresh_project_settings
47
48
  end
48
49
  end
49
50
 
51
+ def build_fresh_project_settings
52
+ Qc::ProjectSettings.new.tap do |project_settings|
53
+ project_settings.ignored_files = DEFAULT_IGNORED_FILES
54
+ end
55
+
56
+ end
57
+
50
58
  def logged_in?
51
59
  !!credentials
52
60
  end
@@ -216,8 +224,7 @@ module Qc
216
224
 
217
225
  def ask_for_value(question)
218
226
  puts question
219
- v = STDIN.gets
220
- v.chomp
227
+ STDIN.gets.chomp
221
228
  end
222
229
 
223
230
  def ask_for_project
@@ -251,19 +258,36 @@ module Qc
251
258
 
252
259
  changed_files.each do |file|
253
260
  puts "Uploading #{file}..."
254
- content = ::File.read file
261
+ content = ::File.read(file).strip
255
262
  quant_connect_proxy.put_file project_settings.project_id, ::File.basename(file), content
256
263
  end
257
264
  end
258
265
 
259
266
  def changed_files
260
- all_files = Dir["**/*.{#{project_settings.file_extensions}}"]
267
+ all_files = fetch_all_files
261
268
 
262
269
  return all_files unless project_settings.last_sync_at
263
270
 
264
- all_files.find_all do |file|
271
+ changed_files = all_files.find_all do |file|
265
272
  ::File.mtime(file) > project_settings.last_sync_at
266
273
  end
274
+
275
+ changed_files
276
+ end
277
+
278
+ def fetch_all_files
279
+ Dir["**/*.{#{project_settings.file_extensions}}"].reject{|file| ignore_file?(file) }
280
+ end
281
+
282
+ def ignore_file?(file)
283
+ puts ignored_files.inspect
284
+ ignored_files.find do |ignored_file|
285
+ file =~ /#{ignored_file}/
286
+ end
287
+ end
288
+
289
+ def ignored_files
290
+ project_settings.ignored_files || DEFAULT_IGNORED_FILES
267
291
  end
268
292
 
269
293
  def save_current_timestamp
@@ -1,5 +1,5 @@
1
1
  module Qc
2
- class ProjectSettings< Struct.new(:project_id, :file_extensions, :last_sync_at, :last_compile_id, :last_backtest_id)
2
+ class ProjectSettings< Struct.new(:project_id, :file_extensions, :last_sync_at, :last_compile_id, :last_backtest_id, :ignored_files)
3
3
 
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module Qc
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-16 00:00:00.000000000 Z
11
+ date: 2017-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -130,11 +130,12 @@ files:
130
130
  - bin/console
131
131
  - bin/qc
132
132
  - bin/setup
133
+ - changelog.md
133
134
  - lib/qc.rb
134
135
  - lib/qc/backtest.rb
136
+ - lib/qc/cli.rb
135
137
  - lib/qc/command_runner.rb
136
138
  - lib/qc/compile.rb
137
- - lib/qc/console.rb
138
139
  - lib/qc/credentials.rb
139
140
  - lib/qc/file.rb
140
141
  - lib/qc/project.rb