Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Optimize commons files - configurable.rb & default.rb #1111

Merged
merged 3 commits into from
Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ namespace :arm do
Dir.chdir(File.expand_path('../azure_sdk/lib', __FILE__))
subdir_list = Dir['*'].reject{|o| not File.directory?(o)}
subdir_list.each do |subdir|
if subdir != 'common' && subdir != 'azure_sdk'
if subdir != 'azure_sdk'
folder_to_be_cleaned = File.expand_path("../azure_sdk/lib/#{subdir}", __FILE__)
puts "Cleaning folder - #{folder_to_be_cleaned}"
FileUtils.rm_rf(folder_to_be_cleaned)
Expand All @@ -168,11 +168,9 @@ namespace :arm do
Dir.chdir("#{__dir__}/management/#{gem}/lib/profiles")
subdir_list = Dir['*'].reject{|o| not File.directory?(o)}
subdir_list.each do |subdir|
if subdir.to_s != 'common'
folder_to_be_cleaned = "#{__dir__}/management/#{gem}/lib/profiles/#{subdir}"
puts "Cleaning folder - #{folder_to_be_cleaned}"
FileUtils.rm_rf(folder_to_be_cleaned)
end
folder_to_be_cleaned = "#{__dir__}/management/#{gem}/lib/profiles/#{subdir}"
puts "Cleaning folder - #{folder_to_be_cleaned}"
FileUtils.rm_rf(folder_to_be_cleaned)
end
end
end
Expand All @@ -189,9 +187,6 @@ namespace :arm do
# bundle exec ruby profile_generator_client.rb --dir_metadata=dir_metadata.json --profile=profiles.json --mode=rollup --key=azure_sdk
command = "#{get_base_profile_generation_cmd} --dir_metadata=#{__dir__}/generators/profilegen/src/resources/dir_metadata.json --profile=#{get_profile_spec_files_folder}/profiles.json --mode=rollup --key=azure_sdk --sdk_path=#{__dir__}"
execute_and_stream(command)

FileUtils.cp("#{__dir__}/generators/profilegen/src/resources/common/configurable.rb", "#{__dir__}/azure_sdk/lib/common/configurable.rb")
FileUtils.cp("#{__dir__}/generators/profilegen/src/resources/common/default.rb", "#{__dir__}/azure_sdk/lib/common/default.rb")
end

desc 'Regen individual profiles'
Expand All @@ -205,9 +200,6 @@ namespace :arm do
# bundle exec ruby profile_generator_client.rb --dir_metadata=dir_metadata.json --profile=authorization_profiles.json --mode=management --key=azure_mgmt_authorization
command = "#{get_base_profile_generation_cmd} --dir_metadata=#{__dir__}/generators/profilegen/src/resources/dir_metadata.json --profile=#{get_profile_spec_files_folder}/profiles.json --mode=management --key=#{gem} --sdk_path=#{__dir__}"
execute_and_stream(command)

FileUtils.cp("#{__dir__}/generators/profilegen/src/resources/common/configurable.rb", "#{__dir__}/management/#{gem}/lib/profiles/common/configurable.rb")
FileUtils.cp("#{__dir__}/generators/profilegen/src/resources/common/default.rb", "#{__dir__}/management/#{gem}/lib/profiles/common/default.rb")
end
end

Expand Down
57 changes: 0 additions & 57 deletions azure_sdk/lib/common/default.rb

This file was deleted.

4 changes: 1 addition & 3 deletions azure_sdk/lib/latest/latest_profile_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,13 @@
require 'latest/modules/subscriptions_profile_module'
require 'latest/modules/trafficmanager_profile_module'
require 'latest/modules/web_profile_module'
require 'common/configurable'
require 'common/default'

module Azure::Profiles::Latest::Mgmt
#
# Client class for the Latest profile SDK.
#
class Client
include Azure::Common::Configurable
include MsRestAzure::Common::Configurable

attr_reader :analysis_services, :authorization, :automation, :batch, :billing, :cdn, :cognitive_services, :commerce, :compute, :consumption, :container_instance, :container_registry, :container_service, :customer_insights, :data_lake_analytics, :data_lake_store, :dev_test_labs, :dns, :event_grid, :event_hub, :features, :graph, :iot_hub, :key_vault, :links, :locks, :logic, :machine_learning, :managed_applications, :marketplace_ordering, :media_services, :mobile_engagement, :monitor, :network, :notification_hubs, :operational_insights, :policy, :power_bi_embedded, :recovery_services, :recovery_services_backup, :recovery_services_site_recovery, :redis, :relay, :resources, :resources_management, :scheduler, :search, :server_management, :service_bus, :service_fabric, :sql, :stor_simple8000_series, :storage, :stream_analytics, :subscriptions, :traffic_manager, :web

Expand Down
4 changes: 1 addition & 3 deletions azure_sdk/lib/v2017_03_09/v2017_03_09_profile_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
require 'v2017_03_09/modules/policy_profile_module'
require 'v2017_03_09/modules/resources_profile_module'
require 'v2017_03_09/modules/subscriptions_profile_module'
require 'common/configurable'
require 'common/default'

module Azure::Profiles::V2017_03_09::Mgmt
#
# Client class for the V2017_03_09 profile SDK.
#
class Client
include Azure::Common::Configurable
include MsRestAzure::Common::Configurable

attr_reader :storage, :network, :compute, :features, :links, :locks, :policy, :resources, :subscriptions

Expand Down
86 changes: 0 additions & 86 deletions generators/profilegen/src/resources/common/configurable.rb

This file was deleted.

57 changes: 0 additions & 57 deletions generators/profilegen/src/resources/common/default.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ require 'profiles/<%= @profile_name.downcase %>/<%= @module_definition_file_name
<%- @file_names.each do |file_name| -%>
require 'profiles/<%= @profile_name.downcase %>/modules/<%= file_name %>'
<%- end -%>
require 'profiles/common/configurable'
require 'profiles/common/default'

module Azure::<%= @class_name %>::Profiles::<%= @profile_name %>::Mgmt
#
# Client class for the <%= @profile_name %> profile SDK.
#
class Client < <%= "#{@class_names[0]}" %>Class
include Azure::Common::Configurable
include MsRestAzure::Common::Configurable


def initialize(options = {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ require '<%= @profile_name.downcase %>/<%= @module_definition_file_name.gsub('.r
<%- @file_names.each do |file_name| -%>
require '<%= @profile_name.downcase %>/modules/<%= file_name %>'
<%- end -%>
require 'common/configurable'
require 'common/default'

module Azure::Profiles::<%= @profile_name %>::Mgmt
#
# Client class for the <%= @profile_name %> profile SDK.
#
class Client
include Azure::Common::Configurable
include MsRestAzure::Common::Configurable

attr_reader <% @class_names.each_with_index do |class_name, index| %> :<%= class_name.gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase %><% if index != @class_names.length - 1 %>,<% end %><% end %>

Expand Down
Loading