summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface_spec.rb
Commit message (Collapse)AuthorAgeFilesLines
* (#7183) Implement "invisible glob" version matching for facesDaniel Pittman2011-04-211-0/+22
| | | | | | | | | | | | | | | | | | | | | "Invisible glob", or "prefix", version matching means that when you specify a version string to use you can specify as little as one version number out of the semantic versioning spec. Matching is done on the prefix; an omitted number is treated as "anything" in that slot, and we return the highest matching versioned face by that spec. For example, given the set of versions: 1.0.0, 1.0.1, 1.1.0, 1.1.1, 2.0.0 The following would be matched: input matched 1 1.1.1 1.0 1.0.1 1.0.1 1.0.1 1.0.2 fail - no match 1.1 1.1.1 1.1.1 1.1.1 1.2 fail - no match
* maint: handle face clear/reset sanely in the interface spec.Daniel Pittman2011-04-201-5/+6
| | | | | | | | | | We used to flush the loaded face cache, but not the list of 'require' things, which meant that these tests couldn't work with anything outside their own setup, which is actually pretty undesirable. Instead, port the code from the face_collection spec that handles this in a way that makes me less inclined to weep, and which lets the surrounding code work as designed.
* Merge branch 'bug/2.7.x/6752-allow-action-specific-render-methods'Daniel Pittman2011-04-191-10/+0
|\ | | | | | | Fix the conflicts over changes in my previous commit.
| * (#7013) Strip out old face-wide rendering defaults.Daniel Pittman2011-04-191-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Now we want to support action-based rendering, it is super-hard to define the semantics around defaulting where things are unspecified: the execution context (CLI, HTTP, etc) vs the face, vs the action all have different semantics. Without solving the problem of how we express all that context and those semantics down in the action, especially one written by a third party, this just becomes a box of counter-intuitive and annoying semantics and edge-cases. Reviewed-By: Max Martin <max@puppetlabs.com>
* | (#6962) Add 'description' to faces and action.Daniel Pittman2011-04-191-21/+14
| | | | | | | | | | | | | | This adds the 'description' method to the faces and actions, as well as structured testing to ensure that the DSL works as expected. Reviewed-By: Max Martin <max@puppetlabs.com>
* | (#7132) Reject 'summary' text with newlines embedded.Daniel Pittman2011-04-191-18/+25
|/ | | | | | | | | Our summary documentation is used to provide single-line context to faces, actions, and other items. To support this we hard-fail if someone tries to use the summary to embed the long documentation, and point them to the right place to add the extended text. Reviewed-By: Max Martin <max@puppetlabs.com>
* (#7059) handle inherited action binding scopeDaniel Pittman2011-04-131-1/+23
| | | | | | | | | | | | | | | We implemented the naive version of inheritance in the faces, in which an action declared on a superclass remains bound to that even when accessed from a subclass. As a consequence our visibility of options on inherited classes is actually much more limited than it should be, and the actions we inherit would never see the options they should correctly have. To fix this we correct the binding bug and handle lookup correctly over inheritance in our code. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* (#7056) Use 'face' rather than 'faces' in the production code.Daniel Pittman2011-04-131-2/+2
| | | | | | | | | After some discussion we decided that most uses of the Puppet Face infrastructure were about single faces on their own, not about the collection, and so we were better referring to Puppet::Face[...] in code. This implements that by translating names and references in the Ruby code to the new, s-less, name.
* (#6962) Implement 'summary' for faces.Daniel Pittman2011-04-121-2/+25
| | | | | | | | | | | | This adds the methods to the summary builder and runtime instance to support setting and getting a summary of the face. This is a short description used to summarize the purpose of the face in help output. For example, from the help face: "Displays help about puppet subcommands" Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* maint: added testing for Puppet::Faces#[]Daniel Pittman2011-04-121-0/+15
| | | | | | | | We didn't do much testing here, which was vaguely reasonable when we didn't distinguish it from the #define method. Now they are split out we need to be more careful about testing the right things. Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* maint: mocking 'require' causes random stack-overflow failures.Daniel Pittman2011-04-071-0/+1
| | | | | | | | | | | It turns out that mocking require on objects can cause random "stack depth exceeded" failures, usually triggered by otherwise innocent changes to load order or the use of require in the rest of the code. Disable the currently failing test, which needs rewriting, and let it go for now. We need to systematically purge these problems once the build is stable. Paired-With: Dan Bode <dan@puppetlabs.com>
* (#7012) Split plumbing into Puppet::InterfaceDaniel Pittman2011-04-071-0/+146
| | | | | | | | | This splits out the plumbing into the Puppet::Interface namespace, and uses Puppet::Faces for all the public-facing code. The fault line is "what you care about if you are using or writing a face", which is public, against "what you care about to enable either of those two", which is the plumbing.
* MAINT: the API is officially named "string" as of this moment.Daniel Pittman2011-03-281-83/+0
| | | | | | | Now that we have settled on the final public name for the API, "Puppet::String", mass-rename and mass-edit all the files to follow. Reviewed-By: Randall Hansen <randall@puppetlabs.com>
* (#6770) Add support for version :latest.Pieter van de Bruggen2011-03-251-0/+4
| | | | | | | | | Specifying a version of `:latest` will find the most recent version of the named interface installed in your RUBYLIB, and attempt to load that. This is unlikely to provide a stable dependency in the future, so should be used sparingly, acknowledging the dangers. Reviewed-By: Daniel Pittman
* (#6770) Refactor Puppet::Interface#initialize.Pieter van de Bruggen2011-03-251-14/+10
| | | | | | | | | P::I#initialize now takes a name and a version (and an optional block). The options hash has been removed, though it may be reintroduced if a legitimate use case can be made for it (so far, it's only been used for the version number). Reviewed-By: Jacob Helwig
* (#6770) Rename Puppet::Interface::interface method.Pieter van de Bruggen2011-03-231-5/+5
| | | | | | | Puppet::Interface::interface is now Puppet::Interface::define, also aliased to Puppet::Interface::[] for convenience. Paired-With: Nick Lewis
* (#6770) Changing versioning to semver.Pieter van de Bruggen2011-03-231-10/+10
| | | | | | More information about the versioning scheme can be found at http://semver.org. Paired-With: Nick Lewis
* (#6770) Add basic versioning for interfaces.Pieter van de Bruggen2011-03-231-12/+33
| | | | Reviewed-By: Nick Lewis
* maint: Implement an InterfaceCollection class to manage interfacesNick Lewis2011-03-221-41/+15
| | | | | | | | | | | Having an instance variable on class Interface is insufficient for Interface::Indirector. This also changes the semantics of "Interface.interface" to handle registration and loading actions, and for "Interface.new" to only instantiate an Interface. Thus, consumers of the API should typically use "Interface.interface", unless they have reasons to not want an interface automatically registered. Paired-With: Pieter van de Bruggen
* (#6786) Change interface storage and access.Pieter van de Bruggen2011-03-221-28/+14
| | | | | | | | | | | Ruby's namespace mechanism introduced a number of problems, including incorrect name resolution for common and simple cases. Given that, we've refactored back to class-level data structures with accessor methods available. The current method names are unlikely to be the final UI. Reviewed-By: Daniel Pittman
* (Maint.) Remove Puppet::Interface#unload_interfacePieter van de Bruggen2011-03-211-20/+0
| | | | Reviewed-By: Nick Lewis
* (#6806) Improve error checking and reporting for interface naming.Daniel Pittman2011-03-211-0/+27
| | | | | | | | We didn't do enough input checking and sanitization, and missed some edge-cases for naming interfaces. This adds testing, and cleans up some edge cases to handle things better. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* (#6786) Removing the #interface method.Pieter van de Bruggen2011-03-211-13/+9
| | | | | | | | Since constants are already being defined for each interface, the #interface method does little but provide another way to access the same data. Reviewed-By: Nick Lewis
* Fixing #13 - showconfig moved to indirectorLuke Kanies2011-03-021-4/+0
| | | | | | | | | I renamed it to 'info', too. It only showed indirector-related info, so this makes sense. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Fixing 'puppet interface list'Luke Kanies2011-02-221-1/+1
| | | | | | | Also added a test to hopefully confirm it won't break again. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Adding a string form to interfacesLuke Kanies2011-02-221-0/+4
| | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Switching Interfaces to be instancesLuke Kanies2011-02-221-0/+99
They were previously classes, which made a lot of things stupider than they needed to be. This will likely involve some porting, but not much. Signed-off-by: Luke Kanies <luke@puppetlabs.com>