70 Commits

Author SHA1 Message Date
Allan Odgaard
b5b36a558b Add missing framework dependencies 2019-06-26 13:21:11 +02:00
Allan Odgaard
f92d36571a Use DISPATCH_APPLY_AUTO instead of explicit global queue
This is “strongly recommended” (according to `man dispatch_apply`) and should work on 10.9 and later (according to a WWDC session).
2018-11-12 19:15:12 +07:00
Allan Odgaard
f6fa273912 Update coding style for where to place colon after dictionary keys
This follows the Swift style and also makes it possible to align dictionary values using TextMate’s Align Assignments command.
2018-10-07 09:54:45 +02:00
Allan Odgaard
75d4c29f11 Change etag network filter to a general header (capture) filter 2017-10-08 09:19:49 +02:00
Allan Odgaard
4d86258e47 Use new alert style enumeration names (10.12) 2017-05-31 21:58:31 +02:00
Ronald Wampler
038acacca9 Avoid use of NSRunAlertPanel (10.9)
Although this is actually deprecated in 10.10, new APIs are available in 10.9 and it will make addressing deprecation warnings when upgrading to 10.10 easier.
2017-05-31 21:58:31 +02:00
Ronald Wampler
dfc9db4413 Use our NSAlert category method for creating NSAlert objects 2017-05-31 10:03:41 +02:00
Allan Odgaard
c4370ee029 Create destination’s parent folder when moving Bundles 2016-10-12 10:43:42 +02:00
Allan Odgaard
e3364c3b11 Add another LEGACY marker 2016-10-12 10:43:42 +02:00
Allan Odgaard
5af64db166 Ask user to move Avian bundles into TextMate’s application support 2016-10-10 22:39:44 +02:00
Allan Odgaard
3a8f524803 Read and install bundles in TextMate folder (instead of Avian) 2016-10-10 22:39:44 +02:00
Allan Odgaard
dc1406e32e Use AND/OR/NOT with NSPredicate instead of the C equivalents
The BNF for NSCompoundPredicate only lists the former keywords, not the C syntax (not that it has caused any problems to use it).
2016-10-10 22:38:05 +02:00
Allan Odgaard
7cc017f343 Harmonize all implementations of sharedInstance 2016-09-19 12:54:19 +02:00
Allan Odgaard
0d7390cdc3 Use path::rename_or_copy for TextMate’s own data files 2016-08-29 07:48:37 +02:00
Allan Odgaard
46fb745bbe Use perrorf when printing errors with dynamic strings
Also revise error messages to be more consistent.
2016-08-28 17:25:26 +02:00
Allan Odgaard
ab6c91b1c4 Let BundlesManager observe user defaults for disabling update checks 2016-06-29 23:24:17 +02:00
Allan Odgaard
caf8ee5b1f Change API and implementation of BundlesManager
We now have an Objective-C type that can be used in the UI to show various properties of a bundle.

This commit breaks compatibility with the current bundles preferences page.
2016-06-29 14:21:55 +02:00
Allan Odgaard
417193e089 Update link dependencies for all targets
Some targets were including headers from frameworks not specified in their link dependencies. For a clean build this could cause an issue because the header was not available at the time of building the target.

The updated link dependencies are also based on what a target’s tests require. Ideally tests would have separate link dependencies, but as we don’t want to maintain this manually, this will have to wait until the build system automatically handles link dependencies.

Currently the commit command uses constants from the CommitWindow framework but should actually not be linked with it. However, the optimizer will strip dead code, so it should not result in much if any difference in the resulting binary and does solve a build dependency issue.
2016-05-07 13:00:55 +02:00
Allan Odgaard
bf4cbd33fa Remove NSString* typecast when using to_s helper
This has a small run-time cost but source looks better and theoretically safer code.
2014-11-29 09:53:40 +07:00
Allan Odgaard
cb22cc0228 Make bundle update frequency configurable
This is introduced only for testing.
2014-04-28 18:23:51 +07:00
Allan Odgaard
8b02bb2809 Do not update a bundle if it requires a newer version of TextMate 2014-04-28 18:23:51 +07:00
Allan Odgaard
5248129566 When failing to update a bundle we would claim “download error”
We would even output it two times.
2014-04-21 17:05:35 +07:00
Allan Odgaard
9790644fbd Track implicitly installed bundles 2014-04-14 14:26:52 +07:00
Allan Odgaard
c2397484b8 Use C++11 for loop
Majority of the edits done using the following ruby script:

    def update_loops(src)
      dst, cnt = '', 0

      block_indent, variable = nil, nil
      src.each_line do |line|
        if block_indent
          if line =~ /^#{block_indent}([{}\t])|^\t*$/
            block_indent = nil if $1 == '}'
            line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
              $1.to_s + variable + ($2 == "->" ? "." : "")
            end
          else
            block_indent = nil
          end
        elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
          block_indent, variable = $1, $2
          line = "#$1for(auto const& #$2 : #$3\n"
          cnt += 1
        end
        dst << line
      end
      return dst, cnt
    end

    paths.each do |path|
      src = IO.read(path)

      cnt = 1
      while cnt != 0
        src, cnt = update_loops(src)
        STDERR << "#{path}: #{cnt}\n"
      end

      File.open(path, "w") { |io| io << src }
    end
2014-03-03 10:34:13 +07:00
Allan Odgaard
be2eff9825 When replaying fs-events we would not reload changed items
When we see a changed item we drop it from the cache and mark the cache as “incomplete”, indicating that the bundle index should be rebuilt, which in turn causes all known items to be fetched, and the cache will thereby reload the updated entries.

However, when replaying fs-events, we are in a “rebuild index” state and would not re-rebuild the index incase items were dropped.
2014-02-19 20:11:52 +07:00
Allan Odgaard
4f5f20947a Ensure pending bundle index changes are saved during quit 2014-02-19 19:37:39 +07:00
Allan Odgaard
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
5c02b4ff5c Use cap’n proto for bundle index
This makes loading time roughly twice as fast, although some of the speed gain is because we no longer need to convert CFPropertyListRef → plist::any_t.
2013-08-18 17:29:29 +02:00
Allan Odgaard
5d5399ecd9 Add member data accessor for cache_t’s content filter function 2013-08-16 22:40:09 +02:00
Allan Odgaard
62a16dd6a9 Do recursive rescan of updated bundles
Previously we would rescan the parent path which was effectively a no-op.

Also pass the “recursive” flag from fs-events to cache_t::reload.
2013-08-02 15:30:48 +02:00
Allan Odgaard
171cf05981 Use cache_t::erase when uninstalling a bundle 2013-08-02 15:26:59 +02:00
Allan Odgaard
9fd20df7b6 Remove code to cleanup old cache files 2013-08-01 22:33:19 +02:00
Jacob Bandes-Storch
5bfd29b604 Move load_bundles to bundles framework 2013-07-28 21:57:51 +02:00
Jacob Bandes-Storch
d89571956d Move fs_cache to plist framework 2013-07-28 21:57:50 +02:00
Jacob Bandes-Storch
f2df57df60 Rename “index.{cc,h}” to the more appropriate “item.{cc,h}” 2013-07-28 21:57:31 +02:00
Allan Odgaard
241d105dc9 Skip loading Bundles → TextMate → Update Notification (⌘Q)
The bundle item is causing ⌘Q to act subtlety different (issue #1031) but as we still see a lot of users on old versions, the item is still valuable to keep around.
2013-06-22 21:02:45 +07:00
Allan Odgaard
ed9396ed84 Workaround for a wrong bundle index
This is work in progress, the reason why the situation arise has not yet been found and there are likely other ways in which the index can be wrong/stale (based on user reports like issue #998).
2013-06-15 16:05:48 +07:00
Allan Odgaard
05bb8d3304 Log malformed UUID incase of error
This is instead of showing “no valid UUID” (which could mean either missing or malformed).
2013-05-26 13:16:22 +08:00
Allan Odgaard
cdb75619ca Add completion callback to installBundle: 2013-04-23 18:52:08 +07:00
Allan Odgaard
34d92253dd Don’t log unchanged sources as failures 2013-04-13 22:37:51 +07:00
Allan Odgaard
931b56f45c Fix crash related to updating bundles
Since we get the failed sources by a const reference it is only live during the scope of the caller, and our use of blocks makes that scope shorter than the called block’s full scope.
2013-04-10 18:12:49 +07:00
Allan Odgaard
0111e6d089 Rework bundle update scheduling
We now store the time of last check in user defaults instead of via extended attributes on the source(s) and do a check every third hour, except of errors, where we retry after 30 minutes.

We now also check for bundle updates even if the sources hasn’t been updated. This is incase we previously updated a source but failed to then update bundles, these will now be updated when we retry, rather than next time the source index has updates.

Overall the code should be simpler and thus more robust. The text in the Bundles preferences page has also been improved slightly in that it will now tell the user if there was a problem updating the bundles, although for the specifics, the user will need to grab the log.
2013-04-09 15:39:38 +07:00
Allan Odgaard
58b101a7db Improve error log message for duplicate UUID
We now output the path of the item which use the same UUID.
2013-04-09 15:39:38 +07:00
Allan Odgaard
8358ffb578 Add “find bundle for new items” API
We need this when installing standalone bundle items, saving macros, and when creating items in the bundle editor without a bundle selected.

The user experience of this code is however rather poor in that you can’t actually crete new bundles, the dialog text is not specific, and the logic for what bundle to preselect can be improved (prefer previously created bundle falling back on a local bundle, if any).
2013-03-27 14:15:54 +01:00
Allan Odgaard
8888865f2c Use initializer list constructor for std::map (C++11) 2013-03-27 13:41:07 +01:00
Allan Odgaard
9af77ef3ab Wrong path was rescanned when changing bundles 2013-03-26 21:18:18 +01:00
Allan Odgaard
9c37d61737 Show alert for unimplemented functionality 2013-03-26 16:21:52 +01:00
Allan Odgaard
c1b8cc5454 Force index rescan after bundle (item) install 2013-03-26 16:11:20 +01:00
Allan Odgaard
bffa2eef10 Move bundle installing to BundlesManager 2013-03-26 16:00:53 +01:00
Allan Odgaard
099f7c60ea Improve bundles index code
By making it part of the BundlesManager singleton we can work with the event loop to coalesce reloads and delay saving the index.
2013-03-25 22:56:49 +01:00