lense 0.1.38 → 0.1.39
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/lense.rb +22 -11
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9d7d65178e1451e35da987d1506c2a4deebfc311
         | 
| 4 | 
            +
              data.tar.gz: 88ae8045d093a1a8e0e205d389387f4aeef7fac2
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b032fab4a714bc5506df1e6299dc9cb84cb7b2827508df14b5865b17ee4b1a8c2d65708e7596aa3a64cae1bd076c02416d6c5375ece7b637c534382f1c13252b
         | 
| 7 | 
            +
              data.tar.gz: 69aa8053300cd931ae128c41438aaf95315c5e61bdab41f03020664bf0747b4922d91c2cd57c977a23a1e461d37f77b054a9727e64a3b3d20b6465374e8eb567
         | 
    
        data/lib/lense.rb
    CHANGED
    
    | @@ -6,7 +6,7 @@ require 'sqlite3' | |
| 6 6 | 
             
            class LENSE
         | 
| 7 7 | 
             
              attr_reader :config, :current_course, :lense_file_hash
         | 
| 8 8 |  | 
| 9 | 
            -
              VERSION             = '0.1. | 
| 9 | 
            +
              VERSION             = '0.1.39'
         | 
| 10 10 | 
             
              LENSE_DIR           = File.join(ENV['HOME'],'.lense')
         | 
| 11 11 | 
             
              COURSES_DIR         = File.join(LENSE_DIR,'courses')
         | 
| 12 12 | 
             
              CURRENT_COURSE_FILE = File.join(LENSE_DIR,'current_course')
         | 
| @@ -135,9 +135,14 @@ class LENSE | |
| 135 135 | 
             
              end
         | 
| 136 136 |  | 
| 137 137 | 
             
              def status()
         | 
| 138 | 
            -
                say "Hash : #{@lense_file_hash}"
         | 
| 138 | 
            +
                #say "Hash : #{@lense_file_hash}"
         | 
| 139 139 | 
             
                exit_now!("Not a LENSE project: .lense") unless File.directory?(LOCAL_LENSE_DIR)
         | 
| 140 | 
            -
                @DB.execute("select path from staging;").each  | 
| 140 | 
            +
                @DB.execute("select path from staging;").each do
         | 
| 141 | 
            +
                  |p| say "Staged: #{p[0]}"
         | 
| 142 | 
            +
                  # determine if new file
         | 
| 143 | 
            +
                  # or modified old file
         | 
| 144 | 
            +
                end
         | 
| 145 | 
            +
             | 
| 141 146 | 
             
                # check changes in depenancy files
         | 
| 142 147 | 
             
                # - for each depenceny
         | 
| 143 148 | 
             
                # - - get the current file hash
         | 
| @@ -146,20 +151,26 @@ class LENSE | |
| 146 151 | 
             
              end
         | 
| 147 152 |  | 
| 148 153 | 
             
              def commit()
         | 
| 149 | 
            -
                #  | 
| 150 | 
            -
                #  | 
| 151 | 
            -
                #  | 
| 152 | 
            -
                #  | 
| 154 | 
            +
                # add new files to dependancies
         | 
| 155 | 
            +
                # create a hash for the commit and add to commits
         | 
| 156 | 
            +
                # for all dependancies add current hashes to revisions
         | 
| 157 | 
            +
                # truncate staging
         | 
| 153 158 | 
             
              end
         | 
| 154 159 |  | 
| 155 160 | 
             
              def stage(file)
         | 
| 156 | 
            -
                 | 
| 157 | 
            -
             | 
| 158 | 
            -
             | 
| 161 | 
            +
                if File.file?(file) # and new or modified
         | 
| 162 | 
            +
                  @DB.transaction
         | 
| 163 | 
            +
                  @DB.execute "insert into staging (path) values (?);", file
         | 
| 164 | 
            +
                  @DB.commit
         | 
| 165 | 
            +
                end
         | 
| 159 166 | 
             
              end
         | 
| 160 167 |  | 
| 161 168 | 
             
              def unstage(file)
         | 
| 162 | 
            -
                 | 
| 169 | 
            +
                if File.file?(file)
         | 
| 170 | 
            +
                  @DB.transaction
         | 
| 171 | 
            +
                  @DB.execute "delete from staging where path = ?;", file
         | 
| 172 | 
            +
                  @DB.commit
         | 
| 173 | 
            +
                end
         | 
| 163 174 | 
             
              end
         | 
| 164 175 |  | 
| 165 176 | 
             
              def remove(file)
         |