-
-
Save sondr3/76922596f42203f13bd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/P/apptest ❯❯❯ app plant ⏎ | |
Scaffolding assets | |
create assets/fonts | |
create assets/images | |
create assets/javascript | |
create assets/scss | |
create assets/stylesheets | |
Scaffolding content | |
create content/_drafts | |
create content/_posts | |
Scaffolding views and templates | |
create views/_includes | |
create views/_layouts | |
create views/_shortcodes | |
create views/_templates | |
/Users/username/.gem/ruby/2.2.0/gems/app-0.0.6/lib/app/scaffold.rb:36:in `open': No such file or directory @ dir_initialize - /Users/username/Projects/apptest/scaffold (Errno::ENOENT) | |
from /Users/username/.gem/ruby/2.2.0/gems/app-0.0.6/lib/app/scaffold.rb:36:in `foreach' | |
from /Users/username/.gem/ruby/2.2.0/gems/app-0.0.6/lib/app/scaffold.rb:36:in `plant_files' | |
from /Users/username/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run' | |
from /Users/username/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command' | |
from /Users/username/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all' | |
from /Users/username/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each' | |
from /Users/username/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map' | |
from /Users/username/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all' | |
from /Users/username/.gem/ruby/2.2.0/gems/app-0.0.6/lib/app/cli.rb:15:in `plant' | |
from /Users/username/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run' | |
from /Users/username/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command' | |
from /Users/username/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch' | |
from /Users/username/.gem/ruby/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start' | |
from /Users/username/.gem/ruby/2.2.0/gems/app-0.0.6/bin/app:3:in `<top (required)>' | |
from /Users/username/.gem/ruby/2.2.0/bin/app:23:in `load' | |
from /Users/username/.gem/ruby/2.2.0/bin/app:23:in `<main>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module App | |
class Scaffold < Thor::Group | |
include Thor::Actions | |
desc "Plant a new site" | |
#def self.source_root | |
# File.expand_path("../../scaffold", __FILE__) | |
#end | |
def plant_assets | |
puts "\n\tScaffolding assets".bold.blue | |
%w(assets/fonts assets/images assets/javascript assets/scss assets/stylesheets).each do |dir| | |
puts "\tcreate\t".bold.green + "#{dir}" | |
FileUtils.mkdir_p(File.join(Dir.pwd, dir)) | |
end | |
end | |
def plant_content | |
puts "\n\tScaffolding content".bold.blue | |
%w(content/_drafts content/_posts).each do |dir| | |
puts "\tcreate\t".bold.green + "#{dir}" | |
FileUtils.mkdir_p(File.join(Dir.pwd, dir)) | |
end | |
end | |
def plant_views | |
puts "\n\tScaffolding views and templates".bold.blue | |
%w(views/_includes views/_layouts views/_shortcodes views/_templates).each do |dir| | |
puts "\tcreate\t".bold.green + "#{dir}" | |
FileUtils.mkdir_p(File.join(Dir.pwd, dir)) | |
end | |
end | |
def plant_files | |
Dir.foreach(template_dir) do |file| | |
next if file == "." or file == ".." | |
puts "\tcreate\t".bold.green + "#{file}" | |
copy_file file, Dir.pwd | |
end | |
end | |
def template_dir | |
File.expand_path("scaffold") | |
end | |
def bundle_install | |
inside destination_root do | |
run "bundle install" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment