tartlet 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ce665847ebe3cd35e93082033fb1367e0a44d5b5
4
+ data.tar.gz: 562bbab7333270c377d5a89f1ddab78681544b7d
5
+ SHA512:
6
+ metadata.gz: 4cbda51b351f997b7dcbdaeb0016655e1876a80830106cea7f96cdd5ad0d6c27acc8ff24dfdb7dadd092206b2ef1f10a05492a40f84a3ac0d9ed822f4fc734eb
7
+ data.tar.gz: e9d9fd713f503b0f8fdeb9e8eec1d76b6d594325890177c44741296552ba9580848506d82eca5b415a4399fc703a9248d5cb425c76ea5ddf5a8e8b1f221c64b5
data/README.md CHANGED
@@ -43,9 +43,6 @@ gzipped tarball `archive.tar.gz`
43
43
 
44
44
  $ tartlet compress foo bar baz
45
45
 
46
- ***TODO***: do a clobbering check before making the tarball to ensure file
47
- safety
48
-
49
46
  * `extract` - takes a single zipped tarball and extracts it into the current
50
47
  directory
51
48
 
@@ -53,12 +50,6 @@ directory
53
50
 
54
51
  $ tartlet extract archive.tar.gz
55
52
 
56
- ***TODO***: take a list of tarballs and extract them each into their own
57
- folder
58
-
59
- ***TODO***: do a clobbering check before extracting the tarball to ensure
60
- file safety
61
-
62
53
  ### Options
63
54
 
64
55
  Options can be placed anywhere in the command, eg. `tartlet -d compress -o
@@ -112,3 +103,22 @@ stdout the tar command that would be produced by tartlet
112
103
  3. Commit your changes (`git commit -am 'Added some feature'`)
113
104
  4. Push to the branch (`git push origin my-new-feature`)
114
105
  5. Create new Pull Request
106
+
107
+ ## TODO Features:
108
+
109
+ * Clobber Checks:
110
+
111
+ * **compress** - Make sure that the target archive doesn't already exist
112
+ before creating the file.
113
+
114
+ * **extract** - Make sure that the files in the tarball don't already exist
115
+ in the output directory.
116
+
117
+ * Multiple Extract:
118
+
119
+ Allow a list of files to extract, and extract all of them into separate
120
+ directories
121
+
122
+ * RDoc Comments:
123
+
124
+ Comments. Comments everywhere.
@@ -9,7 +9,7 @@ class App
9
9
  include Methadone::CLILogging
10
10
  include Methadone::SH
11
11
 
12
- COMMANDS = %w(compress extract)
12
+ COMMANDS = %w(compress extract list)
13
13
 
14
14
  main do |command, *files| # Add args you want: |like,so|
15
15
 
@@ -24,10 +24,10 @@ class App
24
24
  outfile = options['output'].nil? ? Tartlet::OUTFILE : options['output']
25
25
 
26
26
  # Get the tar command
27
- cmd = Tartlet::compressSingle(files,!options['tarball'],outfile)
27
+ cmd = Tartlet::compressSingle(files, !options['tarball'], outfile)
28
28
 
29
29
  # Either output or run the command
30
- if options['dry'] then puts cmd else sh cmd end
30
+ if options['dry'] then puts cmd else sh(cmd) {|o,e| puts o; puts e} end
31
31
 
32
32
  ## Extract the tarballs into their respective folders
33
33
  when "extract"
@@ -44,12 +44,25 @@ class App
44
44
  target = options['output'].nil? ? Tartlet::TARGET : options['output']
45
45
 
46
46
  # Get the tar command
47
- cmd = Tartlet::extractSingle(files[0],!options['tarball'],target)
47
+ cmd = Tartlet::extractSingle(files[0], !options['tarball'], target)
48
48
 
49
49
  # Either output or run the command
50
- if options['dry'] then puts cmd else sh cmd end
50
+ if options['dry'] then puts cmd else sh(cmd) {|o,e| puts o; puts e} end
51
51
 
52
52
  end
53
+
54
+ ## List files in tarball
55
+ when "list"
56
+
57
+ if files.length > 1
58
+ help_now!("One file at a time, bub!")
59
+ else
60
+ # Get the tar command
61
+ cmd = Tartlet::listSingle(files[0], !options['tarball'])
62
+
63
+ # Either output or run the command
64
+ if options['dry'] then puts cmd else sh(cmd) {|o,e| puts o; puts e} end
65
+ end
53
66
  else
54
67
  help_now!("#{command} is not a valid command. Must be one of {#{COMMANDS.join(",")}}")
55
68
  end
@@ -34,4 +34,8 @@ module Tartlet
34
34
  return command
35
35
  end
36
36
 
37
+ def Tartlet.listSingle(file, zip = true)
38
+ return "tar -#{zip ? 'z' : ''}tvf #{file}"
39
+ end
40
+
37
41
  end
@@ -1,3 +1,3 @@
1
1
  module Tartlet
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -4,101 +4,7 @@ require File.expand_path('../lib/tartlet/version', __FILE__)
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Jake M"]
6
6
  gem.email = ["jakemaskiewicz@gmail.com"]
7
- gem.description = %q{
8
- ## Description
9
-
10
- Tar horror stories. Everyone has one. You used the wrong flags and accidentally
11
- overwrote one of your source files without a backup. Or you extracted a tarball
12
- over your current directory and deleted half the updates to your project. You
13
- spent 30 minutes scouring Google for the right set of flags to extract a zipped
14
- tarball instead of an unzipped one. Why are there so many flags!?!
15
-
16
- Enter Tartlet. Tartlet is a small commandline wrapper around tar that handles
17
- the obnoxious flags for you. Need to extract an archive?
18
-
19
- tartlet extract thinmints.tar.gz
20
-
21
- Mmmmmmm. Delicious extracted cookies. Need to compress a set of files?
22
-
23
- tartlet compress butter sugar flour --output cookie
24
-
25
- Mmmmmmmmm. Chocolaty compressed cookies. Tartlet makes it easy to make archives
26
- (and apparently I'm craving cookies- please hold).
27
-
28
- ## Installation
29
-
30
-
31
- Install via gem as:
32
-
33
- $ gem install tart
34
-
35
- ## Usage
36
-
37
- Tartlet takes a command and then a list of files, with optional flags thrown
38
- anywhere.
39
-
40
- ### Commands
41
-
42
- * `compress` - takes a list of files, and by default compresses them into
43
- gzipped tarball `archive.tar.gz`
44
-
45
- ex:
46
-
47
- $ tartlet compress foo bar baz
48
-
49
- * `extract` - takes a single zipped tarball and extracts it into the current
50
- directory
51
-
52
- ex:
53
-
54
- $ tartlet extract archive.tar.gz
55
-
56
- ### Options
57
-
58
- Options can be placed anywhere in the command, eg. `tartlet -d compress -o
59
- target file1 file2` is the same as `tartlet compress file1 file2 -d -o target`
60
- which is the same as `tartlet compress -d file1 -o target file2`. I prefer to
61
- put -d before the command, -t after the command but before the files, and -o at
62
- the very end, but put them in whatever order makes sense to you.
63
-
64
- * `-o VALUE`, `--output VALUE` - instead of using the default output
65
- (archive.tar.gz or the current directory), direct output to **VALUE**. For
66
- compression archive name, tartlet will automatically append the proper file
67
- suffix (.tar or .tar.gz) if it is not already provided.
68
-
69
- ex:
70
-
71
- # extract contents of archive into folder 'dirname'
72
- $ tartlet extract archive.tar.gz -o dirname
73
-
74
- # compress list of files into tarball 'files.tar.gz'
75
- $ tartlet compress foo bar baz -o files.tar.gz
76
- -- or --
77
- $ tartlet compress foo bar baz -o files
78
-
79
- * `--tarball`, `-tar`, or `-t` - treat tarball as not-gzipped, e.g.
80
- `archive.tar` (vs the default assumption of a gzipped tarball, eg
81
- `archive.tar.gz`)
82
-
83
- ex:
84
-
85
- # extract contents of archive into current directory
86
- $ tartlet extract --tarball archive.tar
87
-
88
- # compress files into non-zipped tarball
89
- $ tartlet compress --tarball foo bar baz
90
-
91
- * `--dry-run`, `--dry`, `-d` - don't execute any commands, simply print to
92
- stdout the tar command that would be produced by tartlet
93
-
94
- ex:
95
-
96
- $ tartlet --dry compress foo bar baz --tarball -o files
97
- tar -cf files.tar foo bar baz
98
-
99
- $ tartlet extract --dry-run lotsoffiles.tar.gz -o safefolder
100
- tar -xzf lotsoffiles.tar.gz -C safefolder
101
- }
7
+ gem.description = %q{Tartlet is a command line utility that can be called with a single command (compress or extract) and a list of files to run tar without the headache.}
102
8
  gem.summary = %q{A wrapper for tar that provides sensible defaults}
103
9
  gem.homepage = "https://github.com/jakemask/tartlet"
104
10
 
metadata CHANGED
@@ -1,52 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tartlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jake M
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-12 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rdoc
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: aruba
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: methadone
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,48 +62,12 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
77
68
  version: 1.2.6
78
- description: ! "\n## Description\n\nTar horror stories. Everyone has one. You used
79
- the wrong flags and accidentally\noverwrote one of your source files without a backup.
80
- Or you extracted a tarball\nover your current directory and deleted half the updates
81
- to your project. You\nspent 30 minutes scouring Google for the right set of flags
82
- to extract a zipped\ntarball instead of an unzipped one. Why are there so many flags!?!\n\nEnter
83
- Tartlet. Tartlet is a small commandline wrapper around tar that handles\nthe obnoxious
84
- flags for you. Need to extract an archive?\n\n tartlet extract thinmints.tar.gz\n\nMmmmmmm.
85
- Delicious extracted cookies. Need to compress a set of files?\n\n tartlet compress
86
- butter sugar flour --output cookie\n\nMmmmmmmmm. Chocolaty compressed cookies. Tartlet
87
- makes it easy to make archives\n(and apparently I'm craving cookies- please hold).\n\n##
88
- Installation\n\n\nInstall via gem as:\n\n $ gem install tart\n\n## Usage\n\nTartlet
89
- takes a command and then a list of files, with optional flags thrown\nanywhere.\n\n###
90
- Commands\n\n* `compress` - takes a list of files, and by default compresses them
91
- into\ngzipped tarball `archive.tar.gz`\n\n ex:\n\n $ tartlet compress
92
- foo bar baz\n\n* `extract` - takes a single zipped tarball and extracts it into
93
- the current\ndirectory\n\n ex:\n\n $ tartlet extract archive.tar.gz\n\n###
94
- Options\n\nOptions can be placed anywhere in the command, eg. `tartlet -d compress
95
- -o\ntarget file1 file2` is the same as `tartlet compress file1 file2 -d -o target`\nwhich
96
- is the same as `tartlet compress -d file1 -o target file2`. I prefer to\nput -d
97
- before the command, -t after the command but before the files, and -o at\nthe very
98
- end, but put them in whatever order makes sense to you.\n\n* `-o VALUE`, `--output
99
- VALUE` - instead of using the default output\n(archive.tar.gz or the current directory),
100
- direct output to **VALUE**. For\ncompression archive name, tartlet will automatically
101
- append the proper file\nsuffix (.tar or .tar.gz) if it is not already provided.\n\n
102
- \ ex:\n\n # extract contents of archive into folder 'dirname'\n $
103
- tartlet extract archive.tar.gz -o dirname\n\n # compress list of files into
104
- tarball 'files.tar.gz'\n $ tartlet compress foo bar baz -o files.tar.gz\n
105
- \ -- or --\n $ tartlet compress foo bar baz -o files\n\n* `--tarball`,
106
- `-tar`, or `-t` - treat tarball as not-gzipped, e.g.\n`archive.tar` (vs the default
107
- assumption of a gzipped tarball, eg\n`archive.tar.gz`)\n\n ex:\n\n # extract
108
- contents of archive into current directory\n $ tartlet extract --tarball
109
- archive.tar\n\n # compress files into non-zipped tarball\n $ tartlet
110
- compress --tarball foo bar baz\n\n* `--dry-run`, `--dry`, `-d` - don't execute any
111
- commands, simply print to\nstdout the tar command that would be produced by tartlet\n\n
112
- \ ex:\n\n $ tartlet --dry compress foo bar baz --tarball -o files\n tar
113
- -cf files.tar foo bar baz\n\n $ tartlet extract --dry-run lotsoffiles.tar.gz
114
- -o safefolder\n tar -xzf lotsoffiles.tar.gz -C safefolder\n "
69
+ description: Tartlet is a command line utility that can be called with a single command
70
+ (compress or extract) and a list of files to run tar without the headache.
115
71
  email:
116
72
  - jakemaskiewicz@gmail.com
117
73
  executables:
@@ -123,7 +79,6 @@ files:
123
79
  - Gemfile
124
80
  - LICENSE
125
81
  - README.md
126
- - README.rdoc
127
82
  - Rakefile
128
83
  - bin/tartlet
129
84
  - features/step_definitions/tartlet_steps.rb
@@ -135,27 +90,26 @@ files:
135
90
  - test/tc_something.rb
136
91
  homepage: https://github.com/jakemask/tartlet
137
92
  licenses: []
93
+ metadata: {}
138
94
  post_install_message:
139
95
  rdoc_options: []
140
96
  require_paths:
141
97
  - lib
142
98
  required_ruby_version: !ruby/object:Gem::Requirement
143
- none: false
144
99
  requirements:
145
- - - ! '>='
100
+ - - '>='
146
101
  - !ruby/object:Gem::Version
147
102
  version: '0'
148
103
  required_rubygems_version: !ruby/object:Gem::Requirement
149
- none: false
150
104
  requirements:
151
- - - ! '>='
105
+ - - '>='
152
106
  - !ruby/object:Gem::Version
153
107
  version: '0'
154
108
  requirements: []
155
109
  rubyforge_project:
156
- rubygems_version: 1.8.25
110
+ rubygems_version: 2.0.14
157
111
  signing_key:
158
- specification_version: 3
112
+ specification_version: 4
159
113
  summary: A wrapper for tar that provides sensible defaults
160
114
  test_files:
161
115
  - features/step_definitions/tartlet_steps.rb
@@ -1,115 +0,0 @@
1
- = tartlet - a wrapper for tar that provides sensible defaults
2
-
3
- Author:: Jacob Maskiewicz (jakemaskiewicz@gmail.com)
4
- Copyright:: Copyright (c) 2013 Jacob Maskiewicz
5
-
6
-
7
- == Description
8
-
9
- Tar horror stories. Everyone has one. You used the wrong flags and accidentally
10
- overwrote one of your source files without a backup. Or you extracted a tarball
11
- over your current directory and deleted half the updates to your project. You
12
- spent 30 minutes scouring Google for the right set of flags to extract a zipped
13
- tarball instead of an unzipped one. Why are there so many flags!?!
14
-
15
- Enter Tartlet. Tartlet is a small commandline wrapper around tar that handles
16
- the obnoxious flags for you. Need to extract an archive?
17
-
18
- tartlet extract thinmints.tar.gz
19
-
20
- Mmmmmmm. Delicious extracted cookies. Need to compress a set of files?
21
-
22
- tartlet compress butter sugar flour --output cookie
23
-
24
- Mmmmmmmmm. Chocolaty compressed cookies. Tartlet makes it easy to make archives
25
- (and apparently I'm craving cookies- please hold).
26
-
27
- == Installation
28
-
29
-
30
- Install via gem as:
31
-
32
- $ gem install tart
33
-
34
- == Usage
35
-
36
- Tartlet takes a command and then a list of files, with optional flags thrown
37
- anywhere.
38
-
39
- === Commands
40
-
41
- * <tt>compress</tt> - takes a list of files, and by default compresses them into gzipped tarball <tt>archive.tar.gz</tt>
42
-
43
- ex:
44
-
45
- $ tartlet compress foo bar baz
46
-
47
- ***TODO***: do a clobbering check before making the tarball to ensure file
48
- safety
49
-
50
- * <tt>extract</tt> - takes a single zipped tarball and extracts it into the current directory
51
-
52
- ex:
53
-
54
- $ tartlet extract archive.tar.gz
55
-
56
- ***TODO***: take a list of tarballs and extract them each into their own
57
- folder
58
-
59
- ***TODO***: do a clobbering check before extracting the tarball to ensure
60
- file safety
61
-
62
- === Options
63
-
64
- Options can be placed anywhere in the command, eg. <tt>tartlet -d compress -o
65
- target file1 file2</tt> is the same as <tt>tartlet compress file1 file2 -d -o target</tt>
66
- which is the same as <tt>tartlet compress -d file1 -o target file2</tt>. I prefer to
67
- put -d before the command, -t after the command but before the files, and -o at
68
- the very end, but put them in whatever order makes sense to you.
69
-
70
- * <tt>-o VALUE</tt>, <tt>--output VALUE</tt> - instead of using the default output (archive.tar.gz or the current directory), direct output to **VALUE**. For compression archive name, tartlet will automatically append the proper file suffix (.tar or .tar.gz) if it is not already provided.
71
-
72
- ex:
73
-
74
- # extract contents of archive into folder 'dirname'
75
- $ tartlet extract archive.tar.gz -o dirname
76
-
77
- # compress list of files into tarball 'files.tar.gz'
78
- $ tartlet compress foo bar baz -o files.tar.gz
79
- -- or --
80
- $ tartlet compress foo bar baz -o files
81
-
82
- * <tt>--tarball</tt>, <tt>-tar</tt>, or <tt>-t</tt> - treat tarball as not-gzipped, e.g. <tt>archive.tar</tt> (vs the default assumption of a gzipped tarball, eg <tt>archive.tar.gz</tt>)
83
-
84
- ex:
85
-
86
- # extract contents of archive into current directory
87
- $ tartlet extract --tarball archive.tar
88
-
89
- # compress files into non-zipped tarball
90
- $ tartlet compress --tarball foo bar baz
91
-
92
- * <tt>--dry-run</tt>, <tt>--dry</tt>, <tt>-d</tt> - don't execute any commands, simply print to stdout the tar command that would be produced by tartlet
93
-
94
- ex:
95
-
96
- $ tartlet --dry compress foo bar baz --tarball -o files
97
- tar -cf files.tar foo bar baz
98
-
99
- $ tartlet extract --dry-run lotsoffiles.tar.gz -o safefolder
100
- tar -xzf lotsoffiles.tar.gz -C safefolder
101
-
102
-
103
-
104
- == Links
105
-
106
- * {Source on Github}[https://github.com/jakemask/tartlet]
107
- * RDoc[LINK TO RDOC.INFO]
108
-
109
- == Contributing
110
-
111
- 1. Fork the {Github Source}[https://github.com/jakemask/tartlet]
112
- 2. Create your feature branch (<tt>git checkout -b my-new-feature</tt>)
113
- 3. Commit your changes (<tt>git commit -am 'Added some feature'</tt>)
114
- 4. Push to the branch (<tt>git push origin my-new-feature</tt>)
115
- 5. Create new Pull Request