system_cat 0.0.1

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: 9b700dde73e999a3186e74f0d802df918d1bc39e
4
+ data.tar.gz: 98f4e4b129b56e523a44ac626472b4800d910d29
5
+ SHA512:
6
+ metadata.gz: 9ba221f8e7eaa332bdb0e422a532e0bd24e75fa23e81a37c0fd84cb7200dbf8ed1193a8335744405c5a4dba4518983e155d3a1895ffe0360791307a352d8fcaf
7
+ data.tar.gz: b12e7f649eeee943d54e7f665a24c390bcec24a60a13e3aa7bf2edf5ac42f3b5989d51d05c543db383b63ef8f4b640796b969faf2d8175ae63bb27c32dc65708
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2017 SchrodingersBox.com
2
+ MIT License
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ [![Build Status](https://travis-ci.org/schrodingersbox/system_cat.svg?branch=master)](https://travis-ci.org/schrodingersbox/system_cat)
2
+ [![Coverage Status](https://coveralls.io/repos/schrodingersbox/system_cat/badge.png?branch=master)](https://coveralls.io/r/schrodingersbox/system_cat?branch=master)
3
+ [![Code Climate](https://codeclimate.com/github/schrodingersbox/system_cat.png)](https://codeclimate.com/github/schrodingersbox/system_cat)
4
+ [![Dependency Status](https://gemnasium.com/schrodingersbox/system_cat.png)](https://gemnasium.com/schrodingersbox/system_cat)
5
+ [![Gem Version](https://badge.fury.io/rb/system_cat.png)](http://badge.fury.io/rb/system_cat)
6
+
7
+ # schrodingersbox/system_cat
8
+
9
+
10
+
11
+
12
+ ## Reference
13
+
14
+ * [RSpec](https://github.com/rspec/rspec)
15
+ * [Rubocop](http://batsov.com/rubocop/)
16
+ * [Better Specs](http://betterspecs.org)
17
+ * [Publishing your gem](http://guides.rubygems.org/publishing/)
18
+ * [Testing Rake Tasks with RSpec](http://www.philsergi.com/2009/02/testing-rake-tasks-with-rspec.html)
19
+ * [Nathan Humbert's Blog: Rails 3: Loading rake tasks from a gem](http://blog.nathanhumbert.com/2010/02/rails-3-loading-rake-tasks-from-gem.html)
20
+ * [Add Achievement Badges to Your Gem README](http://elgalu.github.io/2013/add-achievement-badges-to-your-gem-readme/)
21
+
22
+
23
+
24
+
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+ load 'lib/tasks/system_cat.rake'
@@ -0,0 +1,45 @@
1
+ module SystemCat
2
+ class Git
3
+
4
+ def self.checkout(branch)
5
+ Shell.run("git checkout #{branch}")
6
+ end
7
+
8
+ def self.commit(message)
9
+ Shell.run(%(git commit -a -m "#{message}"))
10
+ end
11
+
12
+ def self.merge(branch)
13
+ Shell.run("git merge #{branch}")
14
+ end
15
+
16
+ def self.pull
17
+ Shell.run('git pull')
18
+ end
19
+
20
+ def self.push(remote, branch)
21
+ Shell.run("git push #{remote} #{branch}")
22
+ end
23
+
24
+ def self.stash
25
+ Shell.run('git stash')
26
+ end
27
+
28
+ def self.stash_apply
29
+ Shell.run('git stash apply')
30
+ end
31
+
32
+ def self.status
33
+ result = Shell.run('git status')
34
+
35
+ return {
36
+ branch: result[/On branch (\S+)/, 1].to_sym,
37
+ clean: !result[/(nothing to commit, working tree clean)/, 1].nil?
38
+ }
39
+ end
40
+
41
+ def self.tag(tag)
42
+ Shell.run("git tag #{tag} && git push --tags")
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,22 @@
1
+ module SystemCat
2
+ class Shell
3
+
4
+ def self.run(command, force: false, test: false)
5
+ puts '_______________________________________________________________________________'
6
+ puts command
7
+
8
+ unless test
9
+ result = `#{command}`
10
+ puts result
11
+ end
12
+
13
+ raise 'Command failed' unless exitstatus.zero? || force
14
+
15
+ return result
16
+ end
17
+
18
+ def self.exitstatus
19
+ $CHILD_STATUS.exitstatus
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,36 @@
1
+ module SystemCat
2
+ class Version
3
+
4
+ attr_accessor :code
5
+
6
+ def initialize(path = 'config/version.txt')
7
+ @path = path
8
+ @code = File.read(@path).to_i
9
+ end
10
+
11
+ def decrement
12
+ @code = code - 1
13
+ return self
14
+ end
15
+
16
+ def increment
17
+ @code = code + 1
18
+ return self
19
+ end
20
+
21
+ def save
22
+ File.open(@path, 'wb') { |io| io.write(@code) }
23
+ end
24
+
25
+ def to_s
26
+ major = (code / 100).to_i
27
+ minor = ((code % 100) / 10).to_i
28
+ build = code % 10
29
+ return "#{major}.#{minor}.#{build}"
30
+ end
31
+
32
+ def bump
33
+ return increment.save
34
+ end
35
+ end
36
+ end
data/lib/system_cat.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'require_all'
2
+ require_rel 'system_cat'
3
+
4
+ module SystemCat
5
+ end
@@ -0,0 +1,7 @@
1
+ namespace :system_cat do
2
+
3
+ desc 'Test'
4
+ task :test do
5
+ puts 'Hola dodo!'
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: system_cat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Rich Humphrey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-07-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: require_all
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 3.0.0
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '3.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 3.0.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: spec_cat
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 3.0.0
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '3.0'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 3.0.0
67
+ - !ruby/object:Gem::Dependency
68
+ name: simplecov
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: coveralls
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ description: Utilities for interacting with the shell, git, and versioning
96
+ email: rich@schrodingersbox.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - MIT-LICENSE
102
+ - README.md
103
+ - Rakefile
104
+ - lib/system_cat.rb
105
+ - lib/system_cat/git.rb
106
+ - lib/system_cat/shell.rb
107
+ - lib/system_cat/version.rb
108
+ - lib/tasks/system_cat.rake
109
+ homepage: https://github.com/schrodingersbox/system_cat
110
+ licenses:
111
+ - MIT
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.6.11
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: Random collection of system tools
133
+ test_files: []