2017-02-23 48 views
0

这个问题已经提出了几次。过去的解决方案围绕着没有添加和提交的Git文件。如果通过所有帐户,Git已经得到妥善处理并且仍然出现错误,应该怎么办?建筑宝石 - InvalidSpecificationException [...]不是文件

rake aborted! 
Gem::InvalidSpecificationException: ["Gemfile", "Gemfile.lock", 
"lib/sysstandards/ext/abstract_interface.rb", 
"lib/sysstandards/ext/mainframe_constants.rb", 
"lib/sysstandards/ext/text_box_formatters.rb", "spec/ext", 
"spec/ext/abstract_interface_spec.rb", 
"spec/ext/text_box_formatters_spec.rb"] are not files 

上面列出的所有文件都是新文件。他们被添加到存储库。他们承诺。该分支被定位为掌握。孩子的分支合并成了主人。

[email protected] ~/RubymineProjects/SysStandards $ git status 
On branch master 
nothing to commit, working directory clean 

这些文件显示在git列表中。

[email protected] ~/RubymineProjects/SysStandards $ git ls-files 
Gemfile 
Gemfile.lock 
... 
lib/sysstandards.rb 
lib/sysstandards/chgtable.rb 
lib/sysstandards/ext/abstract_interface.rb 
lib/sysstandards/ext/file_flocked.rb 
lib/sysstandards/ext/load_params.rb 
lib/sysstandards/ext/mainframe_constants.rb 
lib/sysstandards/ext/text_box_formatters.rb 
... 
spec/ext/abstract_interface_spec.rb 
spec/ext/text_box_formatters_spec.rb 

我真的迷失在这一个。我看过类似的问题,并听从他们的建议,但无济于事。我无法绕过这个,因此,我无法得到建造的宝石。请让我知道您可能需要的其他信息。

我正在删除.git并从头开始。但是,如果我这样做,会有很多历史丢失。我会等到星期一看看有没有人有任何指导。但在周一,我想我会放弃Git并转向Fossil。

感谢您的时间和考虑, DVN

更新发布显示gemspec

spec = Gem::Specification.new do |s| 
    s.name = 'SysStandards' 
    s.version = '3.0.0' 
    s.has_rdoc = true 
    s.extra_rdoc_files = ['readme.md', 'LICENSE'] 
    s.summary = 'Standards Library' 
    s.description = s.summary 
    s.author = 'Don V Nielsen' 
    s.email = '[email protected]' 
    # s.executables = ['your_executable_here'] 
    s.files = %w(LICENSE readme.md Rakefile Gemfile Gemfile.lock Rakefile) + Dir.glob("{lib,spec}/**/*") 
    s.require_path = "lib" 
    s.bindir = "bin" 
end 

GEM 
rake (12.0.0) 
rspec (3.5.0) 

PLATFORMS 
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux] 
x64-mingw32 
x86-mingw32 

BUNDLED WITH 
1.10.6 

更新与文件列表

[email protected] ~/RubymineProjects/SysStandards $ ls -l 
total 40 
drwx------ 2 dvn dvn 4096 Oct 30 11:16 coverage 
drwxr-xr-x 2 dvn dvn 4096 Feb 23 09:46 doc 
-rw-r--r-- 1 dvn dvn 139 Feb 23 12:20 Gemfile 
-rw-r--r-- 1 dvn dvn 629 Feb 23 12:20 Gemfile.lock 
drwxr-xr-x 3 dvn dvn 4096 Feb 23 12:20 lib 
-rw-r--r-- 2 dvn dvn 65 Apr 1 2013 LICENSE 
drwxr-xr-x 3 dvn dvn 4096 Feb 22 18:38 pkg 
-rw-r--r-- 1 dvn dvn 1169 Feb 23 15:39 Rakefile 
-rw-r--r-- 1 dvn dvn 890 Feb 23 12:20 readme.md 
drwx------ 6 dvn dvn 4096 Feb 23 12:20 spec 
[email protected] ~/RubymineProjects/SysStandards $ ls -l ./lib/sysstandards/ext 
total 20 
-rw-r--r-- 1 dvn dvn 1259 Feb 23 12:20 abstract_interface.rb 
-rw-r--r-- 1 dvn dvn 388 Feb 23 12:20 file_flocked.rb 
-rw-r--r-- 1 dvn dvn 345 Feb 23 12:20 load_params.rb 
-rw-r--r-- 1 dvn dvn 540 Feb 23 12:20 mainframe_constants.rb 
-rw-r--r-- 1 dvn dvn 1366 Feb 23 12:20 text_box_formatters.rb 
[email protected] ~/RubymineProjects/SysStandards $ ls -l ./spec/ext 
total 8 
-rw-r--r-- 1 dvn dvn 747 Feb 23 12:20 abstract_interface_spec.rb 
-rw-r--r-- 1 dvn dvn 941 Feb 23 12:20 text_box_formatters_spec.rb 

那么什么是文件。符号链接

的异常是从下面的代码宝石:: specification.rb抛出:

@files.delete_if   { |x| File.directory?(x) && !File.symlink?(x) } 
@test_files.delete_if  { |x| File.directory?(x) && !File.symlink?(x) } 
@executables.delete_if  { |x| File.directory?(File.join(@bindir, x)) } 
@extra_rdoc_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) } 
@extensions.delete_if  { |x| File.directory?(x) && !File.symlink?(x) } 

non_files = files.reject { |x| File.file?(x) || File.symlink?(x) } 

unless not packaging or non_files.empty? then 
    raise Gem::InvalidSpecificationException, 
     "[\"#{non_files.join "\", \""}\"] are not files" 
end 

@files进入这个代码持有46项:文件和目录。 @ files.delete_if应该删除目录,结果是剩余的36个条目。间的36名幸存者是“规格/ EXT”,这是每“LS -l”的目录:

[email protected] ~/RubymineProjects/SysStandards/spec $ ls -l 
total 32 
-rw-r--r-- 1 dvn dvn 1353 Feb 23 12:20 change_table_spec.rb 
drwx------ 3 dvn dvn 4096 Oct 30 11:17 data 
drwxr-xr-x 2 dvn dvn 4096 Feb 23 12:20 ext 

当执行files.reject,结果是七个条目在non_files:所述一个目录和六个文件。这是例外的原因。所以看起来File.symlink?正在引发这个问题。什么是File.symlink,什么值设置,值如何设置?

+0

只是一个预感:我不认为这是一个混帐问题,而是一个宝石建设问题。你可以发布与s.files = ...和ruby,rake,bundler和gem版本的gemspec代码片段吗? –

+0

ls -l显示什么? (错误消息中列出的各种子目录也是'ls -l')。错误[当您尝试添加非常规文件时出现](https://github.com/rubygems/rubygems/blob/v2.6.8/lib/rubygems/specification.rb#L2687 -L2692)。 – matt

+0

文件列表如下: – donvnielsen

回答

0

删除/ pkg文件夹并重新运行rake gem修复了这个问题。

该问题源于现有的/ pkg文件夹。我通过在Rakefile和specification.rb中添加puts Dir.getwd来确定问题。 Rakefile从我的项目文件夹中收集项目文件,并从包build文件夹收集文件specification.rb。

Rakefile  : /home/dvn/RubymineProjects/SysStandards 
Specification: /home/dvn/RubymineProjects/SysStandards/pkg/SysStandards-3.0.0 

因此,出于未知原因,软件包构建文件夹未被添加/更改的文件更新。我假设某个决定确定该文件夹不需要更新。

删除/ pkg文件夹修复了问题,迫使gem进程重建其pkg build文件夹,从而复制受影响的文件。

我担心Gemfile和Rakefile会在non_files列表中结束。这两个文件从一开始就一直在项目中出现;他们不是新的文件。那究竟是什么引发了他们进去呢?

不幸的是,我是一个白痴。我通过删除/ pkg文件夹来解决问题。我应该重新命名它,保留它的内容。咄。现在我没有什么可比较的。

+0

我刚刚通过添加Gemfile.lock重复该问题rakefile中的s.files。这就解释了为什么Gemfile和Rakefile在non_files列表中结束。我已经将这些文件添加到s.files中,但它们不会出现在生成文件夹中。我真的希望有人从中受益,因为写了很多文字只是简单地导致“只删除/ pkg文件夹并重新运行”。 – donvnielsen