summaryrefslogtreecommitdiff
path: root/lib/leap/platform.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-07-01 14:49:27 -0700
committerelijah <elijah@riseup.net>2016-07-01 14:49:27 -0700
commit174dbf380fe1b0962a9e173caa6dd0a0f76a14e1 (patch)
treed2f1414652d2c0fbd1003347c2abf2be1ffff473 /lib/leap/platform.rb
parent2d277c7d2aa3ddfbe3c2c65f68d7290930934b70 (diff)
parentf9284ff22da6eec685782dbc9aa4a4ded0efec29 (diff)
Merge branch 'feature/newcli' into develop
Diffstat (limited to 'lib/leap/platform.rb')
-rw-r--r--lib/leap/platform.rb90
1 files changed, 0 insertions, 90 deletions
diff --git a/lib/leap/platform.rb b/lib/leap/platform.rb
deleted file mode 100644
index 9112ef3..0000000
--- a/lib/leap/platform.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-module Leap
-
- class Platform
- class << self
- #
- # configuration
- #
-
- attr_reader :version
- attr_reader :compatible_cli
- attr_accessor :facts
- attr_accessor :paths
- attr_accessor :node_files
- attr_accessor :monitor_username
- attr_accessor :reserved_usernames
-
- attr_accessor :hiera_dir
- attr_accessor :hiera_path
- attr_accessor :files_dir
- attr_accessor :leap_dir
- attr_accessor :init_path
-
- attr_accessor :default_puppet_tags
-
- def define(&block)
- # some defaults:
- @reserved_usernames = []
- @hiera_dir = '/etc/leap'
- @hiera_path = '/etc/leap/hiera.yaml'
- @leap_dir = '/srv/leap'
- @files_dir = '/srv/leap/files'
- @init_path = '/srv/leap/initialized'
- @default_puppet_tags = []
-
- self.instance_eval(&block)
-
- @version ||= Gem::Version.new("0.0")
- end
-
- def version=(version)
- @version = Gem::Version.new(version)
- end
-
- def compatible_cli=(range)
- @compatible_cli = range
- @minimum_cli_version = Gem::Version.new(range.first)
- @maximum_cli_version = Gem::Version.new(range.last)
- end
-
- #
- # return true if the cli_version is compatible with this platform.
- #
- def compatible_with_cli?(cli_version)
- cli_version = Gem::Version.new(cli_version)
- cli_version >= @minimum_cli_version && cli_version <= @maximum_cli_version
- end
-
- #
- # return true if the platform version is within the specified range.
- #
- def version_in_range?(range)
- if range.is_a? String
- range = range.split('..')
- end
- minimum_platform_version = Gem::Version.new(range.first)
- maximum_platform_version = Gem::Version.new(range.last)
- @version >= minimum_platform_version && @version <= maximum_platform_version
- end
-
- def major_version
- if @version.segments.first == 0
- @version.segments[0..1].join('.')
- else
- @version.segments.first
- end
- end
-
- def method_missing(method, *args)
- puts
- puts "WARNING:"
- puts " leap_cli is out of date and does not understand `#{method}`."
- puts " called from: #{caller.first}"
- puts " please upgrade to a newer leap_cli"
- end
-
- end
-
- end
-
-end \ No newline at end of file