@@ -38,8 +38,8 @@ type config struct {
38
38
} `json:"shell,omitempty"`
39
39
}
40
40
41
- func (m * Manager ) CreateFilesAndShowReadme (pkg , rootDir string ) error {
42
- cfg , err := getConfigIfAny (pkg , rootDir )
41
+ func (m * Manager ) CreateFilesAndShowReadme (pkg , projectDir string ) error {
42
+ cfg , err := getConfigIfAny (pkg , projectDir )
43
43
if err != nil {
44
44
return err
45
45
}
@@ -77,11 +77,11 @@ func (m *Manager) CreateFilesAndShowReadme(pkg, rootDir string) error {
77
77
}
78
78
var buf bytes.Buffer
79
79
if err = t .Execute (& buf , map [string ]string {
80
- "DevboxConfigDir" : rootDir ,
81
- "DevboxDir" : filepath .Join (rootDir , devboxDirName , pkg ),
82
- "DevboxDirRoot" : filepath .Join (rootDir , devboxDirName ),
83
- "DevboxProfileDefault" : filepath .Join (rootDir , nix .ProfilePath ),
84
- "Virtenv" : filepath .Join (rootDir , devboxHiddenDirName , "virtenv" , pkg ),
80
+ "DevboxConfigDir" : projectDir ,
81
+ "DevboxDir" : filepath .Join (projectDir , devboxDirName , pkg ),
82
+ "DevboxDirRoot" : filepath .Join (projectDir , devboxDirName ),
83
+ "DevboxProfileDefault" : filepath .Join (projectDir , nix .ProfilePath ),
84
+ "Virtenv" : filepath .Join (projectDir , devboxHiddenDirName , "virtenv" , pkg ),
85
85
}); err != nil {
86
86
return errors .WithStack (err )
87
87
}
@@ -94,19 +94,19 @@ func (m *Manager) CreateFilesAndShowReadme(pkg, rootDir string) error {
94
94
return errors .WithStack (err )
95
95
}
96
96
if fileMode == 0755 {
97
- if err := createSymlink (rootDir , filePath ); err != nil {
97
+ if err := createSymlink (projectDir , filePath ); err != nil {
98
98
return err
99
99
}
100
100
}
101
101
}
102
- return createEnvFile (pkg , rootDir )
102
+ return createEnvFile (pkg , projectDir )
103
103
104
104
}
105
105
106
- func Env (pkgs []string , rootDir string ) (map [string ]string , error ) {
106
+ func Env (pkgs []string , projectDir string ) (map [string ]string , error ) {
107
107
env := map [string ]string {}
108
108
for _ , pkg := range pkgs {
109
- cfg , err := getConfigIfAny (pkg , rootDir )
109
+ cfg , err := getConfigIfAny (pkg , projectDir )
110
110
if err != nil {
111
111
return nil , err
112
112
}
@@ -120,8 +120,8 @@ func Env(pkgs []string, rootDir string) (map[string]string, error) {
120
120
return env , nil
121
121
}
122
122
123
- func createEnvFile (pkg , rootDir string ) error {
124
- envVars , err := Env ([]string {pkg }, rootDir )
123
+ func createEnvFile (pkg , projectDir string ) error {
124
+ envVars , err := Env ([]string {pkg }, projectDir )
125
125
if err != nil {
126
126
return err
127
127
}
@@ -133,7 +133,7 @@ func createEnvFile(pkg, rootDir string) error {
133
133
}
134
134
env += fmt .Sprintf ("export %s=%s\n " , k , escaped )
135
135
}
136
- filePath := filepath .Join (rootDir , VirtenvPath , pkg , "/env" )
136
+ filePath := filepath .Join (projectDir , VirtenvPath , pkg , "/env" )
137
137
if err = createDir (filepath .Dir (filePath )); err != nil {
138
138
return err
139
139
}
@@ -143,19 +143,19 @@ func createEnvFile(pkg, rootDir string) error {
143
143
return nil
144
144
}
145
145
146
- func buildConfig (pkg , rootDir , content string ) (* config , error ) {
146
+ func buildConfig (pkg , projectDir , content string ) (* config , error ) {
147
147
cfg := & config {}
148
148
t , err := template .New (pkg + "-template" ).Parse (content )
149
149
if err != nil {
150
150
return nil , errors .WithStack (err )
151
151
}
152
152
var buf bytes.Buffer
153
153
if err = t .Execute (& buf , map [string ]string {
154
- "DevboxConfigDir " : rootDir ,
155
- "DevboxDir" : filepath .Join (rootDir , devboxDirName , pkg ),
156
- "DevboxDirRoot" : filepath .Join (rootDir , devboxDirName ),
157
- "DevboxProfileDefault" : filepath .Join (rootDir , nix .ProfilePath ),
158
- "Virtenv" : filepath .Join (rootDir , devboxHiddenDirName , "virtenv" , pkg ),
154
+ "DevboxProjectDir " : projectDir ,
155
+ "DevboxDir" : filepath .Join (projectDir , devboxDirName , pkg ),
156
+ "DevboxDirRoot" : filepath .Join (projectDir , devboxDirName ),
157
+ "DevboxProfileDefault" : filepath .Join (projectDir , nix .ProfilePath ),
158
+ "Virtenv" : filepath .Join (projectDir , devboxHiddenDirName , "virtenv" , pkg ),
159
159
}); err != nil {
160
160
return nil , errors .WithStack (err )
161
161
}
0 commit comments