Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing VERSION file in git checkout #31

Open
glensc opened this issue Aug 6, 2014 · 7 comments
Open

missing VERSION file in git checkout #31

glensc opened this issue Aug 6, 2014 · 7 comments

Comments

@glensc
Copy link
Contributor

glensc commented Aug 6, 2014

using this cookbook from git checkout causes knife upload to fail. i think it's bad practice to keep the VERSION file in .gitignore and not version track it at all. (how do i know what version i'm at?)

$ grep -r VERSION .
./.gitignore:27:VERSION
./metadata.rb:7:version IO.read(File.join(File.dirname(__FILE__), 'VERSION')) || '0.0.1'
$ knife cookbook upload certificate
ERROR: Errno::ENOENT: No such file or directory - /home/glen/cookbooks/certificate/VERSION
$ ls -l VERSION
ls: cannot access VERSION: No such file or directory
$
@atomic-penguin
Copy link
Contributor

Run thor version:current to create the file from current tag. The file should be in the released cookbook on supermarket.

@glensc
Copy link
Contributor Author

glensc commented Aug 6, 2014

and that requires newer thor? or something else?

$ thor version:current
/home/glen/Dropbox/cookbooks/github/certificate/Thorfile:1:in `require': cannot load such file -- thor/scmversion (LoadError)
        from /home/glen/Dropbox/cookbooks/github/certificate/Thorfile:1:in `load_thorfile'
        from /usr/share/ruby/vendor_ruby/1.9/thor/util.rb:155:in `class_eval'
        from /usr/share/ruby/vendor_ruby/1.9/thor/util.rb:155:in `load_thorfile'
        from /usr/share/ruby/vendor_ruby/1.9/thor/runner.rb:214:in `block in initialize_thorfiles'
        from /usr/share/ruby/vendor_ruby/1.9/thor/runner.rb:213:in `each'
        from /usr/share/ruby/vendor_ruby/1.9/thor/runner.rb:213:in `initialize_thorfiles'
        from /usr/share/ruby/vendor_ruby/1.9/thor/runner.rb:32:in `method_missing'
        from /usr/share/ruby/vendor_ruby/1.9/thor/command.rb:29:in `run'
        from /usr/share/ruby/vendor_ruby/1.9/thor/command.rb:126:in `run'
        from /usr/share/ruby/vendor_ruby/1.9/thor/invocation.rb:126:in `invoke_command'
        from /usr/share/ruby/vendor_ruby/1.9/thor.rb:359:in `dispatch'
        from /usr/share/ruby/vendor_ruby/1.9/thor/base.rb:440:in `start'
        from /usr/bin/thor:6:in `<main>'
$ gem list |grep thor
thor (0.19.1)

@atomic-penguin
Copy link
Contributor

thor-scmversion, it should be in the Gemfile.

@TheSerapher
Copy link

I don't think that adding this kind of 'magic' to create a simple version information is a good idea. When I wish to use a cookbook, I use the common download, checkout tag, upload system to drop it into Chef. Having these extra steps requires people to use Thor, install the gem required or run your bundle prior to uploading this cookbooks.

IMHO these are unnecessary steps when just uploading cookbooks. These are just my 2 cents though.

@glensc
Copy link
Contributor Author

glensc commented Sep 1, 2014

i totally agree with @TheSerapher. i just put correct version in my git clone and committed that to local repo

and if maintainer wishes to use such scripting, at least the VERSION file should be kept in git for cookbook users...

@atomic-penguin
Copy link
Contributor

Okay, metadata has read long_description from an external file since forever. It is no more magic than that is. The released cookbook on Supermarket ships with a VERSION file, so this isn't an issue for most people. Just like metadata.json is not kept in source control, and treated as a release artifact, so is this version data. The authoritative source of the version becomes the tag in git. It is a tool that makes my maintenance of the cookbook easier, period.

Here is what I think about the issue for developers using the software directly from github. They need to check out the dependencies with bundler in the Gemfile. Why? Because, they should be running the included integration tests for Test-Kitchen, Linting with Rubocop or Foodcritic, or unit tests with Chefspec, when submitting pull requests.

Cookbook users can get released cookbooks, not the source versions, from the Supermarket. If one refuses to use the released version as an end user, and insists on using the source from Github when they are not developing a feature, then that doesn't really seem like my problem to slightly inconvenience them.

If I tag a commit with this tool, and then later commit to metadata.rb or an external VERSION file, then the tag will no longer match the record of authority (i.e. the tag). Whereas, with the tool bumping and tagging are done synchronously. So, no that defeats the whole purpose of the tool to keep the file in source control.

@TheSerapher
Copy link

So in the end it's just another way of releasing cookbooks. And I agree on the site download instead of source. GitHub has just been a very convenient way for us to install new versions. Maybe it's time to switch to Supermarket and get used to a new workflow ;-)

And completely agree on ruining bundle as a cookbook dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants