commit-live-cli 0.0.13 → 0.0.14
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 +4 -4
 - data/lib/commit-live/api.rb +2 -2
 - data/lib/commit-live/cli.rb +0 -1
 - data/lib/commit-live/lesson/git-helper.rb +0 -2
 - data/lib/commit-live/lesson/open.rb +33 -1
 - data/lib/commit-live/lesson/status.rb +0 -1
 - data/lib/commit-live/tests/runner.rb +4 -1
 - data/lib/commit-live/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e7d087ed2ece99b39781fc88a31f6ad778b9d51e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 034efbe8861b7d13f59da283418f29639e976734
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 07d52777b0fa3e9cef684f37fded154bb8ebe4c1c6f25dccc08088c9ba7f8a516d2cd1c2c7bd8da7a4890ef7796701edf15e49156c90989acd3e6eb0db168205
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 163bb38d935af132654c3a74ae54c672eb8dffc3738b20a4728ba703521e69f7375b8498d0f2fd70eb7ca547a3792d5c0441052efb550beca01119a02ec7ca84
         
     | 
    
        data/lib/commit-live/api.rb
    CHANGED
    
    | 
         @@ -5,8 +5,8 @@ module CommitLive 
     | 
|
| 
       5 
5 
     | 
    
         
             
            	class API
         
     | 
| 
       6 
6 
     | 
    
         
             
            		attr_reader :conn
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            		def initialize()
         
     | 
| 
       9 
     | 
    
         
            -
            			endpoint = CommitLive::Endpoint.new.get()
         
     | 
| 
      
 8 
     | 
    
         
            +
            		def initialize(api_url = nil)
         
     | 
| 
      
 9 
     | 
    
         
            +
            			endpoint = api_url || CommitLive::Endpoint.new.get()
         
     | 
| 
       10 
10 
     | 
    
         
             
            			@conn = Faraday.new(url: endpoint) do |faraday|
         
     | 
| 
       11 
11 
     | 
    
         
             
            				faraday.adapter Faraday.default_adapter
         
     | 
| 
       12 
12 
     | 
    
         
             
            			end
         
     | 
    
        data/lib/commit-live/cli.rb
    CHANGED
    
    
| 
         @@ -4,6 +4,7 @@ require "commit-live/api" 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require "commit-live/github"
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'octokit'
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'git'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require "oj"
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
9 
     | 
    
         
             
            module CommitLive
         
     | 
| 
       9 
10 
     | 
    
         
             
            	class Open
         
     | 
| 
         @@ -46,7 +47,7 @@ module CommitLive 
     | 
|
| 
       46 
47 
     | 
    
         | 
| 
       47 
48 
     | 
    
         
             
            		def openALesson(puzzle_name)
         
     | 
| 
       48 
49 
     | 
    
         
             
            			# get currently active lesson
         
     | 
| 
       49 
     | 
    
         
            -
            			puts "Getting  
     | 
| 
      
 50 
     | 
    
         
            +
            			puts "Getting lesson..."
         
     | 
| 
       50 
51 
     | 
    
         
             
            			lesson.getCurrentLesson(puzzle_name)
         
     | 
| 
       51 
52 
     | 
    
         | 
| 
       52 
53 
     | 
    
         
             
            			if !ALLOWED_TYPES.include? lesson_type
         
     | 
| 
         @@ -67,6 +68,9 @@ module CommitLive 
     | 
|
| 
       67 
68 
     | 
    
         
             
            				if lesson_type == "LAB" && !lesson_forked
         
     | 
| 
       68 
69 
     | 
    
         
             
            					lesson_status.update('forked', lesson_name)
         
     | 
| 
       69 
70 
     | 
    
         
             
            				end
         
     | 
| 
      
 71 
     | 
    
         
            +
            				if lesson_type == "PRACTICE"
         
     | 
| 
      
 72 
     | 
    
         
            +
            					open_lesson
         
     | 
| 
      
 73 
     | 
    
         
            +
            				end
         
     | 
| 
       70 
74 
     | 
    
         
             
            			end
         
     | 
| 
       71 
75 
     | 
    
         
             
            			# install dependencies
         
     | 
| 
       72 
76 
     | 
    
         
             
            			# cd into it and invoke bash
         
     | 
| 
         @@ -116,5 +120,33 @@ module CommitLive 
     | 
|
| 
       116 
120 
     | 
    
         
             
            			puts "Done."
         
     | 
| 
       117 
121 
     | 
    
         
             
            			exec("#{ENV['SHELL']} -l")
         
     | 
| 
       118 
122 
     | 
    
         
             
            		end
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
            		def open_lesson
         
     | 
| 
      
 125 
     | 
    
         
            +
            			begin
         
     | 
| 
      
 126 
     | 
    
         
            +
            				Timeout::timeout(15) do
         
     | 
| 
      
 127 
     | 
    
         
            +
            					api = CommitLive::API.new("https://chat.commit.live")
         
     | 
| 
      
 128 
     | 
    
         
            +
            					netrc = CommitLive::NetrcInteractor.new()
         
     | 
| 
      
 129 
     | 
    
         
            +
            					netrc.read(machine: 'ga-extra')
         
     | 
| 
      
 130 
     | 
    
         
            +
            					username = netrc.login
         
     | 
| 
      
 131 
     | 
    
         
            +
            					url = URI.escape("/send/#{username}")
         
     | 
| 
      
 132 
     | 
    
         
            +
            					message = {
         
     | 
| 
      
 133 
     | 
    
         
            +
            						'type': 'open-lesson',
         
     | 
| 
      
 134 
     | 
    
         
            +
            						'title': lesson_name
         
     | 
| 
      
 135 
     | 
    
         
            +
            					}
         
     | 
| 
      
 136 
     | 
    
         
            +
            					response = api.post(
         
     | 
| 
      
 137 
     | 
    
         
            +
            						url,
         
     | 
| 
      
 138 
     | 
    
         
            +
            						headers: {
         
     | 
| 
      
 139 
     | 
    
         
            +
            							'content-type': 'application/json',
         
     | 
| 
      
 140 
     | 
    
         
            +
            						},
         
     | 
| 
      
 141 
     | 
    
         
            +
            						body: {
         
     | 
| 
      
 142 
     | 
    
         
            +
            							'message': Oj.dump(message, mode: :compat),
         
     | 
| 
      
 143 
     | 
    
         
            +
            						}
         
     | 
| 
      
 144 
     | 
    
         
            +
            					)
         
     | 
| 
      
 145 
     | 
    
         
            +
            				end
         
     | 
| 
      
 146 
     | 
    
         
            +
            			rescue Timeout::Error
         
     | 
| 
      
 147 
     | 
    
         
            +
            				puts "Open Lesson WebSocket call failed."
         
     | 
| 
      
 148 
     | 
    
         
            +
            				exit
         
     | 
| 
      
 149 
     | 
    
         
            +
            			end
         
     | 
| 
      
 150 
     | 
    
         
            +
            		end
         
     | 
| 
       119 
151 
     | 
    
         
             
            	end
         
     | 
| 
       120 
152 
     | 
    
         
             
            end
         
     | 
| 
         @@ -55,15 +55,19 @@ module CommitLive 
     | 
|
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
            		def run(updateStatus = true)
         
     | 
| 
       57 
57 
     | 
    
         
             
            			clear_changes_in_tests
         
     | 
| 
      
 58 
     | 
    
         
            +
            			puts 'Testing lesson...'
         
     | 
| 
       58 
59 
     | 
    
         
             
            			strategy.check_dependencies
         
     | 
| 
       59 
60 
     | 
    
         
             
            			strategy.configure
         
     | 
| 
       60 
61 
     | 
    
         
             
            			results = strategy.run
         
     | 
| 
       61 
62 
     | 
    
         
             
            			if updateStatus
         
     | 
| 
       62 
63 
     | 
    
         
             
            				if results
         
     | 
| 
       63 
64 
     | 
    
         
             
            					# test case passed
         
     | 
| 
      
 65 
     | 
    
         
            +
            					puts 'Great! You have passed all the test cases.'
         
     | 
| 
      
 66 
     | 
    
         
            +
            					puts 'Use `clive submit` to push your changes.'
         
     | 
| 
       64 
67 
     | 
    
         
             
            					CommitLive::Status.new().update('test_case_pass', lesson_name)
         
     | 
| 
       65 
68 
     | 
    
         
             
            				else
         
     | 
| 
       66 
69 
     | 
    
         
             
            					# test case failed
         
     | 
| 
      
 70 
     | 
    
         
            +
            					puts 'Oops! You still have to pass all the test cases.'
         
     | 
| 
       67 
71 
     | 
    
         
             
            					CommitLive::Status.new().update('test_case_fail', lesson_name)
         
     | 
| 
       68 
72 
     | 
    
         
             
            				end
         
     | 
| 
       69 
73 
     | 
    
         
             
            			end
         
     | 
| 
         @@ -71,7 +75,6 @@ module CommitLive 
     | 
|
| 
       71 
75 
     | 
    
         
             
            				dump_results
         
     | 
| 
       72 
76 
     | 
    
         
             
            			end
         
     | 
| 
       73 
77 
     | 
    
         
             
            			strategy.cleanup
         
     | 
| 
       74 
     | 
    
         
            -
            			puts 'Done.'
         
     | 
| 
       75 
78 
     | 
    
         
             
            			return results
         
     | 
| 
       76 
79 
     | 
    
         
             
            		end
         
     | 
| 
       77 
80 
     | 
    
         | 
    
        data/lib/commit-live/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: commit-live-cli
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.14
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - greyatom
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017-05- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-05-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |