Top Level Namespace

Defined Under Namespace

Modules: Starter

Instance Method Summary collapse

Instance Method Details

#confirm_command(command) ⇒ Object



46
47
48
49
50
51
52
53
# File 'lib/starter/tasks/starter.rb', line 46

def confirm_command(command)
  if Starter::Prompt.confirm("Issue command '#{command}'?")
    sh command
  else
    puts "Cancelled."
    exit
  end
end

#format_issue(issue, format = "plain") ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/starter/tasks/github.rb', line 49

def format_issue(issue, format="plain")
  if issue["assignee"]
     = issue["assignee"]["login"]
  else
     = nil
  end
  case format
  when "markdown"
    "* #{ || "<unassigned>"} - [#{issue.number}](#{issue.html_url}) - #{issue.title}"
  when "plain"
    "* %-16s - %-4s - %s" % [, "##{issue.number}", issue.title]
  else
    raise "Unknown format for issue printing: '#{format}'"
  end
end

#gemspec_template(options = {}) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/starter/tasks/gems.rb', line 90

def gemspec_template(options={})
  project_name, author = options.values_at(:project_name, :author)
  gemspec = <<-TXT
Gem::Specification.new do |s|
  s.name = "#{project_name}"
  s.version = "0.1.0"
  s.authors = ["#{author}"]
  #s.homepage = ""
  s.summary = "A new project, a nascent bundle of win, whose author hasn't described it yet."

  s.files = %w[
    LICENSE
    README.md
  ] + Dir["lib/**/*.rb"]
  s.require_path = "lib"

  s.add_development_dependency("starter", ">=0.1.0")
end
  TXT
end

#gitignore(string) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/starter/tasks/starter.rb', line 55

def gitignore(string)
  Starter::Prompt.confirm "Append #{string} to your .gitignore?" do
    File.open(".gitignore", "a") do |f|
      f.puts(string)
    end
  end
end

#mit_license(options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/starter/tasks/bootstrap.rb', line 15

def mit_license(options)
  author = options[:author]
  license = <<-TXT
Copyright (c) #{Time.now.year} #{author}

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  TXT
end

#read_gemspec(file) ⇒ Object



85
86
87
88
# File 'lib/starter/tasks/gems.rb', line 85

def read_gemspec(file)
  str = File.read(file)
  eval(str)
end

#readme(options) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/starter/tasks/markdown.rb', line 13

def readme(options)
  project_name = options[:project_name]
  text = <<-TXT
# #{Starter::Extensions::String.camel_case(project_name)}

  TXT
end