Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
fefd2ae2
Commit
fefd2ae2
authored
Apr 21, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate commands into other directories
parent
f49c0cb3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
1 deletion
+28
-1
command/build/command.go
command/build/command.go
+15
-0
packer.go
packer.go
+5
-1
packer/environment.go
packer/environment.go
+1
-0
packer/environment_test.go
packer/environment_test.go
+7
-0
No files found.
command/build/command.go
0 → 100644
View file @
fefd2ae2
package
build
import
"fmt"
import
"github.com/mitchellh/packer/packer"
type
Command
byte
func
(
Command
)
Run
(
env
*
packer
.
Environment
,
arg
[]
string
)
int
{
fmt
.
Println
(
"HI!"
)
return
0
}
func
(
Command
)
Synopsis
()
string
{
return
"build image(s) from tempate"
}
packer.go
View file @
fefd2ae2
...
...
@@ -3,12 +3,16 @@ package main
import
(
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/command/build"
"fmt"
"os"
)
func
main
()
{
env
,
err
:=
packer
.
NewEnvironment
(
packer
.
DefaultEnvironmentConfig
())
envConfig
:=
packer
.
DefaultEnvironmentConfig
()
envConfig
.
Command
[
"build"
]
=
new
(
build
.
Command
)
env
,
err
:=
packer
.
NewEnvironment
(
envConfig
)
if
err
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"Packer initialization error:
\n\n
%s
\n
"
,
err
)
os
.
Exit
(
1
)
...
...
packer/environment.go
View file @
fefd2ae2
...
...
@@ -34,6 +34,7 @@ type EnvironmentConfig struct {
func
DefaultEnvironmentConfig
()
*
EnvironmentConfig
{
config
:=
&
EnvironmentConfig
{}
config
.
BuilderFactory
=
new
(
NilBuilderFactory
)
config
.
Command
=
make
(
map
[
string
]
Command
)
config
.
Ui
=
&
ReaderWriterUi
{
os
.
Stdin
,
os
.
Stdout
}
return
config
}
...
...
packer/environment_test.go
View file @
fefd2ae2
...
...
@@ -40,6 +40,13 @@ func testEnvironment() *Environment {
return
env
}
func
TestEnvironment_DefaultConfig_Command
(
t
*
testing
.
T
)
{
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
config
:=
DefaultEnvironmentConfig
()
assert
.
NotNil
(
config
.
Command
,
"default Command should not be nil"
)
}
func
TestEnvironment_DefaultConfig_Ui
(
t
*
testing
.
T
)
{
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment