macdiff 0.0.3
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 +7 -0
- data/.github/workflows/main.yml +18 -0
- data/.gitignore +46 -0
- data/.rspec +3 -0
- data/.rubocop.yml +45 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +19 -0
- data/Guardfile +23 -0
- data/LICENSE.txt +21 -0
- data/README.md +69 -0
- data/Rakefile +33 -0
- data/b/a1.txt +0 -0
- data/b/b1.txt +0 -0
- data/b/c/e.txt +0 -0
- data/b/c1.txt +1 -0
- data/b/x/e.txt +0 -0
- data/b/x/g.txt +1 -0
- data/b/x/h.txt +0 -0
- data/bin/console +16 -0
- data/bin/k +36 -0
- data/bin/kgitsync +76 -0
- data/bin/khotfix +244 -0
- data/bin/setup +11 -0
- data/exe/macdiff +18 -0
- data/ext/macdiff/extconf.rb +5 -0
- data/ext/macdiff/macdiff.c +9 -0
- data/ext/macdiff/macdiff.h +6 -0
- data/hooks/pre-commit +87 -0
- data/hooks/update-version +21 -0
- data/lib/macdiff/app.rb +24 -0
- data/lib/macdiff/cli.rb +21 -0
- data/lib/macdiff/command.rb +243 -0
- data/lib/macdiff/commands/.keep +1 -0
- data/lib/macdiff/diff_folder.rb +66 -0
- data/lib/macdiff/templates/.keep +1 -0
- data/lib/macdiff/version.rb +5 -0
- data/lib/macdiff.rb +9 -0
- data/macdiff.gemspec +60 -0
- metadata +129 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7d92e886240c8184d1cbd331e650c996f270ec946da65e9bf5cfc35669a6d6bf
|
|
4
|
+
data.tar.gz: 51560b7a3b99e8774b114e95cebb672404a21d648173b73d182c04788cc9bf94
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7dbd96852965a128b5da30440bacb55792575ea35876b5af3a8511c1aded16ca0f4614c32479bf6890dc2544ab403d0abb73309fa3d47ddbc20bb2b969e2fe52
|
|
7
|
+
data.tar.gz: 8fccb11846231e02f9c59b8b362c3ed292dc6fc75c4f052bc2a0dc320d7f5985680333d1368a1c706b47683ad4b5d1fc584221bb6f97cc0c29f1fb362e77d2a6
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Ruby
|
|
2
|
+
|
|
3
|
+
on: [push,pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v2
|
|
10
|
+
- name: Set up Ruby
|
|
11
|
+
uses: ruby/setup-ruby@v1
|
|
12
|
+
with:
|
|
13
|
+
ruby-version: 2.7.1
|
|
14
|
+
- name: Run the default task
|
|
15
|
+
run: |
|
|
16
|
+
gem install bundler -v 2.2.7
|
|
17
|
+
bundle install
|
|
18
|
+
bundle exec rake
|
data/.gitignore
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Move this into a KLUE SATELITE DOCUMENT
|
|
2
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
|
3
|
+
#
|
|
4
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
|
5
|
+
# or operating system, you probably want to add a global ignore instead:
|
|
6
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
|
7
|
+
#
|
|
8
|
+
# The Octocat has a Gist containing some good rules to add to this file.
|
|
9
|
+
# https://gist.github.com/octocat/9257657
|
|
10
|
+
|
|
11
|
+
# Ignore Klue Setup.sh
|
|
12
|
+
/bin/runonce/
|
|
13
|
+
macdiff.yml
|
|
14
|
+
|
|
15
|
+
/.bundle/
|
|
16
|
+
/.history/
|
|
17
|
+
/.yardoc
|
|
18
|
+
/_yardoc/
|
|
19
|
+
/coverage/
|
|
20
|
+
/log/
|
|
21
|
+
!/log/.keep
|
|
22
|
+
/doc/
|
|
23
|
+
/pkg/
|
|
24
|
+
/spec/reports/
|
|
25
|
+
/tmp/
|
|
26
|
+
!/tmp/.keep
|
|
27
|
+
*.bundle
|
|
28
|
+
*.so
|
|
29
|
+
*.o
|
|
30
|
+
*.a
|
|
31
|
+
mkmf.log
|
|
32
|
+
|
|
33
|
+
# Ruby Version
|
|
34
|
+
.ruby-version
|
|
35
|
+
|
|
36
|
+
# Environment File
|
|
37
|
+
.env
|
|
38
|
+
|
|
39
|
+
# Gems should not use a Gemfile.lock
|
|
40
|
+
Gemfile.lock
|
|
41
|
+
|
|
42
|
+
# rspec failure tracking
|
|
43
|
+
.rspec_status
|
|
44
|
+
|
|
45
|
+
# ByeBug history
|
|
46
|
+
.byebug_history
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
DisplayCopNames: true
|
|
3
|
+
ExtraDetails: true
|
|
4
|
+
|
|
5
|
+
Metrics/BlockLength:
|
|
6
|
+
Exclude:
|
|
7
|
+
- "**/spec/*"
|
|
8
|
+
ExcludedMethods:
|
|
9
|
+
- configure
|
|
10
|
+
- context
|
|
11
|
+
- define
|
|
12
|
+
- describe
|
|
13
|
+
- draw
|
|
14
|
+
- factory
|
|
15
|
+
- feature
|
|
16
|
+
- guard
|
|
17
|
+
- included
|
|
18
|
+
- it
|
|
19
|
+
- let
|
|
20
|
+
- let!
|
|
21
|
+
- scenario
|
|
22
|
+
- setup
|
|
23
|
+
- shared_context
|
|
24
|
+
- shared_examples
|
|
25
|
+
- shared_examples_for
|
|
26
|
+
- transaction
|
|
27
|
+
|
|
28
|
+
Metrics/MethodLength:
|
|
29
|
+
Max: 25
|
|
30
|
+
|
|
31
|
+
Layout/LineLength:
|
|
32
|
+
Max: 200
|
|
33
|
+
# Ignores annotate output
|
|
34
|
+
IgnoredPatterns: ['\A# \*\*']
|
|
35
|
+
IgnoreCopDirectives: true
|
|
36
|
+
|
|
37
|
+
Lint/UnusedMethodArgument:
|
|
38
|
+
AllowUnusedKeywordArguments: true
|
|
39
|
+
|
|
40
|
+
Style/BlockComments:
|
|
41
|
+
Enabled: false
|
|
42
|
+
Include:
|
|
43
|
+
- "**/spec/*"
|
|
44
|
+
|
|
45
|
+
# inherit_from: .rubocop_todo.yml
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
- Using welcoming and inclusive language
|
|
18
|
+
- Being respectful of differing viewpoints and experiences
|
|
19
|
+
- Gracefully accepting constructive criticism
|
|
20
|
+
- Focusing on what is best for the community
|
|
21
|
+
- Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
- The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
- Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
- Public or private harassment
|
|
29
|
+
- Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at david.cruwys@bugcrowd.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
|
+
|
|
5
|
+
# Specify your gem's dependencies in poc_github_ap.gemspec
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
group :development, :test do
|
|
9
|
+
gem 'guard-bundler'
|
|
10
|
+
gem 'guard-rspec'
|
|
11
|
+
# pry on steroids
|
|
12
|
+
gem 'pry-coolline', github: 'owst/pry-coolline', branch: 'support_new_pry_config_api'
|
|
13
|
+
gem 'jazz_fingers'
|
|
14
|
+
gem 'rake', '~> 12.0'
|
|
15
|
+
# this is used for cmdlets 'self-executing gems'
|
|
16
|
+
gem 'rake-compiler'
|
|
17
|
+
gem 'rspec', '~> 3.0'
|
|
18
|
+
gem 'rubocop'
|
|
19
|
+
end
|
data/Guardfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
guard :bundler, cmd: 'bundle install' do
|
|
4
|
+
watch('Gemfile')
|
|
5
|
+
watch('macdiff.gemspec')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
guard :rspec, cmd: 'bundle exec rspec -f doc' do
|
|
9
|
+
require 'guard/rspec/dsl'
|
|
10
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
|
11
|
+
|
|
12
|
+
# RSpec files
|
|
13
|
+
rspec = dsl.rspec
|
|
14
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
|
15
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
|
16
|
+
watch(rspec.spec_files)
|
|
17
|
+
|
|
18
|
+
# Ruby files
|
|
19
|
+
ruby = dsl.ruby
|
|
20
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
|
21
|
+
watch(%r{^lib/macdiff/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
|
|
22
|
+
watch(%r{^lib/macdiff/commands/(.+)\.rb$}) { |m| "spec/unit/commands/#{m[1]}_spec.rb" }
|
|
23
|
+
end
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 David
|
|
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,69 @@
|
|
|
1
|
+
# Macdiff
|
|
2
|
+
|
|
3
|
+
> MacDiff is a command line tool for visualizing folder differences using the MAC diff command
|
|
4
|
+
|
|
5
|
+
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/macdiff`.
|
|
6
|
+
|
|
7
|
+
When using the source code for this gem, start by running `bin/setup` to install locally or `bundle install`
|
|
8
|
+
|
|
9
|
+
To experiment with that code, run `bin/console` for an interactive prompt or run `exe/macdiff` to see a list of commands.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Add this line to your application's Gemfile:
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
gem 'macdiff'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
And then execute:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bundle install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or install it yourself as:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
gem install macdiff
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Stories
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
As a Commandline user, I should be able to easily run file compares with pretty format, so that I can see what files/folders are different
|
|
35
|
+
|
|
36
|
+
- Create new commandline tool
|
|
37
|
+
- Setup deployment pipeline
|
|
38
|
+
- Setup guard and unit tests
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
As a XX, I should be able to , so that I
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
TODO: Write usage instructions here
|
|
48
|
+
|
|
49
|
+
## Development
|
|
50
|
+
|
|
51
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
52
|
+
|
|
53
|
+
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`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
54
|
+
|
|
55
|
+
## Contributing
|
|
56
|
+
|
|
57
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/macdiff. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
62
|
+
|
|
63
|
+
## Code of Conduct
|
|
64
|
+
|
|
65
|
+
Everyone interacting in the Macdiff project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/macdiff/blob/master/CODE_OF_CONDUCT.md).
|
|
66
|
+
|
|
67
|
+
## Copyright
|
|
68
|
+
|
|
69
|
+
Copyright (c) David. See [MIT License](LICENSE.txt) for further details.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
GEM_NAME = 'macdiff'
|
|
4
|
+
|
|
5
|
+
require 'bundler/gem_tasks'
|
|
6
|
+
require 'rspec/core/rake_task'
|
|
7
|
+
require 'macdiff/version'
|
|
8
|
+
|
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
10
|
+
|
|
11
|
+
require 'rake/extensiontask'
|
|
12
|
+
|
|
13
|
+
task build: :compile
|
|
14
|
+
|
|
15
|
+
Rake::ExtensionTask.new('macdiff') do |ext|
|
|
16
|
+
ext.lib_dir = 'lib/macdiff'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
task default: %i[clobber compile spec]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
desc 'Publish the gem to RubyGems.org'
|
|
23
|
+
task :publish do
|
|
24
|
+
system 'gem build'
|
|
25
|
+
system "gem push #{GEM_NAME}-#{Macdiff::VERSION}.gem"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
desc 'Remove old *.gem files'
|
|
29
|
+
task :clean do
|
|
30
|
+
system 'rm *.gem'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
task default: %i[clobber compile spec]
|
data/b/a1.txt
ADDED
|
File without changes
|
data/b/b1.txt
ADDED
|
File without changes
|
data/b/c/e.txt
ADDED
|
File without changes
|
data/b/c1.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
diff
|
data/b/x/e.txt
ADDED
|
File without changes
|
data/b/x/g.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bbbb
|
data/b/x/h.txt
ADDED
|
File without changes
|
data/bin/console
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
require 'bundler/setup'
|
|
6
|
+
require 'macdiff'
|
|
7
|
+
|
|
8
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
9
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
10
|
+
|
|
11
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
12
|
+
# require 'pry'
|
|
13
|
+
# Pry.start
|
|
14
|
+
|
|
15
|
+
require 'irb'
|
|
16
|
+
IRB.start(__FILE__)
|
data/bin/k
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# NOTE: you may need change file permissions
|
|
5
|
+
# chmod +x bin/k
|
|
6
|
+
|
|
7
|
+
help = %(
|
|
8
|
+
----------------------------------------------------------------------
|
|
9
|
+
Klue Scripts - Help
|
|
10
|
+
----------------------------------------------------------------------
|
|
11
|
+
k - This Help File
|
|
12
|
+
|
|
13
|
+
khotfix - Create Hot Fix
|
|
14
|
+
Hot fixes are created in GIT and versioned correctly.
|
|
15
|
+
The patch # will increment by 1.
|
|
16
|
+
e.g. v0.1.1 will become v0.1.2
|
|
17
|
+
The version.rb file will also store the current version.
|
|
18
|
+
usage:
|
|
19
|
+
khotfix 'name of my cool hotfix'
|
|
20
|
+
|
|
21
|
+
kgitsync - Syncronize the master and development git repositories
|
|
22
|
+
Pulls latest code, pushes current changes
|
|
23
|
+
usage:
|
|
24
|
+
kgitsync
|
|
25
|
+
|
|
26
|
+
----------------------------------------------------------------------
|
|
27
|
+
Rake Tasks
|
|
28
|
+
----------------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
rails db:seed - load seed data
|
|
31
|
+
|
|
32
|
+
rails db:seed sample=true - load sample data, useful in developer environments
|
|
33
|
+
|
|
34
|
+
rails db:seed reset=true - reset database
|
|
35
|
+
)
|
|
36
|
+
puts help
|
data/bin/kgitsync
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
#NOTE: you may need change file permissions
|
|
4
|
+
# chmod +x bin/kgitsync
|
|
5
|
+
|
|
6
|
+
# Set up colour support, if we have it
|
|
7
|
+
# Are stdout and stderr both connected to a terminal
|
|
8
|
+
# If not then don't set colours
|
|
9
|
+
if [ -t 1 -a -t 2 ]
|
|
10
|
+
then
|
|
11
|
+
if tput -V >/dev/null 2>&1
|
|
12
|
+
then
|
|
13
|
+
C_RED=`tput setaf 1`
|
|
14
|
+
C_GREEN=`tput setaf 2`
|
|
15
|
+
C_BROWN=`tput setaf 3`
|
|
16
|
+
C_BLUE=`tput setaf 4`
|
|
17
|
+
C_RESET=`tput sgr0`
|
|
18
|
+
fi
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exit_error ()
|
|
23
|
+
{
|
|
24
|
+
# dont display if string is zero length
|
|
25
|
+
[ -z "$1" ] || echo "${C_RED}Error: ${C_BROWN} $1 ${C_RESET}"
|
|
26
|
+
exit 1
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# make sure we are in a git tree
|
|
31
|
+
[ "`git rev-parse --is-inside-work-tree`" = "true" ] || exit_error "NOT a git repository"
|
|
32
|
+
echo "Repository check OK"
|
|
33
|
+
|
|
34
|
+
CURRENT_BRANCH=`git branch | awk '/^\*/{print $2}'`
|
|
35
|
+
|
|
36
|
+
# check that we are on develop or master
|
|
37
|
+
#[ "${CURRENT_BRANCH}" = "master" -o "${CURRENT_BRANCH}" = "develop" ] || exit_error "You MUST be on either the master or development branch"
|
|
38
|
+
#echo "Branch check OK"
|
|
39
|
+
|
|
40
|
+
# check that the current branch is clean
|
|
41
|
+
[ -z "`git status --porcelain`" ] || exit_error "Working copy has uncommitted changes"
|
|
42
|
+
echo "Working copy is clean OK"
|
|
43
|
+
|
|
44
|
+
# fetch from origin
|
|
45
|
+
git fetch origin || exit_error "Failed to fetch from origin"
|
|
46
|
+
|
|
47
|
+
######################
|
|
48
|
+
# Do develop
|
|
49
|
+
######################
|
|
50
|
+
git checkout develop || exit_error "Failed to checkout develop branch"
|
|
51
|
+
echo "Switched to develop"
|
|
52
|
+
git merge origin/develop || exit_error "Failed to merge develop from origin"
|
|
53
|
+
echo "Develop branch upto date"
|
|
54
|
+
git push || exit_error "Failed to push develop to origin"
|
|
55
|
+
echo "Develop pushed to origin"
|
|
56
|
+
|
|
57
|
+
######################
|
|
58
|
+
# Do master
|
|
59
|
+
######################
|
|
60
|
+
git checkout master || exit_error "Failed to checkout master branch"
|
|
61
|
+
echo "Switched to master"
|
|
62
|
+
git merge origin/master || exit_error "Failed to merge master from origin"
|
|
63
|
+
echo "Master branch upto date"
|
|
64
|
+
git push || exit_error "Failed to push master to origin"
|
|
65
|
+
echo "Master pushed to origin"
|
|
66
|
+
|
|
67
|
+
######################
|
|
68
|
+
# Do tags
|
|
69
|
+
######################
|
|
70
|
+
git push --tags || exit_error "Failed to push tags to origin"
|
|
71
|
+
echo "Tags pushed to origin"
|
|
72
|
+
|
|
73
|
+
# return to the current branch
|
|
74
|
+
git checkout ${CURRENT_BRANCH} || exit_error "Failed to return to your origional branch ${CURRENT_BRANCH}"
|
|
75
|
+
|
|
76
|
+
echo "${C_GREEN}Done. you are on ${CURRENT_BRANCH}${C_RESET}"
|