Class: Google::Cloud::Gemserver::CLI::Project
- Inherits:
-
Object
- Object
- Google::Cloud::Gemserver::CLI::Project
- Defined in:
- lib/google/cloud/gemserver/cli/project.rb
Overview
Project
Holds a reference to a project on Google Cloud Platform.
Instance Attribute Summary collapse
-
#config ⇒ Configuration
The Configuration object storing the settings used by the Project object.
-
#proj_name ⇒ String
The name of the project on Google Cloud platform; same as ID.
Instance Method Summary collapse
-
#create ⇒ Object
Fetches a reference to the given project on Google Cloud Platform and prompts the user to configure it correctly.
-
#initialize(name = nil) ⇒ Project
constructor
Initializes the project name and Configuration object.
Constructor Details
#initialize(name = nil) ⇒ Project
Initializes the project name and Configuration object.
43 44 45 46 |
# File 'lib/google/cloud/gemserver/cli/project.rb', line 43 def initialize name = nil @proj_name = name @config = Configuration.new end |
Instance Attribute Details
#config ⇒ Configuration
The Configuration object storing the settings used by the Project object.
39 40 41 |
# File 'lib/google/cloud/gemserver/cli/project.rb', line 39 def config @config end |
#proj_name ⇒ String
The name of the project on Google Cloud platform; same as ID.
33 34 35 |
# File 'lib/google/cloud/gemserver/cli/project.rb', line 33 def proj_name @proj_name end |
Instance Method Details
#create ⇒ Object
Fetches a reference to the given project on Google Cloud Platform and prompts the user to configure it correctly.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/google/cloud/gemserver/cli/project.rb', line 51 def create raise "Project name was not provided!" unless @proj_name begin @config.update_config @proj_name, :proj_id create_gae_project enable_api enable_billing project rescue Google::Cloud::PermissionDeniedError, RuntimeError => e puts "Permission denied. You might not be authorized with " \ "gcloud. Read github.com/GoogleCloudPlatform/google-cloud`." \ "-ruby/google-cloud-gemserver/docs/authentication.md for " \ "more information on how to get authenticated." puts "If you still get this error the Cloud Resource Manager " \ "API might not be enabled." abort "More details: #{e.}" end end |