Class: Splunk::Pickaxe::CLI
- Inherits:
-
Thor
- Object
- Thor
- Splunk::Pickaxe::CLI
- Defined in:
- lib/splunk/pickaxe/cli.rb
Instance Method Summary collapse
Instance Method Details
#init ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/splunk/pickaxe/cli.rb', line 12 def init puts 'Creating Splunk Object directories...' [ Alerts::DIR, Dashboards::DIR, EventTypes::DIR, Macros::DIR, Reports::DIR, Tags::DIR, FieldExtractions::DIR ].each do |dir| Dir.mkdir dir unless Dir.exist? dir end puts 'Writing Gemfile ...' File.open('Gemfile', 'w') do |f| f.puts 'source "https://rubygems.org"' f.puts f.puts 'gem "splunk-pickaxe"' end puts 'Writing .pickaxe.yml ...' File.open('.pickaxe.yml', 'w') do |f| f.puts 'namespace:' f.puts ' app: TODO' f.puts 'environments:' f.puts ' MY_ENV:' f.puts ' url: SPLUNK_API_URL' f.puts ' emails:' f.puts ' - [email protected]' end end |
#save(environment) ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/splunk/pickaxe/cli.rb', line 65 def save(environment) cli = HighLine.new user = [:user] || Etc.getlogin password = [:password] || cli.ask('Password: ') { |o| o.echo = '*' } pickaxe = Pickaxe.configure environment, user, password, pickaxe.save_all end |
#sync(environment) ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/splunk/pickaxe/cli.rb', line 49 def sync(environment) cli = HighLine.new user = [:user] || Etc.getlogin password = [:password] || cli.ask('Password: ') { |o| o.echo = '*' } pickaxe = Pickaxe.configure environment, user, password, pickaxe.sync_all end |