Class: Gaffer::Repro
- Inherits:
-
Object
- Object
- Gaffer::Repro
- Defined in:
- lib/gaffer/repro.rb
Instance Method Summary collapse
- #create_dirs ⇒ Object
- #include(file) ⇒ Object
- #init ⇒ Object
-
#initialize(root, options = {}) ⇒ Repro
constructor
A new instance of Repro.
- #pull ⇒ Object
- #push ⇒ Object
- #ready! ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(root, options = {}) ⇒ Repro
Returns a new instance of Repro.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/gaffer/repro.rb', line 4 def initialize(root, = {}) @root = root @maintainer = [:maintainer] @email = [:email] @key = [:key] @force = [:force] @codename = [:codename] @components = [:components] @bucket = [:bucket] @aws_key = [:aws_key] @aws_secret = [:aws_secret] end |
Instance Method Details
#create_dirs ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/gaffer/repro.rb', line 28 def create_dirs repo_dirs.each do |dir| if not File.exists?("#{@root}/ubuntu/#{dir}") puts "* mkdir -p #{@root}/ubuntu/#{dir}" FileUtils.mkdir_p "#{@root}/ubuntu/#{dir}" end end end |
#include(file) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/gaffer/repro.rb', line 37 def include(file) bump_version file = File.(file) Dir.chdir("#{@root}/ubuntu") do run "reprepro includedeb #{@codename} #{file}" end end |
#init ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gaffer/repro.rb', line 17 def init if not Dir[@root].empty? raise "Dir #{@root} not empty - cannot init" unless @force FileUtils.rm_rf @root end create_dirs write_file "ubuntu/conf/options", write_file "ubuntu/conf/distributions", distributes write_version 1 end |
#pull ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/gaffer/repro.rb', line 59 def pull raise "Local version #{local_version} is higher than local #{remote_version}. Use --force to override" if (remote_version < local_version && !@force) create_dirs puts "Version: #{remote_version}" delete_local write_local end |
#push ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/gaffer/repro.rb', line 49 def push raise "Remote version #{remote_version} is higher than local #{local_version}. Use --force to override" if (remote_version > local_version && !@force) puts "Version: #{local_version}" delete_remote write_remote puts " [apt source]" puts url puts "" end |
#ready! ⇒ Object
45 46 47 |
# File 'lib/gaffer/repro.rb', line 45 def ready! raise "No repo. Use 'gaffer pull' to download a repo from S3 or 'gaffer initrepo' to make a new one" unless File.include? "#{@root}/ubuntu/conf/distributions" end |
#url ⇒ Object
67 68 69 |
# File 'lib/gaffer/repro.rb', line 67 def url "deb http://#{@bucket}.s3.amazonaws.com/ubuntu/ #{@codename} #{@components}" end |