nd-shell_scripts 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ba02fe1cb363ddbf57b8be1ff798ab599b8c443d
4
+ data.tar.gz: 1c737c34982229d2ef3e310373e11052a0c1b33f
5
+ SHA512:
6
+ metadata.gz: 6adcc984af4947429d8f270e216aaf8bb614722c5a2fde3db527008d340356f45094a6e0833ed40bba19e10f2488b6d126d61b7b6b7c7546f819d277bede7267
7
+ data.tar.gz: 00d437151ad4749d06e08d10f634fbe240c071a5f38a65fb1b49c69d1d31334b3e34620ea0d6c8d869fc2cb20bead34974b6c2d049e155a66efb3ebaecb524e7
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ .repo_timeline
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nd-shell_scripts.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Neurodynamic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Nd::ShellScripts
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/nd/shell_scripts`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'nd-shell_scripts'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install nd-shell_scripts
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/nd-shell_scripts/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/bi ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "bundle install #{args}"
data/bin/bu ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "bundle update #{args}"
data/bin/ca ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ exec "rep2 ~/Developer"
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+ require "colorize"
4
+
5
+ def time
6
+ `rpt commit_time`.gsub('"','').strip
7
+ end
8
+
9
+ def git_branch
10
+ branch = `git branch 2> /dev/null`
11
+
12
+ if branch.include?("* ")
13
+ branch.gsub('* ','').strip
14
+ else
15
+ '_'
16
+ end
17
+ end
18
+
19
+ def ruby_version
20
+ `rbenv version`.split(' ').first.strip
21
+ end
22
+
23
+ def directory
24
+ Dir.pwd.
25
+ gsub(home_folder,'~').
26
+ gsub('~/Developer','!').strip
27
+ end
28
+
29
+ def home_folder
30
+ `echo $HOME`.strip
31
+ end
32
+
33
+
34
+
35
+ puts [
36
+ directory.light_yellow,
37
+ ruby_version.magenta,
38
+ git_branch.light_cyan,
39
+ time.white,
40
+ ">"
41
+ ].join(' ')
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nd/shell_scripts"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/db ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ if args?
5
+ execute_and_record "rake db:#{args}"
6
+ else
7
+ execute_and_record "rake db:migrate"
8
+ end
data/bin/dbdn ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ app_name = Dir.pwd.split('/').last
5
+ db_name = "#{app_name}_development"
6
+ dump_file_path = "~/Desktop/Backups/DB_BACKUP_FILES/#{app_name}/most_recent_import.dump"
7
+
8
+
9
+
10
+ puts "Backing up..."
11
+ `heroku pgbackups:capture --expire`
12
+ puts "Downloading..."
13
+ `curl -o $dump_file (heroku pgbackups:url)`
14
+
15
+ puts "Running pg_restore from #{dump_file_path} file to #{db_name} database..."
16
+
17
+ exec "pg_restore --verbose --clean --no-acl --no-owner -h localhost -d #{db_name} #{dump_file_path}"
data/bin/dn ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ args = ARGV.join(' ')
5
+ execute_and_record "git pull #{args}"
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ gem_list = `gem list`
5
+
6
+ required_gems = [
7
+ "repos_report",
8
+ "repo_timetracker",
9
+ "hcl",
10
+ "filewatcher",
11
+ "colorize",
12
+ "bundle"
13
+ ]
14
+
15
+
16
+ required_gems.each do |gem|
17
+
18
+ if gem_list.include?(gem_name)
19
+ puts "#{gem_name} gem presence verified"
20
+ else
21
+ puts "Installing #{gem_name} gem..."
22
+ `gem install #{gem_name}`
23
+ end
24
+
25
+ end
data/bin/ga ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ if args?
5
+ execute_and_record "git add #{args}"
6
+ else
7
+ puts "git add . && git add -u"
8
+ execute_and_record "git add . && git add -u"
9
+ end
data/bin/gc ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ total_time = `rpt commit_time`.gsub('"','')
5
+
6
+ record_commit_in_harvest_app(args, total_time)
7
+
8
+ execute_and_record "git commit -m \"#{args} #{total_time}\""
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+ def record_commit_in_harvest_app(args, total_time)
20
+ if command_exists? 'hcl'
21
+ `hcl note "
22
+
23
+ COMMIT: #{args} #{total_time}"`
24
+ end
25
+ end
data/bin/gca ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "git commit --amend #{args}"
5
+
data/bin/gd ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "git diff #{args}"
data/bin/gi ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ if args?
5
+ execute_and_record "git init #{args}"
6
+ else
7
+ execute_and_record "git init ."
8
+ end
data/bin/gl ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "git log #{args}"
data/bin/gr ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "git reset #{args}"
data/bin/grm ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "git rm #{args}"
data/bin/gs ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "git status #{args}"
data/bin/h ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ exec "cd ~/#{args}"
data/bin/p ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ if args?
5
+ repo_paths = `rep2 list ~/Developer`.split("\n").select { |path| not path.empty? }
6
+
7
+ repo_paths.each |path|
8
+ repo_name = path.split('/').last
9
+
10
+ if repo_name.include?(args.first)
11
+ exec "cd #{path}"
12
+ break
13
+ end
14
+ end
15
+ else
16
+ exec "cd ~/Developer/"
17
+ end
data/bin/rc ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "rails c #{args}"
data/bin/rg ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "rails g #{args}"
data/bin/rs ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ execute_and_record "rails s #{args}"
data/bin/rt ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ if args?
5
+ puts "bundle exec rake test TEST=#{args}"
6
+ execute_and_record "bundle exec rake test TEST=#{args}"
7
+ else
8
+ puts "bundle exec rake test:all"
9
+ execute_and_record "bundle exec rake test:all"
10
+ end
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/bin/up ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/nd/shell_scripts'
3
+
4
+ if args?
5
+ execute_and_record "git push origin #{args}"
6
+ else
7
+ puts "git push origin --all"
8
+ execute_and_record "git push origin --all"
9
+ end
@@ -0,0 +1,5 @@
1
+ module Nd
2
+ module ShellScripts
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,21 @@
1
+ require "nd/shell_scripts/version"
2
+
3
+ module Nd
4
+ module ShellScripts
5
+ def execute_and_record(command)
6
+ exec "#{command} && rpt rec \"#{command}\""
7
+ end
8
+
9
+ def args
10
+ ARGV.join(' ')
11
+ end
12
+
13
+ def args?
14
+ ARGV.any?
15
+ end
16
+
17
+ def command_exists?(command)
18
+ `which #{command}`.strip.length > 0
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nd/shell_scripts/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nd-shell_scripts"
8
+ spec.version = Nd::ShellScripts::VERSION
9
+ spec.authors = ["Neurodynamic"]
10
+ spec.email = ["developer@neurodynamic.io"]
11
+
12
+ if spec.respond_to?(:metadata)
13
+ # spec.metadata['allowed_push_host'] = ""
14
+ end
15
+
16
+ spec.summary = %q{Some shell scripts in Ruby}
17
+ spec.description = %q{}
18
+ spec.homepage = "https://bitbucket.org/neurodynamic/nd-shell_scripts"
19
+ spec.license = "MIT"
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.8"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "colorize"
29
+ spec.add_development_dependency "repo_timetracker"
30
+ spec.add_development_dependency "repos_report"
31
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nd-shell_scripts
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Neurodynamic
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-05-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: colorize
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: repo_timetracker
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: repos_report
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: ''
84
+ email:
85
+ - developer@neurodynamic.io
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - CODE_OF_CONDUCT.md
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/bi
97
+ - bin/bu
98
+ - bin/ca
99
+ - bin/colorized_prompt
100
+ - bin/console
101
+ - bin/db
102
+ - bin/dbdn
103
+ - bin/dn
104
+ - bin/ensure_gems_installed
105
+ - bin/ga
106
+ - bin/gc
107
+ - bin/gca
108
+ - bin/gd
109
+ - bin/gi
110
+ - bin/gl
111
+ - bin/gr
112
+ - bin/grm
113
+ - bin/gs
114
+ - bin/h
115
+ - bin/p
116
+ - bin/rc
117
+ - bin/rg
118
+ - bin/rs
119
+ - bin/rt
120
+ - bin/setup
121
+ - bin/up
122
+ - lib/nd/shell_scripts.rb
123
+ - lib/nd/shell_scripts/version.rb
124
+ - nd-shell_scripts.gemspec
125
+ homepage: https://bitbucket.org/neurodynamic/nd-shell_scripts
126
+ licenses:
127
+ - MIT
128
+ metadata: {}
129
+ post_install_message:
130
+ rdoc_options: []
131
+ require_paths:
132
+ - lib
133
+ required_ruby_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ requirements: []
144
+ rubyforge_project:
145
+ rubygems_version: 2.4.5
146
+ signing_key:
147
+ specification_version: 4
148
+ summary: Some shell scripts in Ruby
149
+ test_files: []