sobriquet 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +50 -0
- data/.rspec +2 -0
- data/.rubocop.yml +9 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +84 -0
- data/README.rdoc +0 -0
- data/Rakefile +43 -0
- data/bin/sobriquet +85 -0
- data/features/alias.feature +24 -0
- data/features/generate.feature +35 -0
- data/features/init.feature +24 -0
- data/features/sobriquet.feature +6 -0
- data/features/step_definitions/sobriquet_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/features/variable.feature +25 -0
- data/html/Object.html +116 -0
- data/html/README_rdoc.html +82 -0
- data/html/Sobriquet.html +112 -0
- data/html/created.rid +5 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +590 -0
- data/html/fonts.css +167 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +92 -0
- data/html/js/darkfish.js +140 -0
- data/html/js/jquery.js +18 -0
- data/html/js/navigation.js +142 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +109 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +228 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/rdoc.css +580 -0
- data/html/table_of_contents.html +54 -0
- data/lib/sobriquet.rb +4 -0
- data/lib/sobriquet/command.rb +12 -0
- data/lib/sobriquet/command_collection.rb +36 -0
- data/lib/sobriquet/persistance.rb +27 -0
- data/lib/sobriquet/version.rb +3 -0
- data/readme.md +77 -0
- data/readme.rdoc +0 -0
- data/sobriquet.gemspec +28 -0
- data/sobriquet.rdoc +5 -0
- data/spec/command_collection_spec.rb +37 -0
- data/spec/persistance_spec.rb +60 -0
- data/spec/sobriquet_spec.rb +0 -0
- data/spec/spec_helper.rb +78 -0
- data/templates/sobriquet.csv +1 -0
- data/workspace.csv +1 -0
- metadata +245 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf6d3e32b9e230a2726af9884eee6bb765ae9c9a
|
4
|
+
data.tar.gz: 4feade591a9a7221aeca7554691cdab992af8ca4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5cae0cab28b40a27e364e578fc9a6414eb2bb72105b2181a64188b3f484578bd6df74a156a6f917412b63594cb4cd49b9f7f6ee8892690cf311764b25b17c966
|
7
|
+
data.tar.gz: 48eed1cab71694eb59f4140a2a9dfdbebdb629cb034c42f2103da099d33e20d8f36317713b7703befe4f18ec07116c07dbd94e25d939f1f1f59c51d61636543e
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
sobriquet (0.0.1)
|
5
|
+
gli (= 2.14.0)
|
6
|
+
mustache (~> 1.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
aruba (0.14.1)
|
12
|
+
childprocess (~> 0.5.6)
|
13
|
+
contracts (~> 0.9)
|
14
|
+
cucumber (>= 1.3.19)
|
15
|
+
ffi (~> 1.9.10)
|
16
|
+
rspec-expectations (>= 2.99)
|
17
|
+
thor (~> 0.19)
|
18
|
+
ast (2.2.0)
|
19
|
+
builder (3.2.2)
|
20
|
+
childprocess (0.5.9)
|
21
|
+
ffi (~> 1.0, >= 1.0.11)
|
22
|
+
contracts (0.14.0)
|
23
|
+
cucumber (2.3.3)
|
24
|
+
builder (>= 2.1.2)
|
25
|
+
cucumber-core (~> 1.4.0)
|
26
|
+
cucumber-wire (~> 0.0.1)
|
27
|
+
diff-lcs (>= 1.1.3)
|
28
|
+
gherkin (~> 3.2.0)
|
29
|
+
multi_json (>= 1.7.5, < 2.0)
|
30
|
+
multi_test (>= 0.1.2)
|
31
|
+
cucumber-core (1.4.0)
|
32
|
+
gherkin (~> 3.2.0)
|
33
|
+
cucumber-wire (0.0.1)
|
34
|
+
diff-lcs (1.2.5)
|
35
|
+
ffi (1.9.10)
|
36
|
+
gherkin (3.2.0)
|
37
|
+
gli (2.14.0)
|
38
|
+
json (1.8.3)
|
39
|
+
multi_json (1.12.0)
|
40
|
+
multi_test (0.1.2)
|
41
|
+
mustache (1.0.3)
|
42
|
+
parser (2.3.1.0)
|
43
|
+
ast (~> 2.2)
|
44
|
+
powerpack (0.1.1)
|
45
|
+
rainbow (2.1.0)
|
46
|
+
rake (11.1.2)
|
47
|
+
rdoc (4.2.2)
|
48
|
+
json (~> 1.4)
|
49
|
+
rspec (3.4.0)
|
50
|
+
rspec-core (~> 3.4.0)
|
51
|
+
rspec-expectations (~> 3.4.0)
|
52
|
+
rspec-mocks (~> 3.4.0)
|
53
|
+
rspec-core (3.4.4)
|
54
|
+
rspec-support (~> 3.4.0)
|
55
|
+
rspec-expectations (3.4.0)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.4.0)
|
58
|
+
rspec-mocks (3.4.1)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.4.0)
|
61
|
+
rspec-support (3.4.1)
|
62
|
+
rubocop (0.40.0)
|
63
|
+
parser (>= 2.3.1.0, < 3.0)
|
64
|
+
powerpack (~> 0.1)
|
65
|
+
rainbow (>= 1.99.1, < 3.0)
|
66
|
+
ruby-progressbar (~> 1.7)
|
67
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
68
|
+
rubocop-rspec (1.5.0)
|
69
|
+
rubocop (>= 0.40.0)
|
70
|
+
ruby-progressbar (1.8.1)
|
71
|
+
thor (0.19.1)
|
72
|
+
unicode-display_width (1.0.5)
|
73
|
+
|
74
|
+
PLATFORMS
|
75
|
+
ruby
|
76
|
+
|
77
|
+
DEPENDENCIES
|
78
|
+
aruba
|
79
|
+
rake
|
80
|
+
rdoc
|
81
|
+
rspec
|
82
|
+
rubocop
|
83
|
+
rubocop-rspec
|
84
|
+
sobriquet!
|
data/README.rdoc
ADDED
File without changes
|
data/Rakefile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
require 'rubocop/rake_task'
|
8
|
+
Rake::RDocTask.new do |rd|
|
9
|
+
rd.main = 'README.rdoc'
|
10
|
+
rd.rdoc_files.include('README.rdoc', 'lib/**/*.rb', 'bin/**/*')
|
11
|
+
rd.title = 'Sobriquet'
|
12
|
+
end
|
13
|
+
|
14
|
+
spec = eval(File.read('sobriquet.gemspec'))
|
15
|
+
|
16
|
+
Gem::PackageTask.new(spec)
|
17
|
+
desc 'Run features'
|
18
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
19
|
+
opts = 'features --format progress -x'
|
20
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
21
|
+
t.cucumber_opts = opts
|
22
|
+
t.fork = false
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
26
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
27
|
+
tag_opts = ' --tags @wip'
|
28
|
+
t.cucumber_opts = "features --format pretty -x -s#{tag_opts}"
|
29
|
+
t.fork = false
|
30
|
+
end
|
31
|
+
|
32
|
+
task cucumber: :features
|
33
|
+
task 'cucumber:wip' => 'features:wip'
|
34
|
+
task wip: 'features:wip'
|
35
|
+
|
36
|
+
require 'rspec/core/rake_task'
|
37
|
+
RSpec::Core::RakeTask.new(:spec)
|
38
|
+
|
39
|
+
RuboCop::RakeTask.new do |task|
|
40
|
+
task.requires << 'rubocop-rspec'
|
41
|
+
end
|
42
|
+
|
43
|
+
task default: [:test, :features]
|
data/bin/sobriquet
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'sobriquet'
|
4
|
+
|
5
|
+
include GLI::App
|
6
|
+
include Sobriquet
|
7
|
+
|
8
|
+
program_desc 'Sobriquet manage your alias'
|
9
|
+
|
10
|
+
version Sobriquet::VERSION
|
11
|
+
|
12
|
+
subcommand_option_handling :normal
|
13
|
+
arguments :strict
|
14
|
+
|
15
|
+
desc 'Show more retroaction'
|
16
|
+
switch [:v, :verbose]
|
17
|
+
|
18
|
+
desc 'Path of the workspace foder for sobriquet'
|
19
|
+
default_value ENV['HOME']
|
20
|
+
arg_name 'workspace'
|
21
|
+
flag [:w, :workspace]
|
22
|
+
|
23
|
+
desc 'Initalise sobriquet files'
|
24
|
+
command :init do |command|
|
25
|
+
command.action do |global_options, _options, _args|
|
26
|
+
workspace = global_options['workspace']
|
27
|
+
csv = workspace + '/sobriquet.csv'
|
28
|
+
template_path = File.expand_path('../../templates/sobriquet.csv', __FILE__)
|
29
|
+
FileUtils.cp template_path, csv
|
30
|
+
puts 'Initialise a new sobriquet workspace in ' + workspace
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_a_sobriquet(name)
|
35
|
+
lambda do |global_options, options, args|
|
36
|
+
description = options['description']
|
37
|
+
sobriquet, value, = args
|
38
|
+
csv = global_options['workspace'] + '/sobriquet.csv'
|
39
|
+
persistance = Persistance.new(csv)
|
40
|
+
commands = CommandCollection.new(persistance)
|
41
|
+
commands.add([value, sobriquet, description])
|
42
|
+
puts "Added new #{name} #{sobriquet} | #{value}"
|
43
|
+
puts "Sobriquet added to the file #{csv}" if global_options['verbose']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
arg :sobriquet
|
48
|
+
arg :command
|
49
|
+
desc 'Add an alias for a variable'
|
50
|
+
command :variable do |command|
|
51
|
+
command.desc 'Description of the variable'
|
52
|
+
command.default_value 'no description'
|
53
|
+
command.arg_name 'a bad description is better than no description'
|
54
|
+
command.flag [:d, :description]
|
55
|
+
command.action(&add_a_sobriquet(:variable))
|
56
|
+
end
|
57
|
+
|
58
|
+
arg :sobriquet
|
59
|
+
arg :value
|
60
|
+
desc 'Add an alias for a command'
|
61
|
+
command :add do |command|
|
62
|
+
command.desc 'Description of the alias'
|
63
|
+
command.default_value 'no descriptions'
|
64
|
+
command.arg_name 'a bad description is better than no description'
|
65
|
+
command.flag [:d, :description]
|
66
|
+
command.action(&add_a_sobriquet(:sobriquet))
|
67
|
+
end
|
68
|
+
|
69
|
+
desc 'Generate a shell file from sobriquet data'
|
70
|
+
command :generate do |command|
|
71
|
+
command.action do |global_options, _options, _args|
|
72
|
+
csv = global_options['workspace'] + '/sobriquet.csv'
|
73
|
+
shell_path = global_options['workspace'] + '/sobriquet.sh'
|
74
|
+
verbose = global_options['verbose']
|
75
|
+
persistance = Persistance.new(csv)
|
76
|
+
script = CommandCollection.new(persistance).compile
|
77
|
+
File.open(shell_path, 'w') do |file|
|
78
|
+
file.write script
|
79
|
+
end
|
80
|
+
puts 'generate alias file ' + shell_path + ' from csv file' + csv
|
81
|
+
puts "alias generated from the csv file #{csv}" if verbose
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
exit run(ARGV)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Feature: Add alias to sobriquet data file
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a mocked home directory
|
5
|
+
And a file named "sobriquet.csv" with:
|
6
|
+
"""
|
7
|
+
command | alias | description
|
8
|
+
"""
|
9
|
+
|
10
|
+
Scenario: Add an alias with descriptions
|
11
|
+
When I run `sobriquet add -d 'get the status of the git directory' gs 'git status' `
|
12
|
+
Then the output should contain:
|
13
|
+
"""
|
14
|
+
Added new sobriquet gs | git status
|
15
|
+
"""
|
16
|
+
And the file named "sobriquet.csv" should contain:
|
17
|
+
"""
|
18
|
+
"git status" | gs | "get the status of the git directory"
|
19
|
+
"""
|
20
|
+
|
21
|
+
Scenario: Add an alias with verbose flag
|
22
|
+
When I run `sobriquet --verbose add gs 'git status' `
|
23
|
+
Then the output should match /Sobriquet added to the file .*sobriquet.csv/
|
24
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Generate a shell file to declare alias and import variables
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a mocked home directory
|
5
|
+
And a file named "sobriquet.csv" with:
|
6
|
+
"""
|
7
|
+
command | alias | description | type
|
8
|
+
"git status" | gs | "get the status of the git directory" | command
|
9
|
+
"origin master" | om | "no description" | variable
|
10
|
+
"""
|
11
|
+
|
12
|
+
Scenario: generate the alias file every time i run the generate command
|
13
|
+
When I run `sobriquet generate`
|
14
|
+
And I run `sobriquet generate`
|
15
|
+
Then the output should contain:
|
16
|
+
"""
|
17
|
+
generate alias file
|
18
|
+
"""
|
19
|
+
And the file named "sobriquet.sh" should contain:
|
20
|
+
"""
|
21
|
+
# description : get the status of the git directory
|
22
|
+
"""
|
23
|
+
And the file named "sobriquet.sh" should contain:
|
24
|
+
"""
|
25
|
+
alias gs="git status"
|
26
|
+
"""
|
27
|
+
And the file named "sobriquet.sh" should contain:
|
28
|
+
"""
|
29
|
+
export om="origin master"
|
30
|
+
"""
|
31
|
+
|
32
|
+
Scenario: Generate the alias flag with verbose flag
|
33
|
+
When I run `sobriquet --verbose generate`
|
34
|
+
Then the output should match /alias generated from the csv file .*sobriquet.csv/
|
35
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Feature: Initialise a new workspace
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a mocked home directory
|
5
|
+
|
6
|
+
Scenario: Init a new folder with a csv file for the aliases
|
7
|
+
When I run `sobriquet init`
|
8
|
+
Then the file named "sobriquet.csv" should contain:
|
9
|
+
"""
|
10
|
+
command | alias | description
|
11
|
+
"""
|
12
|
+
And the output should contain:
|
13
|
+
"""
|
14
|
+
Initialise a new sobriquet workspace in
|
15
|
+
"""
|
16
|
+
|
17
|
+
Scenario: Init a new directory with a workspace option
|
18
|
+
Given an empty directory named "test"
|
19
|
+
When I run `sobriquet --workspace=test init `
|
20
|
+
Then the output should contain:
|
21
|
+
"""
|
22
|
+
Initialise a new sobriquet workspace in test
|
23
|
+
"""
|
24
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
|
3
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib')
|
5
|
+
|
6
|
+
Before do
|
7
|
+
# Using "announce" causes massive warnings on 1.9.2
|
8
|
+
@puts = true
|
9
|
+
@original_rubylib = ENV['RUBYLIB']
|
10
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
After do
|
14
|
+
ENV['RUBYLIB'] = @original_rubylib
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Feature: Add a variable to sobriquet data file
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a mocked home directory
|
5
|
+
And a file named "sobriquet.csv" with:
|
6
|
+
"""
|
7
|
+
command | alias | description
|
8
|
+
"""
|
9
|
+
|
10
|
+
@wip
|
11
|
+
Scenario: Add a variable
|
12
|
+
When I run `sobriquet variable om 'origin master'`
|
13
|
+
Then the output should contain:
|
14
|
+
"""
|
15
|
+
Added new variable om | origin master
|
16
|
+
"""
|
17
|
+
And the file named "sobriquet.csv" should contain:
|
18
|
+
"""
|
19
|
+
"origin master" | om | "no description"
|
20
|
+
"""
|
21
|
+
|
22
|
+
Scenario: Add an variable with verbose flag
|
23
|
+
When I run `sobriquet --verbose variable om 'origin master' `
|
24
|
+
Then the output should match /Sobriquet added to the file .*sobriquet.csv/
|
25
|
+
|