Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Commit

Permalink
[release] 0.5.5.
Browse files Browse the repository at this point in the history
Merge branch 'release/0.5.5'

* release/0.5.5: (42 commits)
  [version] bump to 0.5.5.
  targets: Update spec for searching for target files.
  spec: Correct order for checking au spec.
  ninja: Fix file loading for targets.
  au: Prevent loading of cmake.vim in diffmode.
  extension: give clang-tidy and clang-check proper args.
  target: Update spec.
  targets: Remove typo!
  commands: Remove typo.
  extension/gnumake: Remove unused variables.
  target: Patch up spec, more ambigious file detection.
  targets: Allow more files to be detected.
  targets: No need to inform about lack of files.
  commands: Prevent dups, cond execution.
  spec: Run rubocop.
  extension: Update specs.
  extension: add info + rubocop on syntastic.
  ctags: add TODO and run rubocop on spec.
  buffer: Add check for 'buftype', update spec.
  au: touch spec, drop check on 'buftype'.
  ...
  • Loading branch information
Jacky Alciné committed Apr 4, 2015
2 parents 9418807 + 494a1d3 commit f085874
Show file tree
Hide file tree
Showing 40 changed files with 486 additions and 349 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.3
2.1.5
29 changes: 15 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GEM
i18n (~> 0.5)
ffi (1.9.6)
formatador (0.2.5)
guard (2.11.1)
guard (2.12.1)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
Expand Down Expand Up @@ -44,10 +44,10 @@ GEM
lumberjack (1.0.9)
method_source (0.8.2)
nenv (0.2.0)
notiffany (0.0.3)
notiffany (0.0.5)
nenv (~> 0.1)
shellany (~> 0.0)
parallel (1.3.3)
parallel (1.3.4)
parallel_tests (1.0.9)
parallel
pry (0.10.1)
Expand All @@ -58,18 +58,19 @@ GEM
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.0)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.1)
shellany (0.0.1)
slop (3.6.0)
spork (0.9.2)
Expand Down
2 changes: 1 addition & 1 deletion Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ guard :rspec, cmd: 'bin/rspec', all_on_start: false, all_after_pass: false, fail
watch('.rspec')
watch(%r{^spec/.+_spec\.rb$})
watch('spec/spec_helper.rb')
watch(%r{^autoload/cmake/(\w+)\.vim$}) { | m | "spec/#{m[1]}_spec.rb" }
watch(%r{^autoload/cmake/(\w+)\.vim$}) { |m| "spec/#{m[1]}_spec.rb" }
end
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Stories in Ready][waffle:img])][waffle:link]
# [CMake Interoperability in Vim][site]

[`cmake.vim 0.5.4`][release] is a Vim plugin that aims to bind [CMake][cmake]
[`cmake.vim 0.5.5`][release] is a Vim plugin that aims to bind [CMake][cmake]
within Vim for your CMake-based projects. This project has not reached a 1.0.0
release and thus isn't fully ready for production.

Expand Down
23 changes: 11 additions & 12 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) do | t |
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/*spec.rb'
end

task :default => :spec
task default: :spec

desc 'Changes the version used in files so far.'
task :bump_version do
files = Dir.glob 'autoload/cmake/**.vim'
files += [ 'plugin/cmake.vim', 'README.markdown', 'doc/cmake.txt', 'CONTRIBUTING.markdown']
files = Dir.glob 'autoload/cmake/**.vim'
files += ['plugin/cmake.vim', 'doc/cmake.txt', '*.markdown']

files.each do | file |
old_version = ENV['OLD_VERSION']
new_version = ENV['NEW_VERSION']
files.each do |_file|
# old_version = ENV['OLD_VERSION']
# new_version = ENV['NEW_VERSION']

# TODO: Read in the data for the file.
# TODO: Replace every occurance of OLD_VERSION with NEW_VERSION.
# TODO: Write that information back to disk.
end
# TODO: Read in the data for the file.
# TODO: Replace every occurance of OLD_VERSION with NEW_VERSION.
# TODO: Write that information back to disk.
end
end

46 changes: 20 additions & 26 deletions autoload/cmake/augroup.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Author: Jacky Alciné <[email protected]>
" License: MIT
" Website: https://jalcine.github.io/cmake.vim
" Version: 0.5.4
" Version: 0.5.5

function s:add_specific_buffer_commands()
augroup cmake.vim
Expand All @@ -18,12 +18,15 @@ function! cmake#augroup#init()
augroup cmake.vim
au!
au VimEnter * call cmake#augroup#on_vim_enter()
au FileReadPost * call cmake#augroup#on_file_read(fnamemodify("<afile>",":p"))
au FileWritePost * call cmake#augroup#on_file_write()
au FileType * call cmake#augroup#on_file_type("<amatch>")
augroup END
endfunction

function! cmake#augroup#on_vim_enter()
if &diff
" We don't want cmake.vim doing any work in diff mode, it slows things down.
endif
" NOTE: This function should handle the initial loading of cmake.vim's
" necessary data in order for it to operate properly. This includes the
" following:
Expand All @@ -37,46 +40,37 @@ function! cmake#augroup#on_vim_enter()
endfunction

function! cmake#augroup#on_buf_enter()
call cmake#util#echo_msg('Applying generic buffer options for this buffer...')
call cmake#util#echo_msg('Refreshing local buffer variables & options...')
call cmake#buffer#set_options()

call cmake#util#echo_msg('Applying values for "&l:path"...')
call cmake#path#refresh()

call cmake#util#echo_msg('Applying values for "&l:makeprg"...')
call cmake#makeprg#set_for_buffer()
call cmake#util#echo_msg('Local buffer variables & options refreshed.')
endfunction

function! cmake#augroup#on_file_type(filetype)
if !cmake#util#has_project()
if !cmake#buffer#has_project()
return
endif

call cmake#util#echo_msg('Applying generic buffer options for this buffer...')
call cmake#buffer#set_options()

if !exists('b:cmake_target')
call cmake#util#echo_msg('No target found for this buffer.')
return
endif

call cmake#util#echo_msg('Applying values for "&l:makeprg"...')
call cmake#makeprg#set_for_buffer()

call cmake#util#echo_msg('Applying values for "&path"...')
call cmake#path#refresh()

call cmake#util#echo_msg('Applying values for "&tags" (will generate if not existing)...')
call cmake#ctags#refresh()

call cmake#util#echo_msg('Applying values for "&flags"....')
call cmake#flags#inject()
if exists('b:cmake_target')
call cmake#flags#inject()
endif

call s:add_specific_buffer_commands()
doau BufEnter <abuf>
redraw
endfunction

function! cmake#augroup#on_buf_write()
call cmake#util#echo_msg('Applying values for "&tags" (will generate if not existing)...')
call cmake#ctags#refresh()
endfunction

function! cmake#augroup#on_file_write()
if exists('b:cmake_target')
call cmake#targets#clear(b:cmake_target)
endif

call cmake#targets#cache()
endfunction
26 changes: 12 additions & 14 deletions autoload/cmake/buffer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@
" Author: Jacky Alciné <[email protected]>
" License: MIT
" Website: https://jalcine.github.io/cmake.vim
" Version: 0.5.4

" Public Function: cmake#buffer#has_project
" Checks if the current buffer follows the following criteria:
" - Has either the 'cpp' or 'c' formats applied.
" - Does it exist in the file system.
" - Check if this entire session has a CMake project associated with it.
" Returns: '1' if this current buffer relates to a CMake project. '0'
" otherwise.
" Version: 0.5.5

" Public Function: cmake#buffer#has_project()
" Checks if the current buffer lives under either the source or binary dir.
" Returns: '1' if the current buffer exists under the CMake sources.
" Returns: '0' if the current buffer does not exist under the CMake sources.
func! cmake#buffer#has_project()
if !empty(&buftype)
return
" Make sure this is a normal buffer.
endif

let l:current_file = expand('%:p')

" Check if this file lives under the source or binary directory.
let l:in_srcdir = (stridx(l:current_file, cmake#util#source_dir(), 0) == 0)
let l:in_bindir = (stridx(l:current_file, cmake#util#binary_dir(), 0) == 0)

if cmake#util#has_project()
return l:in_bindir || l:in_srcdir
endif

return 0
return cmake#util#has_project() && (l:in_bindir || l:in_srcdir)
endfunc

" Public Function:
Expand Down
2 changes: 1 addition & 1 deletion autoload/cmake/cache.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Author: Jacky Alciné <[email protected]>
" License: MIT
" Website: https://jalcine.github.io/cmake.vim
" Version: 0.5.4
" Version: 0.5.5

function! cmake#cache#read_all()
let l:vars_strings = readfile(cmake#util#binary_dir() . '/CMakeCache.txt')
Expand Down
20 changes: 13 additions & 7 deletions autoload/cmake/commands.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Author: Jacky Alciné <[email protected]>
" License: MIT
" Website: https://jalcine.github.io/cmake.vim
" Version: 0.5.4
" Version: 0.5.5

function! cmake#commands#build()
call cmake#util#echo_msg('Building all targets...')
Expand All @@ -25,7 +25,11 @@ function! cmake#commands#build_current()
if exists('b:cmake_target')
call cmake#commands#invoke_target(b:cmake_target)
else
call cmake#util#echo_msg('No target recognized for this buffer.')
if cmake#buffer#has_project()
call cmake#commands#invoke_target('all')
else
call cmake#util#echo_msg('This buffer does not live in a CMake project.')
end
endif
endfunc

Expand Down Expand Up @@ -163,22 +167,24 @@ function s:cmake_clear_buffer_opts()
unlet b:cmake_binary_dir
endif

if exists('b:cmake_target')j
if exists('b:cmake_target')
unlet b:cmake_target
endif
endfunction

function! s:cmake_print_info()
if exists('b:cmake_target')
let l:current_file = fnamemodify(expand('%'), ':p')
let l:current_flags = filter(copy(b:cmake_flags),
\ 'v:val =~ "-f" || v:val =~ "-W"')
let l:current_flags = uniq(filter(copy(b:cmake_flags),
\ 'v:val =~ "-f" || v:val =~ "-W"'))
echo "CMake Info for '" . fnamemodify(l:current_file,':t') . "':\n" .
\ "Target: " . b:cmake_target . "\n" .
\ "Binary Directory: " . fnamemodify(b:cmake_binary_dir, ':p:.') .
\ "\nSource Directory: " . fnamemodify(b:cmake_source_dir, ':p:.') .
\ "\nFlags: " . join(l:current_flags, ', ') . "\n" .
\ "Include Directories: " . join(b:cmake_include_dirs, ',') . "\n"
\ "Libraries: " . join(b:cmake_libraries, ',')
\ "Include Directories: " . join(uniq(copy(b:cmake_include_dirs)), ',') . "\n"
\ "Libraries: " . join(uniq(copy(b:cmake_libraries)), ',')
endif
endfunction

function! s:clean_then_build()
Expand Down
11 changes: 6 additions & 5 deletions autoload/cmake/ctags.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Author: Jacky Alciné <[email protected]>
" License: MIT
" Website: https://jalcine.github.io/cmake.vim
" Version: 0.5.4
" Version: 0.5.5

func! s:get_tags()
return &l:tags
Expand All @@ -30,6 +30,7 @@ func! cmake#ctags#filename(target)
return simplify(cmake#ctags#cache_directory() . '/' . a:target . '.tags')
endfunc

" TODO: Allow user to add options for ctags.
func! cmake#ctags#generate_for_target(target)
let l:tag_file = cmake#ctags#filename(a:target)
let l:files = cmake#targets#files(a:target)
Expand Down Expand Up @@ -65,12 +66,12 @@ func! cmake#ctags#paths_for_target(target)
endfunc

func! cmake#ctags#refresh()
if exists('b:cmake_target')
call s:set_tags(join(cmake#ctags#paths_for_target(b:cmake_target), ','))
endif
for target in cmake#targets#list()
call s:set_tags(join(cmake#ctags#paths_for_target(target), ','))
endfor
endfunc

func! cmake#ctags#wipe(target)
let l:tag_file = cmake#ctags#filename(a:target)

endfunc
2 changes: 1 addition & 1 deletion autoload/cmake/extension.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Author: Jacky Alciné <[email protected]>
" License: MIT
" Website: https://jalcine.github.io/cmake.vim
" Version: 0.5.4
" Version: 0.5.5

" A lot of magic happening here; that magic behind interpolation.
func! s:get_default_ext(class, type)
Expand Down
2 changes: 1 addition & 1 deletion autoload/cmake/extension/dispatch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Author: Jacky Alciné <[email protected]>
" License: MIT
" Website: https://jalcine.github.io/cmake.vim
" Version: 0.5.4
" Version: 0.5.5

func! cmake#extension#dispatch#sync(command)
execute 'Dispatch "' . a:command . '"<CR>'
Expand Down
7 changes: 1 addition & 6 deletions autoload/cmake/extension/gnumake.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
" Author: Jacky Alciné <[email protected]>
" License: MIT
" Website: https://jalcine.github.io/cmake.vim
" Version: 0.5.4
" Version: 0.5.5

function! s:parse_target_depends(dependInfoCMakeFilePath, target)
let l:bindir = cmake#targets#binary_dir(a:target)
let l:srcdir = cmake#targets#source_dir(a:target)
let l:dependContents = readfile(a:dependInfoCMakeFilePath)
let l:objects = filter(l:dependContents, 'v:val =~ "\.o\"$"')

Expand All @@ -22,9 +20,6 @@ function! s:parse_target_depends(dependInfoCMakeFilePath, target)
endfunc

function! s:normalize_object_path(object_path, target)
let l:bindir = cmake#targets#binary_dir(a:target)
let l:srcdir = cmake#targets#source_dir(a:target)

" TODO: Strip the surrounding whitespace.
let l:object_path = substitute(a:object_path, ' "', '', '')
let l:object_path = substitute(l:object_path, '"(\s+)$', '', '')
Expand Down
Loading

0 comments on commit f085874

Please sign in to comment.