bowline 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
data/bowline.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bowline}
8
- s.version = "0.5.1"
8
+ s.version = "0.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alex MacCaw"]
@@ -1,3 +1,2 @@
1
- require 'rake'
2
1
  require 'bowline/tasks/bowline'
3
2
  Rake::Task['app:build'].invoke
@@ -1,7 +1,6 @@
1
- unless Bowline::Library.downloaded?
2
- require 'rake'
1
+ unless Bowline::Library.ready?
3
2
  require 'bowline/tasks/bowline'
4
- Rake::Task['libs:download'].invoke
3
+ Rake::Task['libs:setup'].invoke
5
4
  end
6
5
 
7
6
  exec("#{Bowline::Library.desktop_path} #{APP_ROOT}")
@@ -50,7 +50,7 @@ module Bowline::Generators
50
50
  empty_directory :binders, "app/binders"
51
51
  empty_directory :helpers, "app/helpers"
52
52
  empty_directory :windows, "app/windows"
53
- file :mainwindow, "main_window.rb", "app/windows"
53
+ file :mainwindow, "main_window.rb", "app/windows/main_window.rb"
54
54
 
55
55
  empty_directory :config, "config"
56
56
  template :environment, "config/environment.rb", "config/environment.rb"
@@ -23,11 +23,17 @@ module Bowline
23
23
  end
24
24
  module_function :rubylib_path
25
25
 
26
- def downloaded?
26
+ def bowline_path
27
+ File.join(APP_ROOT, "vendor", "bowline")
28
+ end
29
+ module_function :bowline_path
30
+
31
+ def ready?
27
32
  File.exist?(desktop_path) &&
28
- File.directory?(rubylib_path)
33
+ File.directory?(rubylib_path) &&
34
+ File.directory?(bowline_path)
29
35
  end
30
- module_function :downloaded?
36
+ module_function :ready?
31
37
 
32
38
  private
33
39
  # Borrowed from Rubygems
@@ -5,8 +5,8 @@ require 'rbconfig'
5
5
  namespace :app do
6
6
  namespace :build do
7
7
  task :osx => :environment do
8
- unless Bowline::Library.downloaded?
9
- Rake::Task["libs:download"].invoke
8
+ unless Bowline::Library.ready?
9
+ Rake::Task["libs:setup"].invoke
10
10
  end
11
11
 
12
12
  config = Bowline.configuration
@@ -1,3 +1,6 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
1
4
  $VERBOSE = nil
2
5
 
3
6
  # Load Rails rakefile extensions
@@ -11,7 +11,7 @@ def download(url)
11
11
  req = Net::HTTP::Get.new(url.path)
12
12
  res = Net::HTTP.start(url.host, url.port) {|http|
13
13
  http.request(req) {|resp|
14
- pbar = ProgressBar.new(name, resp.content_length)
14
+ pbar = ProgressBar.new("Downloading...", resp.content_length)
15
15
  resp.read_body {|seg|
16
16
  pbar.inc(seg.length)
17
17
  file.write(seg)
@@ -23,35 +23,45 @@ def download(url)
23
23
  file
24
24
  end
25
25
 
26
+ def unzip(fpath, tpath)
27
+ Zip::ZipFile.open(fpath) { |zfile|
28
+ zfile.each {|file|
29
+ file_path = File.join(tpath, file.name)
30
+ FileUtils.mkdir_p(File.dirname(file_path))
31
+ zfile.extract(file, file_path)
32
+ }
33
+ }
34
+ end
35
+
26
36
  namespace :libs do
27
37
  # Lots of people are using Ruby 1.8 with Bowline.
28
38
  # When bowline-desktop loads, it doesn't know where the
29
39
  # Bowline gem is if it's an 1.8 gem dir. So, we just symlink
30
40
  # it to vendor/bowline. One caveat though, is that you have to
31
41
  # re-run this task when you update the gem.
32
- task :symlink_bowline => :environment do
33
- local_path = File.join(APP_ROOT, "vendor", "bowline")
42
+ task :unpack => :environment do
43
+ local_path = Bowline::Library.bowline_path
34
44
  unless File.directory?(local_path)
35
45
  begin
36
46
  FileUtils.ln_s(
37
47
  Bowline.lib_path,
38
- bowline_path
48
+ local_path
39
49
  )
40
- rescue NotImplemented
50
+ rescue NotImplementedError
41
51
  FileUtils.cp_r(
42
52
  Bowline.lib_path,
43
- bowline_path
53
+ local_path
44
54
  )
45
55
  end
46
56
  end
47
57
  end
48
58
 
49
59
  desc "Download Bowline's binary and pre-compiled libs"
50
- task :download => [:environment, :symlink_bowline] do
51
- puts "Downloading libraries. This may take a while..."
60
+ task :download => :environment do
52
61
  FileUtils.mkdir_p(Bowline::Library.path)
53
-
54
62
  desktop_path = Bowline::Library.desktop_path
63
+ rubylib_path = Bowline::Library.rubylib_path
64
+
55
65
  unless File.exist?(desktop_path)
56
66
  desktop_tmp = download(Bowline::Library::DESKTOP_URL)
57
67
  desktop_tmp.close
@@ -59,24 +69,20 @@ namespace :libs do
59
69
  FileUtils.chmod(0755, desktop_path)
60
70
  end
61
71
 
62
- unless File.directory?(Bowline::Library.rubylib_path)
72
+ unless File.directory?(rubylib_path)
63
73
  rubylib_tmp = download(Bowline::Library::RUBYLIB_URL)
64
74
  rubylib_tmp.close
65
75
  puts "Extracting..."
66
- Zip::ZipFile.open(rubylib_tmp.path) { |zfile|
67
- zfile.each {|file|
68
- file_path = File.join(Bowline::Library.path, file.name)
69
- FileUtils.mkdir_p(File.dirname(file_path))
70
- zfile.extract(file, file_path)
71
- }
72
- }
76
+ unzip(rubylib_tmp.path, Bowline::Library.path)
73
77
  end
74
- puts "Finished downloading"
75
78
  end
79
+
80
+ task :setup => [:environment, "gems:sync", "libs:unpack", "libs:download"]
76
81
 
77
82
  desc "Update Bowline's binary and pre-compiled libs"
78
83
  task :update => :environment do
79
84
  FileUtils.rm_rf(Bowline::Library.path)
80
- Rake::Task["libs:download"].invoke
85
+ FileUtils.rm_rf(Bowline::Library.bowline_path)
86
+ Rake::Task["libs:setup"].invoke
81
87
  end
82
88
  end
@@ -2,7 +2,7 @@ module Bowline
2
2
  module Version #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 5
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bowline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacCaw