summaryrefslogtreecommitdiff
path: root/spec/unit/module_tool/metadata_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2014-07-28(PUP-2901) Add module dependency validationBrandon High1-2/+57
Prior to this commit there wasn't much verification for module dependencies. This commit adds verification the module dependencies have sane names and version ranges. If verification fails, it will raise an argument exception.
2014-07-15(maint) Avoid rspec examples using variable behaviorAdrien Thebo1-2/+2
Given an object with an attr_accessor and using an example shortcut like so: subject { metadata.to_hash } its(:keys) do subject.sort.should == %w[ name version author summary license source issues_url project_page dependencies ].sort end The value of subject in the example varies between RSpec 2.11 and 2.13. This commit removes the shortcut in favor of a slightly longer but more compatible test that explicitly invokes the #keys method and does an expectation on that.
2014-05-28(PUP-2691) Re-adding the missing ‘description’ property to P::MT::Metadata.Pieter van de Bruggen1-0/+13
Prior to Puppet 3.6.0, users had a ‘description’ property which they could reliably expand into their module skeleton’s ERB templates. This property was removed from the default set of properties in Puppet 3.6.0, which effectively broke template expansion for users relying on it. This change ensures that users can continue to rely on this property.
2014-04-23Merge pull request #2538 from ↵Nick Lewis1-2/+57
pvande/task/master/pup2284_puppet_module_generate_interview Add an interview to the PMT `generate` action.
2014-04-18(maint) Fix metadata validation for missing namespaces and module names.Pieter van de Bruggen1-0/+16
Prior to this commit, validation would raise non-sensical validation errors if you attempted to validate a module name that contained a separator (either '-' or '/'), but less than one character on either side. This change adds validation for those cases.
2014-04-18(maint) Refactoring module name validation to be less obtuse.Pieter van de Bruggen1-1/+1
Previously the code that validated module names took a pessimistic approach, validating conformance only to assert unrelated non-conformance. As it turns out, this is messy to read and understand, so this change rewrites the logic in a more straightforward manner.
2014-04-16(PUP-2284) Add an interview to the PMT `generate` action.Pieter van de Bruggen1-2/+57
Prior to this commit, when you generated a new module, it created a simple metadata.json file with the same standard defaults for every module. Since JSON may not be the most familiar language for all of our users, we now do some work up front to pre-fill that JSON file with useful data based on user input.
2014-03-18(PUP-1976) Use metadata.json as canonical metadata source.Pieter van de Bruggen1-14/+152
Prior to this commit, the Modulefile was used as the primary source of user-facing metadata for modules. This file was executable Ruby, which was intended to describe a simple data structure. This causes a few problems for us in the long-term, including making automated module builds a significantly more difficult proposition, and making changes to acceptable metadata a slow process (requiring new releases of Puppet). In addition, the only piece of Puppet code that interacted directly with the Module file was the `module build` action – anywhere we actually need to know something about the module, we look it up from the metadata.json file. This commit removes this level of indirection between user input and module data, making the metadata.json file a first-class citizen in Puppet modules. It similarly deprecates the Modulefile as a supported source of module data. Checksums have also been moved into their own file (per PE-3124), and `puppet module changes` has been updated to leverage the new file when available (per PE-3120). For users building a module containing only a Modulefile, this will issue a warning that the Modulefile is deprecated, and output the corresponding metadata.json file. For users building a module containing both a Modulefile and a metadata.json file, this will issue a warning that the Modulefile is deprecated and is being ignored.
2013-07-30(21985) pmt should include exsiting metadata.json when buildingAlex Dreyer1-0/+13
pmt currently will only include specific fields from the ModuleFile when building a module. This means that as we add features to forge that rely on new fields those won't be available to users with older versions of PMT. By allowing metadata.json to be written to directly we ensure that module authors can take advantage of all forge features without updating puppet. All existing workflows continue to work for those who do not want to leverage these features.
2012-04-23(#13682) Rename Puppet::Module::Tool to Puppet::ModuleToolJeff McCune1-2/+2
Without this patch, Puppet will monkey patch the existing implementation of the puppet-module Gem if it is used. This is bad because the two implementations are all jumbled up inside of one another and behavior may become unpredictable. Warnings are also displayed directly to the end user in the form of redefined constants. This patch fixes the problem by renaming Puppet::Module::Tool inside of Puppet to Puppet::ModuleTool This fixes the problem because Puppet will no longer monkey-patch the Puppet::Module::Tool module inside of the puppet-module Gem. This patch also has the added benefit of making the Module's name match up with the CamelCase filepath (puppet/module_tool/ => Puppet::ModuleTool) As a result, no file moves are necessary.
2011-12-07(#11198) Modulefiles should have a default licenseKelsey Hightower1-0/+11
Before this patch, the module generate action generates Modulefiles with the license set to UNKNOWN, which is not a valid license. This patch fixes this issue by setting the default value of the `Puppet::Module::Tool::Metadata#license` attribute to 'Apache License, Version 2.0' by default. This patch also adds a new unit test verifying this this change.