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

Commit

Permalink
Cleanup to documentation posting (make it handle trickier paths).
Browse files Browse the repository at this point in the history
Automatically stamp new projects with the ceedling version that created them (for future use during upgrades)
  • Loading branch information
mvandervoord committed Dec 3, 2019
1 parent 81cc3e0 commit e0f3f5b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions assets/project_as_gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# :release_build: TRUE
:test_file_prefix: test_
:which_ceedling: gem
:ceedling_version: '?'
:default_tasks:
- test:all

Expand Down
1 change: 1 addition & 0 deletions assets/project_with_guts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# :release_build: TRUE
:test_file_prefix: test_
:which_ceedling: vendor/ceedling
:ceedling_version: '?'
:default_tasks:
- test:all

Expand Down
1 change: 1 addition & 0 deletions assets/project_with_guts_gcov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# :release_build: TRUE
:test_file_prefix: test_
:which_ceedling: vendor/ceedling
:ceedling_version: '?'
:default_tasks:
- test:all

Expand Down
23 changes: 16 additions & 7 deletions bin/ceedling
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ unless (project_found)
FileUtils.touch(File.join(test_support_path, '.gitkeep'))

# If documentation requested, create a place to dump them and do so
doc_path = ""
if use_docs
doc_path = use_gem ? File.join(name, 'docs') : File.join(ceedling_path, 'docs')
FileUtils.mkdir_p doc_path
Expand All @@ -99,15 +100,15 @@ unless (project_found)
# Add documentation from main projects to list
doc_files = {}
['docs','vendor/unity/docs','vendor/cmock/docs','vendor/cexception/docs'].each do |p|
Dir[ File.join(here, p, '*.md') ].each do |f|
Dir[ File.expand_path(File.join(here, p, '*.md')) ].each do |f|
doc_files[ File.basename(f) ] = f unless(doc_files.include? f)
end
end

# Add documentation from plugins to list
Dir[ File.join(here, 'plugins/**/README.md') ].each do |plugin_path|
k = "plugin_" + plugin_path.split(/\\|\//)[-2] + ".md"
doc_files[ k ] = plugin_path
doc_files[ k ] = File.expand_path(plugin_path)
end

# Copy all documentation
Expand Down Expand Up @@ -149,16 +150,24 @@ unless (project_found)

# We're copying in a configuration file if we haven't said not to
if (use_configs)
if use_gem
copy_file(File.join('assets', 'project_as_gem.yml'), File.join(name, 'project.yml'), :force => force)
dst_yaml = File.join(name, 'project.yml')
src_yaml = if use_gem
File.join(here, 'assets', 'project_as_gem.yml')
else
copy_file(File.join('assets', 'project_with_guts.yml'), File.join(name, 'project.yml'), :force => force)
if is_windows?
copy_file(File.join('assets', 'ceedling.cmd'), File.join(name, 'ceedling.cmd'), :force => force)
else
copy_file(File.join('assets', 'ceedling'), File.join(name, 'ceedling'), :force => force)
File.chmod(0755, File.join(name, 'ceedling'))
end
File.join(here, 'assets', 'project_with_guts.yml')
end

# Perform the actual clone of the config file, while updating the version
File.open(dst_yaml,'w') do |dst|
require 'ceedling/version.rb'
dst << File.read(src_yaml).gsub(":ceedling_version: '?'",":ceedling_version: #{Ceedling::Version::CEEDLING}")
puts " create #{dst_yaml}"
end
end

Expand All @@ -170,8 +179,8 @@ unless (project_found)
unless silent
puts "\n"
puts "Project '#{name}' #{force ? "upgraded" : "created"}!"
puts " - Tool documentation is located in vendor/ceedling/docs" if use_docs
puts " - Execute 'ceedling help' to view available test & build tasks"
puts " - Tool documentation is located in #{doc_path}" if use_docs
puts " - Execute 'ceedling help' from #{name} to view available test & build tasks"
puts ''
end
end
Expand Down

0 comments on commit e0f3f5b

Please sign in to comment.