theme-juice 0.10.3 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c31f52778569765ae8d2184426a107850cd7e15
4
- data.tar.gz: df21f1f810814fb17e8653aa8ee44e0142cff999
3
+ metadata.gz: b86241b9b2883ed2adddf9dd120c86f4f8f59c41
4
+ data.tar.gz: 30c1aad3368d040c1d97b639d0b2403f77be438d
5
5
  SHA512:
6
- metadata.gz: 9b9afa8f91fe59237a8e5bbe7117aaa7c017a6ed5d1c84b44a7337d48621882d94954a41a90a0c68b6ce29a55837bf70f4a5a42aefc22f7c12d537808dae67ec
7
- data.tar.gz: cb687b18119b4dd6b92f8f7832d46fcff5f0d227889d112846afcec43e20a890109ba5e8efca05eeeaeb2f54639b7ca6f5cacf33134ab6172bb4bce728df626d
6
+ metadata.gz: ef99c8ad896be4a6eb983cee174b45f73a1e96a9b61790202f47284c6b4fc0ed3d6db55ff5f9f53302911d9d1ec504aec6490149bbb68e0b202e3e766dd64ddb
7
+ data.tar.gz: 46dcd3804620abbf9d5c0036694edc7b09b339a02e5b5524c8ca38ddca5430a6e4e80d9929c5cad84550eb6f4c54cd8ca750ef97ba8ec2c014a16ee4e86eeced
data/README.md CHANGED
@@ -4,12 +4,18 @@
4
4
  [![Code Climate](https://img.shields.io/codeclimate/github/ezekg/theme-juice-cli.svg?style=flat-square)](https://codeclimate.com/github/ezekg/theme-juice-cli)
5
5
  [![Code Climate](https://img.shields.io/codeclimate/coverage/github/ezekg/theme-juice-cli.svg?style=flat-square)](https://codeclimate.com/github/ezekg/theme-juice-cli)
6
6
 
7
+ ![Theme Juice CLI](demo.gif)
8
+
7
9
  _This project is currently under active development and will not be completely 'stable' per-say until we hit `1.0`. Everything here is subject to change without notice. (We will of course semantically version all of our releases, with the minor version being incremented with new features/breaking changes.) Feel free to contribute to the development with new features, ideas or bug fixes._
8
10
 
11
+ _The master branch contains features currently in development (such as deployment), so don't expect it to work at all times. Grab the newest RubyGem instead of building directly from master._
12
+
9
13
  [View our contributing guidelines to get started!](#contributing)
10
14
 
15
+
11
16
  ## What is it?
12
- `tj` is a WordPress development command line utility that allows you to scaffold out an entire Vagrant development environment in seconds (using an Apache fork of [VVV](https://github.com/Varying-Vagrant-Vagrants/VVV) called [VVV-Apache](https://github.com/ericmann/vvv-apache.git) as the VM). It also helps you manage dependencies and build tools, and can even handle your deployments.
17
+ Theme Juice (`tj`) is a command line utility for modern WordPress development. It allows you to scaffold out a Vagrant development environment in seconds (using an Apache fork of [VVV](https://github.com/Varying-Vagrant-Vagrants/VVV) called [VVV-Apache](https://github.com/ericmann/vvv-apache.git) as the VM), and generate/manage an unlimited number of development projects. It also helps you manage dependencies and build tools, and can even handle your deployments.
18
+
13
19
 
14
20
  ## Requirements
15
21
  **`tj` requires [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) to be able to create virtual machines for local development. Please download and install both of these before getting started.**
@@ -25,6 +31,8 @@ gem install theme-juice
25
31
 
26
32
  ## Getting Started
27
33
 
34
+ _If you're going to be using [our starter theme](https://github.com/ezekg/theme-juice-starter), then I recommend checking out [it's dependencies](https://github.com/ezekg/theme-juice-starter#development-dependencies) before running your first `create`. That way, the build step doesn't fail._
35
+
28
36
  #### Create a new project
29
37
  This will lead you through a series of prompts to set up required project information, such as name, location, theme, database info, etc. Using the specified information, it will run the installation process and set up a local development environment, if one hasn't already been set up. It will sync your local project location with the project
30
38
  location within the VM, so you can run this from anywhere on your local system.
@@ -33,6 +41,15 @@ location within the VM, so you can run this from anywhere on your local system.
33
41
  tj create
34
42
  ```
35
43
 
44
+ ##### What happens on your first `create`?
45
+ `tj` will clone the selected VM to your `vm-path` (default path is `~/vagrant/`); after that finishes up, it will create all of the necessary project files, such as:
46
+ * `Customfile` containing DNS and synced folder settings
47
+ * `init-custom.sql` containing database setup
48
+ * `project.conf` containing server settings
49
+ * `wp-cli.local.yml` containing VM paths
50
+
51
+ Once those things are done, `tj` will run the starter theme's installation (via the `Juicefile`, if present), and then finally provision the VM to put the new configuration into effect. If you've never used Vagrant before, the first provision might take awhile. After that's done, you should be able to access your new project at the specified url.
52
+
36
53
  #### Set up an existing project
37
54
  This sets up an existing local project within the development environment. You will go through a series of prompts to create the necessary files. This command is essentially an alias for `tj create --bare`.
38
55
 
@@ -49,6 +66,13 @@ It will not touch your local folders that were synced to the VM.
49
66
  tj delete
50
67
  ```
51
68
 
69
+ #### Deploying a project
70
+ This will deploy a project to the passed `stage` using [Capistrano](http://capistranorb.com/).
71
+
72
+ ```
73
+ tj deploy <stage>
74
+ ```
75
+
52
76
  #### Want more?
53
77
  Want to check out all of the various flags and features `tj` offers? Just ask `tj` for help, and you'll be greeted with a nice `man` page full of information about how to use just about everything.
54
78
 
@@ -56,7 +80,7 @@ Want to check out all of the various flags and features `tj` offers? Just ask `t
56
80
  tj help
57
81
  ```
58
82
 
59
- Or, check out [themejuice.it](http://themejuice.it) for a pretty website chock-full of documentation.
83
+ Or, you can also check out [themejuice.it](http://themejuice.it) for a pretty website chock-full of the same documentation provided by `tj help`.
60
84
 
61
85
  ## FAQ
62
86
 
@@ -108,6 +132,10 @@ Yes and no; in order for `tj` to properly create a project, the Vagrant box need
108
132
  | | ├── site-1.conf
109
133
  | | ├── site-2.conf
110
134
  | | ..
135
+ | ├── database/
136
+ | | |
137
+ | | ├── init-custom.sql
138
+ | | ..
111
139
  | ..
112
140
  ├── www/
113
141
  | |
@@ -133,24 +161,41 @@ A YAML configuration file (`Juicefile`) can be used to store commonly-used build
133
161
  Below is the config that comes baked into [our starter theme](https://github.com/ezekg/theme-juice-starter):
134
162
 
135
163
  ```yml
164
+ #
165
+ # Manage command aliases for the current application
166
+ #
136
167
  commands:
168
+
169
+ # Run application install scripts
137
170
  install:
138
171
  - composer install
139
- - bundler install
172
+ - bundle install
140
173
  - npm install
141
174
  - bower install
142
175
  - grunt build
176
+
177
+ # Manage build tools
143
178
  watch:
144
179
  - grunt %args%
180
+
181
+ # Manage front-end dependencies
145
182
  assets:
146
183
  - bower %args%
184
+
185
+ # Manage back-end dependencies
147
186
  vendor:
148
187
  - composer %args%
188
+
189
+ # Manage WP installation
149
190
  wp:
150
191
  - wp ssh --host=vagrant %args%
192
+
193
+ # Create a backup of the current database with a nice timestamp
151
194
  backup:
152
195
  - mkdir -p backup
153
196
  - wp ssh --host=vagrant db export backup/$(date +'%Y-%m-%d-%H-%M-%S').sql
197
+
198
+ # Package up entire application into a gzipped tar file
154
199
  dist:
155
200
  - tar -zcvf dist.tar.gz .
156
201
  ```
@@ -168,13 +213,15 @@ cmd3 "%arg4%"
168
213
  You can specify an unlimited number of commands with an unlimited number of arguments; however, you should be careful with how this is used. Don't go including `sudo rm -rf %arg1%` in a command, while passing `/` as an argument. Keep it simple. These are meant to make your life easier by helping you manage build tools, not to do fancy scripting.
169
214
 
170
215
  #### Does `tj` handle deployments?
171
- Eventually, yes. It's not currently production-ready, but as soon as it is, we'll have detailed instructions on how to configure and deploy applications using `tj`. Right now, I'm leaning towards integrating an automated Capistrano workflow, but am open to other options. [Have an idea and want to contribute?](#contributing)
216
+ As of `0.11`, yes! Check out the [documentation](http://themejuice.it/deploy) to get started.
172
217
 
173
218
  #### Can I access a project from another device (i.e. mobile)?
174
219
  Yes! Every project created with `tj` will automatically be set up to support using [xip.io](http://xip.io/). If you're using OSX, then everything should work out of the box. If you're not using OSX, then you'll need to point port `80` on your host machine to `8080`; Vagrant cannot do this by default for security reasons.
175
220
 
176
221
  Once everything is good to go, you can access a project from another device on the same network by going to `<project-name>.<your-hosts-ip-address>.xip.io` e.g. `themejuice.192.168.1.1.xip.io`.
177
222
 
223
+ _If you're familiar with forwarding host ports on operating systems other than OSX, check out [this file](https://github.com/ezekg/theme-juice-cli/blob/master/lib/theme-juice/tasks/forward_ports.rb#L34-L51) and make a pull request so that everybody else can benefit from your smarts._
224
+
178
225
  #### Help! It won't let me `git clone` anything!
179
226
  You most likely don't have [SSH-keys for GitHub set up correctly (if even at all)](https://help.github.com/articles/error-permission-denied-publickey/). Either set that up, or manually run `tj` with the appropriate flags corresponding to the problem-repository, swapping out `git@github.com:` for `https://github.com/`:
180
227
 
data/lib/theme-juice.rb CHANGED
@@ -4,12 +4,14 @@ require "thor"
4
4
  require "faker"
5
5
  require "os"
6
6
  require "yaml"
7
+ require "capistrano/all"
7
8
 
8
9
  module ThemeJuice
9
10
  end
10
11
 
11
12
  require "theme-juice/version"
12
13
  require "theme-juice/helpers/singleton_helper"
14
+ require "theme-juice/helpers/hash_helper"
13
15
  require "theme-juice/env"
14
16
  require "theme-juice/project"
15
17
  require "theme-juice/util"
@@ -41,6 +43,11 @@ require "theme-juice/tasks/vm_provision"
41
43
  require "theme-juice/tasks/vm_restart"
42
44
  require "theme-juice/tasks/import_database"
43
45
  require "theme-juice/tasks/list"
46
+ require "theme-juice/tasks/stage"
47
+ require "theme-juice/tasks/vm_stage"
48
+ require "theme-juice/tasks/settings"
49
+ require "theme-juice/tasks/load"
50
+ require "theme-juice/tasks/invoke"
44
51
  require "theme-juice/command"
45
52
  require "theme-juice/commands/create"
46
53
  require "theme-juice/commands/delete"
@@ -56,20 +56,20 @@ module ThemeJuice
56
56
  map %w[server remote] => :deploy
57
57
  map %w[vagrant vvv] => :vm
58
58
 
59
- class_option :vm_box, :type => :string, :default => nil, :desc => "Force Vagrant box for use as VM"
60
- class_option :vm_path, :type => :string, :default => nil, :desc => "Force path to VM"
61
- class_option :vm_ip, :type => :string, :default => nil, :desc => "Force IP address of VM"
62
- class_option :vm_prefix, :type => :string, :default => nil, :desc => "Force directory prefix for project in VM"
63
- class_option :yolo, :type => :boolean, :desc => "Say yes to anything and everything (try it)"
64
- class_option :boring, :type => :boolean, :desc => "Prints all output without anything fancy"
65
- class_option :no_unicode, :type => :boolean, :desc => "Prints all output without unicode characters"
66
- class_option :no_colors, :type => :boolean, :aliases => "--no-color", :desc => "Prints all output without color"
67
- class_option :no_animations, :type => :boolean, :desc => "Prints all output without animations"
68
- class_option :no_landrush, :type => :boolean, :desc => "Disable landrush for DNS"
69
- class_option :no_port_forward, :type => :boolean, :aliases => "--no-port-forwarding", :desc => "Disable automatic port forwarding"
70
- class_option :verbose, :type => :boolean, :desc => "Prints out additional logging information"
71
- class_option :dryrun, :type => :boolean, :aliases => "--dry-run", :desc => "Run a command without actually executing anything"
72
- class_option :nginx, :type => :boolean, :aliases => "--no-apache", :desc => "Create conf files for nginx instead of apache"
59
+ class_option :vm_box, :type => :string, :default => nil, :desc => ""
60
+ class_option :vm_path, :type => :string, :default => nil, :desc => ""
61
+ class_option :vm_ip, :type => :string, :default => nil, :desc => ""
62
+ class_option :vm_prefix, :type => :string, :default => nil, :desc => ""
63
+ class_option :yolo, :type => :boolean, :desc => ""
64
+ class_option :boring, :type => :boolean, :desc => ""
65
+ class_option :no_unicode, :type => :boolean, :desc => ""
66
+ class_option :no_colors, :type => :boolean, :aliases => "--no-color", :desc => ""
67
+ class_option :no_animations, :type => :boolean, :desc => ""
68
+ class_option :no_landrush, :type => :boolean, :desc => ""
69
+ class_option :no_port_forward, :type => :boolean, :aliases => "--no-port-forwarding", :desc => ""
70
+ class_option :verbose, :type => :boolean, :desc => ""
71
+ class_option :dryrun, :type => :boolean, :aliases => "--dry-run", :desc => ""
72
+ class_option :nginx, :type => :boolean, :aliases => "--no-apache", :desc => ""
73
73
 
74
74
  desc "--help, -h", "View man page"
75
75
  def help(command = nil)
@@ -96,51 +96,51 @@ module ThemeJuice
96
96
  end
97
97
 
98
98
  desc "create", "Create new project"
99
- method_option :name, :type => :string, :aliases => "-n", :default => nil, :desc => "Name of the project"
100
- method_option :location, :type => :string, :aliases => "-l", :default => nil, :desc => "Location of the local project"
101
- method_option :theme, :type => :string, :aliases => "-t", :default => nil, :desc => "Starter theme to install"
102
- method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => "Development URL for the project"
103
- method_option :repository, :type => :string, :aliases => "-r", :desc => "Initialize a new Git remote repository"
104
- method_option :db_import, :type => :string, :aliases => %w[-i --import-db], :desc => "Import an existing database"
105
- method_option :bare, :type => :boolean, :aliases => %w[--no-theme], :desc => "Create a project without a starter theme"
106
- method_option :skip_repo, :type => :boolean, :desc => "Skip repository prompts and use default settings"
107
- method_option :skip_db, :type => :boolean, :desc => "Skip database prompts and use default settings"
108
- method_option :use_defaults, :type => :boolean, :desc => "Skip all prompts and use default settings"
109
- method_option :no_wp, :type => :boolean, :desc => "Project is not a WordPress install"
110
- method_option :no_db, :type => :boolean, :desc => "Project does not need a database"
99
+ method_option :name, :type => :string, :aliases => "-n", :default => nil, :desc => ""
100
+ method_option :location, :type => :string, :aliases => "-l", :default => nil, :desc => ""
101
+ method_option :theme, :type => :string, :aliases => "-t", :default => nil, :desc => ""
102
+ method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => ""
103
+ method_option :repository, :type => :string, :aliases => "-r", :desc => ""
104
+ method_option :db_import, :type => :string, :aliases => %w[-i --import-db], :desc => ""
105
+ method_option :bare, :type => :boolean, :aliases => %w[--no-theme], :desc => ""
106
+ method_option :skip_repo, :type => :boolean, :desc => ""
107
+ method_option :skip_db, :type => :boolean, :desc => ""
108
+ method_option :use_defaults, :type => :boolean, :desc => ""
109
+ method_option :no_wp, :type => :boolean, :desc => ""
110
+ method_option :no_db, :type => :boolean, :desc => ""
111
111
  def create
112
112
  @io.hello
113
113
  @create.new(options).execute
114
114
  end
115
115
 
116
116
  desc "setup", "Setup existing project"
117
- method_option :name, :type => :string, :aliases => "-n", :default => nil, :desc => "Name of the project"
118
- method_option :location, :type => :string, :aliases => "-l", :default => nil, :desc => "Location of the local project"
119
- method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => "Development URL for the project"
120
- method_option :repository, :type => :string, :aliases => "-r", :desc => "Initialize a new Git remote repository"
121
- method_option :db_import, :type => :string, :aliases => %w[-i --import-db], :desc => "Import an existing database"
122
- method_option :skip_repo, :type => :boolean, :desc => "Skip repository prompts and use default settings"
123
- method_option :skip_db, :type => :boolean, :desc => "Skip database prompts and use default settings"
124
- method_option :use_defaults, :type => :boolean, :desc => "Skip all prompts and use default settings"
125
- method_option :no_wp, :type => :boolean, :desc => "Project is not a WordPress install"
126
- method_option :no_db, :type => :boolean, :desc => "Project does not need a database"
117
+ method_option :name, :type => :string, :aliases => "-n", :default => nil, :desc => ""
118
+ method_option :location, :type => :string, :aliases => "-l", :default => nil, :desc => ""
119
+ method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => ""
120
+ method_option :repository, :type => :string, :aliases => "-r", :desc => ""
121
+ method_option :db_import, :type => :string, :aliases => %w[-i --import-db], :desc => ""
122
+ method_option :skip_repo, :type => :boolean, :desc => ""
123
+ method_option :skip_db, :type => :boolean, :desc => ""
124
+ method_option :use_defaults, :type => :boolean, :desc => ""
125
+ method_option :no_wp, :type => :boolean, :desc => ""
126
+ method_option :no_db, :type => :boolean, :desc => ""
127
127
  def setup
128
128
  @io.hello
129
129
  @create.new(options.dup.merge(:bare => true)).execute
130
130
  end
131
131
 
132
132
  desc "delete", "Delete a project (does not delete local project)"
133
- method_option :name, :type => :string, :aliases => "-n", :default => nil, :desc => "Name of the project"
134
- method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => "Development URL for the project"
135
- method_option :db_drop, :type => :boolean, :aliases => "--drop-db", :desc => "Drop the project's database"
136
- method_option :vm_restart, :type => :boolean, :aliases => "--restart-vm", :desc => "Restart the VM after deletion"
133
+ method_option :name, :type => :string, :aliases => "-n", :default => nil, :desc => ""
134
+ method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => ""
135
+ method_option :db_drop, :type => :boolean, :aliases => "--drop-db", :desc => ""
136
+ method_option :vm_restart, :type => :boolean, :aliases => "--restart-vm", :desc => ""
137
137
  def delete
138
138
  @delete.new(options).unexecute
139
139
  end
140
140
 
141
- desc "deploy", "Deploy a project"
142
- def deploy
143
- @deploy.new(options).execute
141
+ desc "deploy STAGE [,ARGS]", "Deploy a project"
142
+ def deploy(stage, *args)
143
+ @deploy.new(options).send(stage, *args).execute
144
144
  end
145
145
 
146
146
  desc "list", "List all projects"
@@ -149,54 +149,54 @@ module ThemeJuice
149
149
  end
150
150
 
151
151
  desc "update", "Update tj and its dependencies"
152
- def update(*commands)
152
+ def update(*args)
153
153
  @io.error "Not implemented"
154
154
  end
155
155
 
156
156
  desc "install", "Run theme installation"
157
- def install(*commands)
158
- @config.install commands
157
+ def install(*args)
158
+ @config.command :install, args
159
159
  end
160
160
 
161
- desc "watch [COMMANDS]", "Manage development build tools"
162
- def watch(*commands)
163
- @config.watch commands
161
+ desc "watch [ARGS]", "Manage development build tools"
162
+ def watch(*args)
163
+ @config.command :watch, args
164
164
  end
165
165
 
166
- desc "assets [COMMANDS]", "Manage front-end dependencies"
167
- def assets(*commands)
168
- @config.assets commands
166
+ desc "assets [ARGS]", "Manage front-end dependencies"
167
+ def assets(*args)
168
+ @config.command :assets, args
169
169
  end
170
170
 
171
- desc "vendor [COMMANDS]", "Manage back-end dependencies"
172
- def vendor(*commands)
173
- @config.vendor commands
171
+ desc "vendor [ARGS]", "Manage back-end dependencies"
172
+ def vendor(*args)
173
+ @config.command :vendor, args
174
174
  end
175
175
 
176
- desc "dist [COMMANDS]", "Package project for distribution"
177
- def dist(*commands)
178
- @config.dist commands
176
+ desc "dist [ARGS]", "Package project for distribution"
177
+ def dist(*args)
178
+ @config.command :dist, args
179
179
  end
180
180
 
181
- desc "wp [COMMANDS]", "Manage WordPress installation"
182
- def wp(*commands)
183
- @config.wp commands
181
+ desc "wp [ARGS]", "Manage WordPress installation"
182
+ def wp(*args)
183
+ @config.command :wp, args
184
184
  end
185
185
 
186
- desc "backup [COMMANDS]", "Backup project"
187
- def backup(*commands)
188
- @config.backup commands
186
+ desc "backup [ARGS]", "Backup project"
187
+ def backup(*args)
188
+ @config.command :backup, args
189
189
  end
190
190
 
191
- desc "test [COMMANDS]", "Manage and run project tests"
192
- def test(*commands)
193
- @config.test commands
191
+ desc "test [ARGS]", "Manage and run project tests"
192
+ def test(*args)
193
+ @config.command :test, args
194
194
  end
195
195
 
196
- desc "vm [COMMANDS]", "Manage development environment"
197
- def vm(*commands)
196
+ desc "vm [ARGS]", "Manage development environment"
197
+ def vm(*args)
198
198
  @util.inside @env.vm_path do
199
- @util.run "vagrant #{commands.join(" ")}", :verbose => @env.verbose
199
+ @util.run "vagrant #{args.join(" ")}", :verbose => @env.verbose
200
200
  end
201
201
  end
202
202
  end
@@ -6,7 +6,27 @@ module ThemeJuice
6
6
 
7
7
  def initialize(opts = {})
8
8
  super
9
- runner { @io.error "Not implemented" }
9
+
10
+ @config.deployment.stages.keys.each do |stage|
11
+ self.class.send :define_method, stage do |*args|
12
+ @env.cap = Capistrano::Application.new
13
+ @env.stage = stage.to_sym
14
+
15
+ runner do |tasks|
16
+ tasks << Tasks::Stage.new
17
+ tasks << Tasks::VMStage.new
18
+ tasks << Tasks::Settings.new
19
+ tasks << Tasks::Load.new
20
+ tasks << Tasks::Invoke.new(args)
21
+ end
22
+
23
+ self
24
+ end
25
+ end
26
+ end
27
+
28
+ def method_missing(method, *args, &block)
29
+ @io.error "It looks like the stage '#{method}' doesn't exist"
10
30
  end
11
31
  end
12
32
  end
@@ -7,18 +7,21 @@ module ThemeJuice
7
7
  @project = Project
8
8
  @util = Util.new
9
9
 
10
- def method_missing(method, *args, &block)
11
- @project.location ||= Dir.pwd
12
-
10
+ def command(sequence, *args)
13
11
  begin
14
- config.fetch("commands", {})
15
- .fetch("#{method}") { @io.error "Command '#{method}' not found in config", NotImplementedError }
16
- .each { |cmd| run format_command(cmd, *args) }
12
+ config.commands.fetch("#{sequence}") {
13
+ @io.error "Command '#{sequence}' not found in config", NotImplementedError }
14
+ .each { |c| run format_command(c, *args) }
17
15
  rescue NoMethodError
18
16
  @io.say "Skipping...", :color => :yellow, :icon => :notice
19
17
  end
20
18
  end
21
19
 
20
+ def deployment
21
+ config.deployment ||
22
+ @io.error("Deployment settings not found in config", NotImplementedError)
23
+ end
24
+
22
25
  private
23
26
 
24
27
  def run(command)
@@ -40,7 +43,10 @@ module ThemeJuice
40
43
 
41
44
  def config
42
45
  begin
43
- YAML.load_file Dir["#{@project.location}/*"].select { |f| config_regex =~ File.basename(f) }.last ||
46
+ @project.location ||= Dir.pwd
47
+
48
+ YAML.load_file Dir["#{@project.location}/*"].select { |f|
49
+ config_regex =~ File.basename(f) }.last ||
44
50
  @io.error("Config file not found in '#{@project.location}'", LoadError)
45
51
  rescue ::Psych::SyntaxError => err
46
52
  @io.error "Config file contains invalid YAML", SyntaxError do
@@ -52,7 +58,7 @@ module ThemeJuice
52
58
  end
53
59
 
54
60
  def config_regex
55
- %r{^(((\.)?(tj)|((J|j)uicefile))(.y(a)?ml)?$)}
61
+ %r{^(((\.)?(tj)|((J|j)uicefile))(\.y(a)?ml)?$)}
56
62
  end
57
63
 
58
64
  def multi_arg_regex