tsukuru 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/README.md +8 -9
  2. data/Rakefile +3 -0
  3. data/VERSION +1 -1
  4. data/bin/tsukuru +14 -19
  5. metadata +39 -4
data/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  Tsukuru will fetch your latest bundle and prepare it for running locally. It keeps an archive of downloaded bundles. You can also use restore from a local bundle (archived or manually downloaded).
2
2
 
3
- Usage: reanimate
4
- -a, --app NAME Application name
5
- -c, --capture Capture a new bundle instead of using the latest one
6
- -p, --password Yuur Heroku password
7
- -h, --help Display this message
8
- -l, --local FILE Use a local bundle instead of downloading
9
- -t, --target PATH Path to where the application should be restored
10
- -r, --reindex Start search deamon and reindex (sunspot + solr only)
11
- -u, --username Your Heroku username
3
+ Usage: tsukuru
4
+ -a, --app NAME Application name
5
+ -c, --capture Capture a new bundle instead of using the latest one
6
+ -h, --help Display this message
7
+ -l, --local FILE Use a local bundle instead of downloading
8
+ -t, --target PATH Path to where the application should be restored
9
+ -r, --reindex Start search deamon and reindex (sunspot + solr only)
10
+
data/Rakefile CHANGED
@@ -7,6 +7,9 @@ begin
7
7
  gemspec.email = "tel@jklm.no"
8
8
  gemspec.homepage = "http://github.com/toreriklinnerud/tsukuru"
9
9
  gemspec.authors = ["Tor Erik Linnerud"]
10
+ gemspec.add_dependency 'ruby-unix-now'
11
+ gemspec.add_dependency 'rest-client'
12
+ gemspec.add_dependency 'heroku'
10
13
 
11
14
  end
12
15
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/bin/tsukuru CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ #encoding: utf-8
2
3
 
3
4
  require 'heroku'
4
5
  require 'restclient'
@@ -24,10 +25,6 @@ parser = OptionParser.new do|opts|
24
25
  options.capture = true
25
26
  end
26
27
 
27
- opts.on( '-p', '--password', 'Yuur Heroku password' ) do |password|
28
- options.password = password
29
- end
30
-
31
28
  opts.on('-h', '--help', 'Display this message') do
32
29
  puts opts
33
30
  exit
@@ -44,11 +41,6 @@ parser = OptionParser.new do|opts|
44
41
  opts.on( '-r', '--reindex', 'Start search deamon and reindex (sunspot + solr only)' ) do
45
42
  options.reindex = true
46
43
  end
47
-
48
- opts.on( '-u', '--username', 'Your Heroku username' ) do |password|
49
- options.password = password
50
- end
51
-
52
44
  end.parse!
53
45
 
54
46
  def error(msg)
@@ -63,10 +55,13 @@ options.current = options.target + 'current'
63
55
  @options = options
64
56
 
65
57
  if !options.local
66
- error('You must provide your heroku username') unless options.username
67
- error('You must provide your heroku password') unless options.password
58
+ credentials_file = File.expand_path("~/.heroku/credentials")
59
+ unless File.exist?(credentials_file)
60
+ error("Run 'heroku info --app #{options.app}' once to set up your Heroku credentials")
61
+ end
62
+ credentials = File.read(credentials_file).split("\n")
68
63
 
69
- heroku = Heroku::Client.new(*CREDENTIALS)
64
+ heroku = Heroku::Client.new(*credentials)
70
65
  if options.capture
71
66
  heroku.bundle_capture(options.app)
72
67
  puts 'Starting capture'
@@ -113,9 +108,15 @@ FileUtils.mkdir_p(tempdir)
113
108
  compression_type = (bundle_file =~ /.gz$/) ? :z : :j
114
109
  run :tar, :x, compression_type, :C => tempdir, :f => bundle_file
115
110
 
116
- extracted_folder = Dir.glob("#{tempdir}/*").first
111
+ extracted_folder = Pathname.new(Dir.glob("#{tempdir}/*").first)
117
112
  error("Extraction of #{tempdir} failed") unless extracted_folder
118
113
 
114
+ if !options.local
115
+ archive = options.target + 'archive'
116
+ FileUtils.mkdir_p(archive)
117
+ run 'tar', '-cj', {:f => "#{archive}/#{bundle[:name]}.tar.bz2", :C => extracted_folder.dirname}, extracted_folder.basename
118
+ end
119
+
119
120
  FileUtils.mkdir_p(options.target)
120
121
  FileUtils.rm_rf(options.current)
121
122
  FileUtils.mv(extracted_folder, options.current)
@@ -145,10 +146,4 @@ end
145
146
  in_app 'mkdir -p tmp'
146
147
  in_app 'touch', 'tmp/restart'
147
148
 
148
- if !options.local
149
- archive = options.target + 'archive'
150
- FileUtils.mkdir_p(archive)
151
- run 'tar', '-cjf', "#{archive}.tar.bz2", extracted_folder
152
- end
153
-
154
149
  FileUtils.rm_rf(tempdir)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tor Erik Linnerud
@@ -16,8 +16,43 @@ cert_chain: []
16
16
 
17
17
  date: 2010-04-28 00:00:00 +01:00
18
18
  default_executable: tsukuru
19
- dependencies: []
20
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: ruby-unix-now
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: rest-client
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ name: heroku
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ type: :runtime
55
+ version_requirements: *id003
21
56
  description: Tsukuru will fetch your latest bundle and prepare it for running locally. It keeps an archive of downloaded bundles.
22
57
  email: tel@jklm.no
23
58
  executables: