lib/almanack/cli.rb in almanack-1.0.0 vs lib/almanack/cli.rb in almanack-1.0.1
- old
+ new
@@ -31,19 +31,19 @@
desc "new PATH", "Create a new Almanack project"
option :theme, default: 'legacy', desc: "Which theme to use (available: #{available_themes.join(', ')})"
option :git, type: :boolean, default: true, desc: "Whether to initialize an empty git repo"
def new(path)
- path = Pathname(path).cleanpath
+ @path = Pathname(path).cleanpath
directory "templates/new", path
if options[:git]
- template('templates/gitignore', path.join(".gitignore"))
+ template('templates/gitignore', @path.join(".gitignore"))
end
- inside path do
+ inside @path do
say_status :installing, "bundler dependencies"
system "bundle install --quiet"
if options[:git]
say_status :git, "initializing repository"
@@ -51,11 +51,11 @@
end
say
say "==> Run your new calendar!"
say
- say " cd #{path}"
+ say " cd #{@path}"
say " almanack start"
say
end
end
@@ -106,9 +106,23 @@
run "#{heroku_command} create #{name}"
end
def theme_name
options[:theme]
+ end
+
+ def almanack_homepage
+ Almanack::HOMEPAGE
+ end
+
+ def almanack_issues
+ Almanack::ISSUES
+ end
+
+ def title
+ basename = @path.to_s.split('/', 2).last.split('.', 2).first
+ sanitized = basename.gsub('-', ' ')
+ sanitized.split(/\s+/).map(&:capitalize).join(' ')
end
def git(command)
output = `git #{command}`
abort "Git failed: #{output}" if $?.exitstatus != 0