Reputation: 21
I have checked this code many times and I cannot find a reason for this syntax error.
syntax error, unexpected tIDENTIFIER, expecting keyword_end
This is the code:
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require '00 hello/version'
Gem::Specification.new do |spec|
spec.name = "00 hello"
spec.version = 00 hello_VERSION
spec.authors = ["John Kirtley"]
spec.email = ["[email protected]"]
spec.description = %q{TODO: Write a gem description}
spec.summary = %q{TODO: Write a gem summary}
spec.homepage = ""
spec.license = "MIT"
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
end
This is the modified code:
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require = 00hello_version
Gem::Specification.new do |spec|
spec.name = "00hello"
spec.version = "00hello:VERSION"
spec.authors = ["John Kirtley"]
spec.email = ["[email protected]"]
spec.description = %q{TODO: Write a gem description}
spec.summary = %q{TODO: Write a gem summary}
spec.homepage = ""
spec.license = "MIT"
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) })
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
end
I changed the code a bit, and now the error I get is:
There was a SyntaxError while loading hello.gemspec:
/Users/John/$/hello.gemspec:4: syntax error, unexpected tIDENTIFIER, expecting end-of-input
/Users/John/$/Rakefile:1:in `<top (required)>'
/Users/John/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
/Users/John/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)
Upvotes: 1
Views: 3431
Reputation: 5034
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
is missing an end paren
Upvotes: 0
Reputation: 6491
You need to quote your spec.version section.
spec.version = '00 hello_VERSION'
Upvotes: 0
Reputation: 4427
You could comment out lines until you find it....
But the 00 hello_Version
looks dodgy to me.
Upvotes: 1