You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the documentation, I expect the command would preprocess {source_root}/file.erb and create {destination_root}/subfolder/file.rb.
But the real behaviour differs: it looks for the file.erb inside the {source_root}/subfolder, not the root itself.
# thor-0.19.1/lib/thor/actions.rb136: source_paths.eachdo |source|
137: possible_files.eachdo |f|
=>138: source_file=File.expand_path(f,File.join(source,relative_root))139: returnsource_fileifFile.exist?(source_file)140: end141: end142:
143: message="Could not find #{file.inspect} in any of your source paths. "
Note the usage of relative_root in line 138 above.
I wonder, is such a behaviour expected or not? If it is, I thought the message in line 143 should be updated, for example:
143: message="Could not find #{relative_root}/#{file.inspect} in any of your source paths. "
Actually, I'd prefer the inside to change only destination root.
This would allow moving files from source to the subfolder, created from arguments.
The text was updated successfully, but these errors were encountered:
Same for me, similar situation. I want to create a new directory, change to that directory, and copy there the templates from the source path, but the message is the one from line 143 above. I think it should be the normal behavior to not change the source path defined, so that this would be stable.
Is there any workaround known? I have tried different things, but the only thing that could possibly work is to copy the files by template in the same directory, and move them then to the target directory. I don't like that.
classGitUtil < ThorincludeThor::ActionsendclassRepositorydefinitialize(name)@thor=GitUtil.newenddefcopy_template(filename,path)target="#{path}/#{filename}"@thor.template(filename,target,verbose: false)endenddesc'base1','Create the base structure for the repository'defbase1Repository.repo('repo')do | repo |
GitUtil.source_root("#{File.dirname(__FILE__)}/templates")repo.create_dir('house')repo.copy_template('ground.txt','house')endend
Where Repository.repo('repo') creates a new Git repository, changes to that directory (by using thor), and evaluates the rest in that context. The templates directory is of course outside that new created directory.
When I use the
inside
action, it changes not only the destination folder, but also the source one.Suppose I have
file.erb
in a source root and then run a command:Following the documentation, I expect the command would preprocess
{source_root}/file.erb
and create{destination_root}/subfolder/file.rb
.But the real behaviour differs: it looks for the
file.erb
inside the{source_root}/subfolder
, not the root itself.Note the usage of
relative_root
in line 138 above.I wonder, is such a behaviour expected or not? If it is, I thought the message in line 143 should be updated, for example:
Actually, I'd prefer the
inside
to change only destination root.This would allow moving files from source to the subfolder, created from arguments.
The text was updated successfully, but these errors were encountered: