td 0.10.49 → 0.10.50

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.
data/ChangeLog CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ == 2012-09-20 version 0.10.50
3
+
4
+ * Changed packaging method from Jeweler to Bundler
5
+ * Updated packaging scripts for Windows
6
+ * Updated packaging scripts for Mac OS X
7
+
8
+
2
9
  == 2012-09-19 version 0.10.49
3
10
 
4
11
  * query and job:show subcommands support -G, --vertical option
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
@@ -29,6 +29,22 @@ You need to authorize the account, before executing any other commands.
29
29
  > td database:create mydb # create a database
30
30
  > td table:create mydb www_access # create a table
31
31
 
32
+ = Packaging
33
+
34
+ == Mac OS X
35
+
36
+ $ gem install bundler
37
+ $ rake pkg:build
38
+
39
+ == Windows
40
+
41
+ First of all, install cygwin.
42
+ Then install gcc and ruby packages using cygwin installer.
43
+
44
+ $ gem install bundler
45
+ $ rake exe:build
46
+
47
+
32
48
  = Copyright
33
49
 
34
50
  Copyright:: Copyright (c) 2011 Treasure Data Inc.
@@ -0,0 +1,101 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ task :default => :build
5
+
6
+ # common methods for package build scripts
7
+ require 'fileutils'
8
+ require "erb"
9
+
10
+ def version
11
+ require project_root_path('lib/td/version')
12
+ TreasureData::VERSION
13
+ end
14
+
15
+ def project_root_path(path)
16
+ "#{PROJECT_ROOT}/#{path}"
17
+ end
18
+
19
+ PROJECT_ROOT = File.expand_path(File.dirname(__FILE__))
20
+ USE_GEMS = ["#{PROJECT_ROOT}/pkg/td-#{version}.gem"]
21
+
22
+ def install_use_gems(target_dir)
23
+ unless ENV['GEM_HOME'].to_s.empty?
24
+ puts "**"
25
+ puts "** WARNING"
26
+ puts "**"
27
+ puts "** GEM_HOME is already set. Created package may be broken."
28
+ puts "** RVM surely breaks the package. Use rbenv instead."
29
+ puts "**"
30
+ end
31
+ env = {
32
+ 'GEM_HOME' => target_dir,
33
+ 'GEM_PATH' => '',
34
+ }
35
+ USE_GEMS.each {|gem|
36
+ system env, "gem install '#{gem}' --no-rdoc --no-ri"
37
+ }
38
+ end
39
+
40
+ def resource_path(path)
41
+ project_root_path("dist/resources/#{path}")
42
+ end
43
+
44
+ def install_resource(resource_name, target_path, mode)
45
+ FileUtils.mkdir_p File.dirname(target_path)
46
+ FileUtils.cp resource_path(resource_name), target_path
47
+ File.chmod(mode, target_path)
48
+ end
49
+
50
+ def install_erb_resource(resource_name, target_path, mode, variables)
51
+ FileUtils.mkdir_p File.dirname(target_path)
52
+ erb_raw = File.read resource_path(resource_name)
53
+
54
+ ctx = Object.new
55
+ variables.each_pair {|k,v| ctx.define_singleton_method(k) { v } }
56
+ data = ERB.new(erb_raw).result(ctx.instance_eval("binding"))
57
+
58
+ File.open(target_path, "w") do |f|
59
+ f.write data
60
+ end
61
+ File.chmod(mode, target_path)
62
+ end
63
+
64
+ def mkchdir(dir, &block)
65
+ FileUtils.mkdir_p dir
66
+ Dir.chdir(dir) do |dir|
67
+ yield File.expand_path(dir)
68
+ end
69
+ end
70
+
71
+ def build_dir_path(type)
72
+ project_root_path("build/#{type}.build")
73
+ end
74
+
75
+ def create_build_dir(type, &block)
76
+ dir = build_dir_path(type)
77
+ FileUtils.rm_rf dir
78
+ FileUtils.mkdir_p dir
79
+ begin
80
+ mkchdir(dir, &block)
81
+ success = true
82
+ ensure
83
+ #FileUtils.rm_rf(dir) if success
84
+ end
85
+ end
86
+
87
+ def download_resource(url)
88
+ fname = File.basename(url).gsub(/\?.*$/,'')
89
+ path = project_root_path("build/cache/#{fname}")
90
+ if File.exists?(path) && Time.now - File.mtime(path) < 24*60*60
91
+ return path
92
+ end
93
+ FileUtils.mkdir_p File.dirname(path)
94
+ sh "curl '#{url}' -o '#{path}'"
95
+ path
96
+ end
97
+
98
+ Dir[File.expand_path("../dist/**/*.rake", __FILE__)].each do |rake|
99
+ import rake
100
+ end
101
+
@@ -0,0 +1,43 @@
1
+
2
+ desc "build Windows exe package"
3
+ task 'exe:build' => :build do
4
+ create_build_dir('exe') do |dir|
5
+ # create ./installers/
6
+ FileUtils.mkdir_p "installers"
7
+ installer_path = download_resource('http://heroku-toolbelt.s3.amazonaws.com/rubyinstaller.exe')
8
+ FileUtils.cp installer_path, "installers/rubyinstaller.exe"
9
+
10
+ variables = {
11
+ :version => version,
12
+ :basename => "td-#{version}",
13
+ :outdir => ".",
14
+ }
15
+
16
+ # create ./td/
17
+ mkchdir("td") do
18
+ mkchdir('gems') do
19
+ install_use_gems(Dir.pwd)
20
+ end
21
+ install_resource 'exe/td', 'bin/td', 0755
22
+ install_resource 'exe/td.bat', 'bin/td.bat', 0755
23
+ install_resource 'exe/td-cmd.bat', 'td-cmd.bat', 0755
24
+ end
25
+
26
+ # create td.iss and run Inno Setup
27
+ install_erb_resource 'exe/td.iss', 'td.iss', 0644, variables
28
+
29
+ inno_dir = ENV["INNO_DIR"] || 'C:/Program Files (x86)/Inno Setup 5'
30
+ inno_bin = ENV["INNO_BIN"] || "#{inno_dir}/Compil32.exe"
31
+ puts "INNO_BIN: #{inno_bin}"
32
+
33
+ sh "\"#{inno_bin}\" /cc \"td.iss\""
34
+ FileUtils.cp "td-#{version}.exe", project_root_path("pkg/td-#{version}.exe")
35
+ end
36
+ end
37
+
38
+ desc "clean Windows exe package"
39
+ task "exe:clean" do
40
+ FileUtils.rm_rf build_dir_path('exe')
41
+ FileUtils.rm_rf project_root_path("exe/td-#{version}.exe")
42
+ end
43
+
@@ -0,0 +1,48 @@
1
+
2
+ desc "build Mac OS X pkg package"
3
+ task 'pkg:build' => :build do
4
+ create_build_dir('pkg') do |dir|
5
+ FileUtils.mkdir_p "bundle"
6
+ FileUtils.mkdir_p "bundle/Resources"
7
+ FileUtils.mkdir_p "bundle/td-client.pkg"
8
+ FileUtils.mkdir_p "bundle/td-client.pkg"
9
+
10
+ # create ./bundle/td-client.pkg/Payload
11
+ mkchdir('td-client.build') do
12
+ mkchdir('gems') do
13
+ install_use_gems(Dir.pwd)
14
+ end
15
+ install_resource 'pkg/td', 'bin/td', 0755
16
+ sh "pax -wz -x cpio . > ../bundle/td-client.pkg/Payload"
17
+ end
18
+
19
+ # crete ./bundle/td-client.pkg/Bom
20
+ sh "mkbom -s td-client.build bundle/td-client.pkg/Bom"
21
+
22
+ # crete ./bundle/td-client.pkg/Scripts/
23
+ install_resource 'pkg/postinstall', 'bundle/td-client.pkg/Scripts/postinstall', 0755
24
+
25
+ variables = {
26
+ :version => version,
27
+ :kbytes => `du -ks td-client.build | cut -f 1`.strip.to_i,
28
+ :num_files => `find td-client.build | wc -l`,
29
+ }
30
+
31
+ # create ./bundle/td-client.pkg/PackageInfo
32
+ install_erb_resource('pkg/PackageInfo.erb', 'bundle/td-client.pkg/PackageInfo', 0644, variables)
33
+
34
+ # create ./bundle/Distribution
35
+ install_erb_resource('pkg/Distribution.erb', 'bundle/Distribution', 0644, variables)
36
+
37
+ # create td-a.b.c.pkg
38
+ sh "pkgutil --flatten bundle td-#{version}.pkg"
39
+ FileUtils.cp "td-#{version}.pkg", project_root_path("pkg/td-#{version}.pkg")
40
+ end
41
+ end
42
+
43
+ desc "clean Mac OS X pkg package"
44
+ task "pkg:clean" do
45
+ FileUtils.rm_rf build_dir_path('pkg')
46
+ FileUtils.rm_rf project_root_path("pkg/td-#{version}.pkg")
47
+ end
48
+
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ # avoid conflicts with rvm
5
+ ENV.delete 'GEM_HOME'
6
+ ENV.delete 'GEM_PATH'
7
+
8
+ # attempt to load rubygems
9
+ begin
10
+ require "rubygems"
11
+ rescue LoadError
12
+ end
13
+
14
+ # resolve bin path, ignoring symlinks
15
+ require "pathname"
16
+ here = File.dirname(Pathname.new(__FILE__).realpath)
17
+
18
+ # add locally installed gems to libpath
19
+ gem_dir = File.expand_path("../gems", here)
20
+ Dir["#{gem_dir}/**/lib"].each do |libdir|
21
+ $:.unshift libdir
22
+ end
23
+
24
+ # start up the CLI
25
+ require 'td/command/runner'
26
+ TreasureData::Command::Runner.new.run ARGV
@@ -0,0 +1 @@
1
+ @cmd /k td
@@ -0,0 +1,29 @@
1
+ @ECHO OFF
2
+
3
+ :: determine if this is x86 or x64
4
+ if "%processor_architecture%" == "IA64" goto x64
5
+ if "%processor_architecture%" == "AMD64" goto x64
6
+ if "%ProgramFiles%" == "%ProgramW6432%" goto x64
7
+ goto x86
8
+
9
+ :x86
10
+ set TDRubyPath=%ProgramFiles%\ruby-1.9.3
11
+ goto launch
12
+
13
+ :x64
14
+ set TDRubyPath=%ProgramFiles(x86)%\ruby-1.9.3
15
+ goto launch
16
+
17
+ :launch
18
+
19
+ :: determine if this is an NT operating system
20
+ if not "%~f0" == "~f0" goto WinNT
21
+ goto Win9x
22
+
23
+ :Win9x
24
+ @"%TDRubyPath%\bin\ruby.exe" "td" %1 %2 %3 %4 %5 %6 %7 %8 %9
25
+ goto :EOF
26
+
27
+ :WinNT
28
+ @"%TDRubyPath%\bin\ruby.exe" "%~dpn0" %*
29
+ goto :EOF
@@ -0,0 +1,73 @@
1
+ [Setup]
2
+ AppName=Treasure Data
3
+ AppVersion=<%= version %>
4
+ DefaultDirName={pf}\Treasure Data
5
+ DefaultGroupName=Treasure Data
6
+ Compression=lzma2
7
+ SolidCompression=yes
8
+ OutputBaseFilename=<%= basename %>
9
+ OutputDir=<%= outdir %>
10
+ ChangesEnvironment=yes
11
+ UsePreviousSetupType=no
12
+ AlwaysShowComponentsList=no
13
+
14
+ ; For Ruby expansion ~ 32MB (installed) - 12MB (installer)
15
+ ExtraDiskSpaceRequired=20971520
16
+
17
+ [Types]
18
+ Name: client; Description: "Full Installation";
19
+ Name: custom; Description: "Custom Installation"; flags: iscustom
20
+
21
+ [Components]
22
+ Name: "toolbelt"; Description: "Treasure Data Toolbelt"; Types: "client custom"
23
+ Name: "toolbelt/client"; Description: "Treasure Data Client"; Types: "client custom"; Flags: fixed
24
+ <%#Name: "toolbelt/foreman"; Description: "Foreman"; Types: "client custom"%>
25
+
26
+ [Files]
27
+ Source: "td\*.*"; DestDir: "{app}"; Flags: recursesubdirs; Components: "toolbelt/client"
28
+ Source: "installers\rubyinstaller.exe"; DestDir: "{tmp}"; Components: "toolbelt/client"
29
+
30
+ [Icons]
31
+ Name: "{group}\Treasure Data command prompt"; Filename: "{app}\td-cmd.bat"
32
+
33
+ [Registry]
34
+ Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: "expandsz"; ValueName: "TreasureDataPath"; \
35
+ ValueData: "{app}"
36
+ Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: "expandsz"; ValueName: "Path"; \
37
+ ValueData: "{olddata};{app}\bin"; Check: NeedsAddPath(ExpandConstant('{app}\bin'))
38
+ Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: "expandsz"; ValueName: "Path"; \
39
+ ValueData: "{olddata};{pf}\ruby-1.9.3\bin"; Check: NeedsAddPath(ExpandConstant('{pf}\ruby-1.9.3\bin'))
40
+ Root: HKCU; Subkey: "Environment"; ValueType: "expandsz"; ValueName: "HOME"; \
41
+ ValueData: "%USERPROFILE%"; Flags: createvalueifdoesntexist
42
+
43
+ [Run]
44
+ Filename: "{tmp}\rubyinstaller.exe"; Parameters: "/verysilent /noreboot /nocancel /noicons /dir=""{pf}/ruby-1.9.3"""; \
45
+ Flags: shellexec waituntilterminated; StatusMsg: "Installing Ruby"; Components: "toolbelt/client"
46
+ <%#Filename: "{pf}\ruby-1.9.3\bin\gem.bat"; Parameters: "install foreman --no-rdoc --no-ri"; %>
47
+ <%# Flags: runhidden shellexec waituntilterminated; StatusMsg: "Installing Foreman"; Components: "toolbelt/foreman"%>
48
+ Filename: "{app}\td-cmd.bat"; Description: "Run command prompt"; Flags: postinstall
49
+
50
+ [Code]
51
+
52
+ function NeedsAddPath(Param: string): boolean;
53
+ var
54
+ OrigPath: string;
55
+ begin
56
+ if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
57
+ 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
58
+ 'Path', OrigPath)
59
+ then begin
60
+ Result := True;
61
+ exit;
62
+ end;
63
+ // look for the path with leading and trailing semicolon
64
+ // Pos() returns 0 if not found
65
+ Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
66
+ end;
67
+
68
+ function IsProgramInstalled(Name: string): boolean;
69
+ var
70
+ ResultCode: integer;
71
+ begin
72
+ Result := Exec(Name, 'version', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
73
+ end;
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <installer-script minSpecVersion="1.000000" authoringTool="org.ruby-lang.rake" authoringToolVersion="0.8.7">
3
+ <title>TreasureData Client</title>
4
+ <options customize="allow" allow-external-scripts="no"/>
5
+ <domains enable_localSystem="true"/>
6
+ <choices-outline>
7
+ <line choice="td-client"/>
8
+ </choices-outline>
9
+ <choice id="td-client" title="TreasureData Client">
10
+ <pkg-ref id="com.td.client"/>
11
+ </choice>
12
+ <pkg-ref id="com.td.client" installKBytes="<%= kbytes %>" version="<%= version %>" auth="Root">#td-client.pkg</pkg-ref>
13
+ </installer-script>
@@ -0,0 +1,6 @@
1
+ <pkg-info format-version="2" identifier="com.td.toolbelt" version="<%= version %>" install-location="/usr/local/td" auth="root">
2
+ <payload installKBytes="<%= kbytes %>" numberOfFiles="<%= num_files %>"/>
3
+ <scripts>
4
+ <postinstall file="./postinstall"/>
5
+ </scripts>
6
+ </pkg-info>
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ ln -sf /usr/local/td/bin/td /usr/bin/td
3
+ osascript -e '
4
+ tell application "Terminal"
5
+ activate
6
+ do script "td"
7
+ end tell'
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ # avoid conflicts with rvm
5
+ ENV.delete 'GEM_HOME'
6
+ ENV.delete 'GEM_PATH'
7
+
8
+ # attempt to load rubygems
9
+ begin
10
+ require "rubygems"
11
+ rescue LoadError
12
+ end
13
+
14
+ # resolve bin path, ignoring symlinks
15
+ require "pathname"
16
+ here = File.dirname(Pathname.new(__FILE__).realpath)
17
+
18
+ # add locally installed gems to libpath
19
+ gem_dir = File.expand_path("../gems", here)
20
+ Dir["#{gem_dir}/**/lib"].each do |libdir|
21
+ $:.unshift libdir
22
+ end
23
+
24
+ # start up the CLI
25
+ require "td/command/runner"
26
+ TreasureData::Command::Runner.new.run ARGV
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
 
3
- VERSION = '0.10.49'
3
+ VERSION = '0.10.50'
4
4
 
5
5
  end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'td/version'
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "td"
7
+ gem.description = "CLI to manage data on Treasure Data, the Hadoop-based cloud data warehousing"
8
+ gem.homepage = "http://treasure-data.com/"
9
+ gem.summary = "CLI to manage data on Treasure Data, the Hadoop-based cloud data warehousing"
10
+ gem.version = TreasureData::VERSION
11
+ gem.authors = ["Treasure Data, Inc."]
12
+ gem.email = "support@treasure-data.com"
13
+ gem.has_rdoc = false
14
+ gem.files = `git ls-files`.split("\n")
15
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ gem.require_paths = ['lib']
18
+
19
+ gem.add_dependency "msgpack", "~> 0.4.4"
20
+ gem.add_dependency "json", ">= 1.4.3"
21
+ gem.add_dependency "hirb", ">= 0.4.5"
22
+ gem.add_dependency "td-client", "~> 0.8.29"
23
+ gem.add_dependency "td-logger", "~> 0.3.12"
24
+ gem.add_development_dependency "rake", "~> 0.9"
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.49
4
+ version: 0.10.50
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-20 00:00:00.000000000 Z
12
+ date: 2012-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack
@@ -107,33 +107,30 @@ dependencies:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0.9'
110
- - !ruby/object:Gem::Dependency
111
- name: jeweler
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ~>
116
- - !ruby/object:Gem::Version
117
- version: '1.8'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ~>
124
- - !ruby/object:Gem::Version
125
- version: '1.8'
126
110
  description: CLI to manage data on Treasure Data, the Hadoop-based cloud data warehousing
127
111
  email: support@treasure-data.com
128
112
  executables:
129
113
  - td
130
114
  extensions: []
131
- extra_rdoc_files:
115
+ extra_rdoc_files: []
116
+ files:
132
117
  - ChangeLog
118
+ - Gemfile
133
119
  - README.rdoc
134
- files:
120
+ - Rakefile
121
+ - bin/td
135
122
  - data/sample_apache.json
136
123
  - data/sample_apache_gen.rb
124
+ - dist/exe.rake
125
+ - dist/pkg.rake
126
+ - dist/resources/exe/td
127
+ - dist/resources/exe/td-cmd.bat
128
+ - dist/resources/exe/td.bat
129
+ - dist/resources/exe/td.iss
130
+ - dist/resources/pkg/Distribution.erb
131
+ - dist/resources/pkg/PackageInfo.erb
132
+ - dist/resources/pkg/postinstall
133
+ - dist/resources/pkg/td
137
134
  - lib/td.rb
138
135
  - lib/td/command/account.rb
139
136
  - lib/td/command/acl.rb
@@ -166,9 +163,7 @@ files:
166
163
  - lib/td/distribution.rb
167
164
  - lib/td/file_reader.rb
168
165
  - lib/td/version.rb
169
- - ChangeLog
170
- - README.rdoc
171
- - bin/td
166
+ - td.gemspec
172
167
  homepage: http://treasure-data.com/
173
168
  licenses: []
174
169
  post_install_message:
@@ -194,3 +189,4 @@ signing_key:
194
189
  specification_version: 3
195
190
  summary: CLI to manage data on Treasure Data, the Hadoop-based cloud data warehousing
196
191
  test_files: []
192
+ has_rdoc: false