Class: Gaffer::Repro
- Inherits:
-
Object
- Object
- Gaffer::Repro
- Defined in:
- lib/gaffer/repro.rb
Instance Method Summary collapse
- #create_dirs ⇒ Object
- #include(file) ⇒ Object
- #includedeb(file) ⇒ Object
- #init ⇒ Object
-
#initialize(root, options = {}) ⇒ Repro
constructor
A new instance of Repro.
- #packages ⇒ Object
- #pull ⇒ Object
- #push ⇒ Object
- #ready! ⇒ Object
- #rebuild ⇒ 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
32 33 34 35 36 37 38 |
# File 'lib/gaffer/repro.rb', line 32 def create_dirs repo_dir.create index_dir.create subdirs.each do |dir| repo_dir["#{dir}/"].create end end |
#include(file) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/gaffer/repro.rb', line 40 def include(file) f = Rush[File.(file)] bump_version raise "File already in index" if index_dir[f.name].exists? f.copy_to index_dir bucket_put "index/#{f.name}" includedeb f f.destroy puts "* #{f.name} -> index/#{f.name}" end |
#includedeb(file) ⇒ Object
59 60 61 |
# File 'lib/gaffer/repro.rb', line 59 def includedeb(file) repo_dir.bash "reprepro includedeb #{@codename} #{file}" end |
#init ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gaffer/repro.rb', line 17 def init unless root_dir.exists? raise "Dir #{root_dir} exists - cannot init" unless @force root_dir.destroy end create_dirs conf_dir["options"].write conf_dir["distributions"].write distributions write_version 1 end |
#packages ⇒ Object
28 29 30 |
# File 'lib/gaffer/repro.rb', line 28 def packages index_dir["*"].map { |s| s.name }.sort end |
#pull ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/gaffer/repro.rb', line 78 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 touch end |
#push ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/gaffer/repro.rb', line 67 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 touch puts " [apt source]" puts url puts "" end |
#ready! ⇒ Object
63 64 65 |
# File 'lib/gaffer/repro.rb', line 63 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 |
#rebuild ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/gaffer/repro.rb', line 51 def rebuild repo_dir["*"].reject { |dir| dir.name == "conf" }.each { |dir| dir.destroy } create_dirs index_dir["*"].each do |file| includedeb file end end |
#url ⇒ Object
87 88 89 |
# File 'lib/gaffer/repro.rb', line 87 def url "deb http://#{@bucket}.s3.amazonaws.com/ubuntu/ #{@codename} #{@components}" end |