Class: Appleseed

Inherits:
Object
  • Object
show all
Defined in:
lib/appleseed.rb,
lib/appleseed/errors.rb,
lib/appleseed/options.rb,
lib/appleseed/generator.rb,
lib/appleseed/application.rb,
lib/appleseed/generator/github_mixin.rb

Defined Under Namespace

Classes: FileInTheWay, GemspecError, Generator, GitInitFailed, NoGitHubRepoNameGiven, NoGitHubToken, NoGitHubUser, NoGitUserEmail, NoGitUserName, VersionYmlError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_dir = '.') ⇒ Appleseed

Returns a new instance of Appleseed.



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

def initialize(base_dir = '.')

  @base_dir       = base_dir
  @repo           = Git.open(git_base_dir) if in_git_repo?
  @output         = $stdout
  @commit         = true
end

Instance Attribute Details

#base_dirObject

Returns the value of attribute base_dir.



11
12
13
# File 'lib/appleseed.rb', line 11

def base_dir
  @base_dir
end

#commitObject

Returns the value of attribute commit.



11
12
13
# File 'lib/appleseed.rb', line 11

def commit
  @commit
end

#gemspecObject (readonly)

Returns the value of attribute gemspec.



10
11
12
# File 'lib/appleseed.rb', line 10

def gemspec
  @gemspec
end

#gemspec_helperObject (readonly)

Returns the value of attribute gemspec_helper.



10
11
12
# File 'lib/appleseed.rb', line 10

def gemspec_helper
  @gemspec_helper
end

#outputObject

Returns the value of attribute output.



11
12
13
# File 'lib/appleseed.rb', line 11

def output
  @output
end

#repoObject

Returns the value of attribute repo.



11
12
13
# File 'lib/appleseed.rb', line 11

def repo
  @repo
end

#version_helperObject (readonly)

Returns the value of attribute version_helper.



10
11
12
# File 'lib/appleseed.rb', line 10

def version_helper
  @version_helper
end

Instance Method Details

#git_base_dir(base_dir = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/appleseed.rb', line 21

def git_base_dir(base_dir = nil)
  if base_dir
    base_dir = File.dirname(base_dir)
  else
    base_dir = File.expand_path(self.base_dir || ".")
  end
  return nil if base_dir==File.dirname("/")
  return base_dir if File.exists?(File.join(base_dir, '.git'))
  return git_base_dir(base_dir)
end

#in_git_repo?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/appleseed.rb', line 32

def in_git_repo?
  git_base_dir
end