Class: PGit::Configuration
- Inherits:
-
Object
- Object
- PGit::Configuration
- Defined in:
- lib/pgit/configuration.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config_path = '~/.pgit.rc.yml') ⇒ Configuration
constructor
A new instance of Configuration.
- #to_yaml ⇒ Object
Constructor Details
#initialize(config_path = '~/.pgit.rc.yml') ⇒ Configuration
Returns a new instance of Configuration.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/pgit/configuration.rb', line 28 def initialize(config_path = '~/.pgit.rc.yml') @expanded_path = File.(config_path) if File.exists? @expanded_path config_file = File.open(@expanded_path, 'r') @yaml = YAML.load(config_file) validate_existence_of_at_least_one_project validate_presence_of_items_in_each_project else raise missing_config_default end end |
Class Method Details
.default_options ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pgit/configuration.rb', line 11 def self. { 'projects' => [ { 'api_token' => 'somepivotalatoken124', 'id' => '12345', "path" => "~/some/path/to/a/pivotal-git/project" }, { 'api_token' => 'somepivotalatoken124', 'id' => '23429070', "path" => "~/some/other/pivotal-git/project" } ] } end |
Instance Method Details
#to_yaml ⇒ Object
41 42 43 |
# File 'lib/pgit/configuration.rb', line 41 def to_yaml @yaml end |