my_scripts 0.0.13 → 0.0.17

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/.document CHANGED
@@ -1,5 +1,5 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore CHANGED
@@ -1,21 +1,21 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2009 arvicco
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2009 arvicco
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc CHANGED
@@ -1,98 +1,98 @@
1
- = my_scripts
2
- by: Arvicco
3
- url: http://github.com/arvicco/my_scripts
4
-
5
- == DESCRIPTION:
6
-
7
- A collection of simple scripts/commands used to save time and avoid memorizing/
8
- retyping chains of boilerplate console commands and their arguments. Packaged
9
- as a gem to make it easily available everywhere without the need to set up
10
- paths, environments and all such nonsense... It is also not OS-specific, so
11
- (in theory) scripts should work on Mac, *nix and Windows.
12
-
13
- == FEATURES/PROBLEMS:
14
-
15
- OK, I confess: I wanted to write scripts but had neither time nor desire to learn
16
- all the esoterics of bash, cmd/powershell and mac scripting. So, I set out to do
17
- all my scripting in Ruby. I also wanted my scripts to be easily testable, that's
18
- why I created a simple scripting framework instead of stuffing each script into a
19
- separate executable Ruby file as most people do.
20
-
21
- These scripts are very much targeted to my own specific needs, but if you find them
22
- useful or need additional features, I'll be happy to generalize. You can also use this
23
- gem as a basis for writing your own simple scripts that are easy to test and maintain.
24
-
25
- Ah, yes - this gem will work only with Ruby 1.9 and later. I use advanced string encoding
26
- features in my scripts, so 1.8 is not an option for me, and providing backward compatibility
27
- looks like too much pain. Ruby 1.9 is the way of the future, so let's move forward!
28
-
29
- == INSTALL:
30
-
31
- $ sudo gem install my_scripts
32
-
33
- == SYNOPSIS:
34
- === Creating your own scripts
35
-
36
- First, you need to either fork my_scripts on github or clone it to your computer with:
37
-
38
- $ git clone git://github.com/arvicco/my_scripts.git
39
-
40
- Now, put your Ruby file inside lib/my_scripts. It will be auto-loaded. Use MyScripts
41
- module as a top level namespace. Subclass Script and redefine run method to do all
42
- actual work:
43
-
44
- #-------- lib/my_scripts/my_shiny_script.rb----------
45
- module MyScripts
46
- class MyShinyScript < Script
47
- def run
48
- # Here you put all the actual code of your script.
49
- # You have following instance vars at your disposal:
50
- # @name - your script name,
51
- # @argv - your ARGV Array of command line arguments,
52
- # @cli - CLI runner (holds references to stdin and stdout)
53
- ...
54
- end
55
- end
56
- end
57
- #-------
58
-
59
- Put your executable into bin directory, with something like this:
60
-
61
- #-------- bin/my_shiny_script----------
62
- #!/usr/bin/env ruby
63
- require File.dirname(__FILE__) + '/../lib/my_scripts'
64
- MyScripts::CLI.run :my_shiny_script, ARGV
65
- #-------
66
-
67
- Run 'rake install' from project directory, and enjoy greatness of your new script!
68
-
69
- OK, so you're not advanced enough to follow even these simple instructions. No problemo.
70
- I guess you still managed to install my_scripts gem if you are reading this, so just modify it.
71
- Locate my_scripts gem in gem directory (usually it's something like ../ruby/lib/ruby/gems/1.9.1/gems).
72
- I have dummy script skeleton in lib/my_scripts/dummy.rb that is ready for your use. Just put your
73
- script code inside run method (if you use ARGV, change it to @argv). Done! You can
74
- immediately run your script anywhere in the system using the following command:
75
-
76
- $ dummy Whatever arguments your code expects and processes
77
-
78
- === Using existing scripts
79
-
80
- $ jew project_name Summary or description goes here
81
-
82
- This script uses Jeweler to create new project skeleton, local git repo and
83
- initiate remote repo on github. No need to enclose your description in quotes.
84
-
85
- $ gitto [BUMP] Commit message goes here
86
-
87
- Save the result of all your project-related work with one command. It adds all
88
- new files to git VCS, commits all changes with a timestamped message, opionally
89
- bumps up version and pushes to remote VCS repository(-ies). If first arg is a
90
- number, it is treated as bump directive: 1 - bump:patch, 10 - bump:minor,
91
- 100 - bump:major. Otherwise all arguments are treated as part of commit message.
92
- Use inside project dir, preferably at top level.
93
-
94
- ...
95
-
96
- == LICENSE:
97
-
98
- Copyright (c) 2009 Arvicco. See LICENSE for details.
1
+ = my_scripts
2
+ by: Arvicco
3
+ url: http://github.com/arvicco/my_scripts
4
+
5
+ == DESCRIPTION:
6
+
7
+ A collection of simple scripts/commands used to save time and avoid memorizing/
8
+ retyping chains of boilerplate console commands and their arguments. Packaged
9
+ as a gem to make it easily available everywhere without the need to set up
10
+ paths, environments and all such nonsense... It is also not OS-specific, so
11
+ (in theory) scripts should work on Mac, *nix and Windows.
12
+
13
+ == FEATURES/PROBLEMS:
14
+
15
+ OK, I confess: I wanted to write scripts but had neither time nor desire to learn
16
+ all the esoterics of bash, cmd/powershell and mac scripting. So, I set out to do
17
+ all my scripting in Ruby. I also wanted my scripts to be easily testable, that's
18
+ why I created a simple scripting framework instead of stuffing each script into a
19
+ separate executable Ruby file as most people do.
20
+
21
+ These scripts are very much targeted to my own specific needs, but if you find them
22
+ useful or need additional features, I'll be happy to generalize. You can also use this
23
+ gem as a basis for writing your own simple scripts that are easy to test and maintain.
24
+
25
+ Ah, yes - this gem will work only with Ruby 1.9 and later. I use advanced string encoding
26
+ features in my scripts, so 1.8 is not an option for me, and providing backward compatibility
27
+ looks like too much pain. Ruby 1.9 is the way of the future, so let's move forward!
28
+
29
+ == INSTALL:
30
+
31
+ $ sudo gem install my_scripts
32
+
33
+ == SYNOPSIS:
34
+ === Creating your own scripts
35
+
36
+ First, you need to either fork my_scripts on github or clone it to your computer with:
37
+
38
+ $ git clone git://github.com/arvicco/my_scripts.git
39
+
40
+ Now, put your Ruby file inside lib/my_scripts. It will be auto-loaded. Use MyScripts
41
+ module as a top level namespace. Subclass Script and redefine run method to do all
42
+ actual work:
43
+
44
+ #-------- lib/my_scripts/my_shiny_script.rb----------
45
+ module MyScripts
46
+ class MyShinyScript < Script
47
+ def run
48
+ # Here you put all the actual code of your script.
49
+ # You have following instance vars at your disposal:
50
+ # @name - your script name,
51
+ # @argv - your ARGV Array of command line arguments,
52
+ # @cli - CLI runner (holds references to stdin and stdout)
53
+ ...
54
+ end
55
+ end
56
+ end
57
+ #-------
58
+
59
+ Put your executable into bin directory, with something like this:
60
+
61
+ #-------- bin/my_shiny_script----------
62
+ #!/usr/bin/env ruby
63
+ require File.dirname(__FILE__) + '/../lib/my_scripts'
64
+ MyScripts::CLI.run :my_shiny_script, ARGV
65
+ #-------
66
+
67
+ Run 'rake install' from project directory, and enjoy greatness of your new script!
68
+
69
+ OK, so you're not advanced enough to follow even these simple instructions. No problemo.
70
+ I guess you still managed to install my_scripts gem if you are reading this, so just modify it.
71
+ Locate my_scripts gem in gem directory (usually it's something like ../ruby/lib/ruby/gems/1.9.1/gems).
72
+ I have dummy script skeleton in lib/my_scripts/dummy.rb that is ready for your use. Just put your
73
+ script code inside run method (if you use ARGV, change it to @argv). Done! You can
74
+ immediately run your script anywhere in the system using the following command:
75
+
76
+ $ dummy Whatever arguments your code expects and processes
77
+
78
+ === Using existing scripts
79
+
80
+ $ jew project_name Summary or description goes here
81
+
82
+ This script uses Jeweler to create new project skeleton, local git repo and
83
+ initiate remote repo on github. No need to enclose your description in quotes.
84
+
85
+ $ gitto [BUMP] Commit message goes here
86
+
87
+ Save the result of all your project-related work with one command. It adds all
88
+ new files to git VCS, commits all changes with a timestamped message, opionally
89
+ bumps up version and pushes to remote VCS repository(-ies). If first arg is a
90
+ number, it is treated as bump directive: 1 - bump:patch, 10 - bump:minor,
91
+ 100 - bump:major. Otherwise all arguments are treated as part of commit message.
92
+ Use inside project dir, preferably at top level.
93
+
94
+ ...
95
+
96
+ == LICENSE:
97
+
98
+ Copyright (c) 2009 Arvicco. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,57 +1,57 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "my_scripts"
8
- gem.summary = "Simple framework for writing command-line scripts"
9
- gem.description = "Simple framework for writing command-line scripts and collection of my own scripts (mostly dev-related)"
10
- gem.email = "arvitallian@gmail.com"
11
- gem.homepage = "http://github.com/arvicco/my_scripts"
12
- gem.authors = ["arvicco"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_development_dependency "cucumber", ">= 0"
15
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
- end
17
- Jeweler::GemcutterTasks.new
18
- rescue LoadError
19
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
- end
21
-
22
- require 'spec/rake/spectask'
23
- Spec::Rake::SpecTask.new(:spec) do |spec|
24
- spec.libs << 'lib' << 'spec'
25
- spec.spec_files = FileList['spec/**/*_spec.rb']
26
- end
27
-
28
- Spec::Rake::SpecTask.new(:rcov) do |spec|
29
- spec.libs << 'lib' << 'spec'
30
- spec.pattern = 'spec/**/*_spec.rb'
31
- spec.rcov = true
32
- end
33
-
34
- task :spec => :check_dependencies
35
-
36
- begin
37
- require 'cucumber/rake/task'
38
- Cucumber::Rake::Task.new(:features)
39
-
40
- task :features => :check_dependencies
41
- rescue LoadError
42
- task :features do
43
- abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
44
- end
45
- end
46
-
47
- task :default => :spec
48
-
49
- require 'rake/rdoctask'
50
- Rake::RDocTask.new do |rdoc|
51
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
-
53
- rdoc.rdoc_dir = 'rdoc'
54
- rdoc.title = "my_scripts #{version}"
55
- rdoc.rdoc_files.include('README*')
56
- rdoc.rdoc_files.include('lib/**/*.rb')
57
- end
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "my_scripts"
8
+ gem.summary = "Simple framework for writing command-line scripts"
9
+ gem.description = "Simple framework for writing command-line scripts and collection of my own scripts (mostly dev-related)"
10
+ gem.email = "arvitallian@gmail.com"
11
+ gem.homepage = "http://github.com/arvicco/my_scripts"
12
+ gem.authors = ["arvicco"]
13
+ gem.add_development_dependency "rspec", ">= 1.2.9"
14
+ gem.add_development_dependency "cucumber", ">= 0"
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
+ end
21
+
22
+ require 'spec/rake/spectask'
23
+ Spec::Rake::SpecTask.new(:spec) do |spec|
24
+ spec.libs << 'lib' << 'spec'
25
+ spec.spec_files = FileList['spec/**/*_spec.rb']
26
+ end
27
+
28
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
29
+ spec.libs << 'lib' << 'spec'
30
+ spec.pattern = 'spec/**/*_spec.rb'
31
+ spec.rcov = true
32
+ end
33
+
34
+ task :spec => :check_dependencies
35
+
36
+ begin
37
+ require 'cucumber/rake/task'
38
+ Cucumber::Rake::Task.new(:features)
39
+
40
+ task :features => :check_dependencies
41
+ rescue LoadError
42
+ task :features do
43
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
44
+ end
45
+ end
46
+
47
+ task :default => :spec
48
+
49
+ require 'rake/rdoctask'
50
+ Rake::RDocTask.new do |rdoc|
51
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "my_scripts #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
57
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.13
1
+ 0.0.17
data/bin/citi CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.dirname(__FILE__) + '/../lib/my_scripts'
4
-
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/my_scripts'
4
+
5
5
  MyScripts::CLI.run :citi, ARGV
data/bin/dummy CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.dirname(__FILE__) + '/../lib/my_scripts'
4
-
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/my_scripts'
4
+
5
5
  MyScripts::CLI.run :dummy, ARGV
data/bin/gitto CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.dirname(__FILE__) + '/../lib/my_scripts'
4
-
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/my_scripts'
4
+
5
5
  MyScripts::CLI.run :gitto, ARGV
data/bin/jew CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.dirname(__FILE__) + '/../lib/my_scripts'
4
-
5
- MyScripts::CLI.run :jew, ARGV
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/my_scripts'
4
+
5
+ MyScripts::CLI.run :jew, ARGV
data/bin/mybones CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.dirname(__FILE__) + '/../lib/my_scripts'
4
-
5
- MyScripts::CLI.run :mybones, ARGV
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/my_scripts'
4
+
5
+ MyScripts::CLI.run :mybones, ARGV
data/bin/newscript ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/my_scripts'
4
+
5
+ MyScripts::CLI.run :newscript, ARGV
data/bin/rabbit CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.dirname(__FILE__) + '/../lib/my_scripts'
4
-
5
- MyScripts::CLI.run :rabbit, ARGV
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/my_scripts'
4
+
5
+ MyScripts::CLI.run :rabbit, ARGV
data/bin/wake ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/my_scripts'
4
+
5
+ MyScripts::CLI.run :wake, ARGV
@@ -1,9 +1,9 @@
1
- Feature: something something
2
- In order to something something
3
- A user something something
4
- something something something
5
-
6
- Scenario: something something
7
- Given inspiration
8
- When I create a sweet new gem
9
- Then everyone should see how awesome I am
1
+ Feature: something something
2
+ In order to something something
3
+ A user something something
4
+ something something something
5
+
6
+ Scenario: something something
7
+ Given inspiration
8
+ When I create a sweet new gem
9
+ Then everyone should see how awesome I am
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
- require 'my_scripts'
3
-
4
- require 'spec/expectations'
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
+ require 'my_scripts'
3
+
4
+ require 'spec/expectations'