git-plan 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1235d1cde3fc70d97339e999d0bcfe7f054336fd
4
+ data.tar.gz: 2cd2460bcbc32250ccecd990b567bd7290a87404
5
+ SHA512:
6
+ metadata.gz: 156a986f67495b89ce3371e35095220fcade7f6aff4bea363e71a4a7da8fa2ca2d31f158ebd25a003de448e0a273d86344a69f7767422a4c7ced713454503ca0
7
+ data.tar.gz: 1745fb0143eaf7a43b64bb2233ce3cb8e607a8fd745f782bf05ad0d5cbb2e78d587357f06bd469a49ee74074ee833173ab5c7c34503144c51abda4f813bd7c05
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 DilumN
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.
@@ -0,0 +1,41 @@
1
+ # Git::Plan
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/git/plan`. 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 'git-plan'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install git-plan
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 `rake spec` to run the tests. You can also 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`, 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/git-plan. 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.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Trap interrupts to quit cleanly. See
4
+ Signal.trap('INT') { abort }
5
+
6
+ require 'git/plan'
7
+
8
+ begin
9
+ Git::Plan::CLI.start(ARGV)
10
+ rescue Interrupt
11
+ pute 'Quitting...'
12
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'git/plan/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "git-plan"
8
+ spec.version = Git::Plan::VERSION
9
+ spec.authors = ["DilumN"]
10
+ spec.email = ["dilumnavanjana@gmail.com"]
11
+
12
+ spec.summary = %q{Plan your batch of Git commands}
13
+ spec.description = %q{Configure set of git commands to run at the same time}
14
+ spec.homepage = "http://dilumn.github.io"
15
+ spec.license = "MIT"
16
+
17
+
18
+ spec.files = %w(LICENSE.txt README.md git-plan.gemspec) + Dir['bin/*'] + Dir['lib/**/*.rb']
19
+ spec.executables = Dir['bin/*'].map { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_dependency 'thor', ['>= 0.19.1', '< 2']
26
+ spec.add_dependency 'pry', '~> 0.10'
27
+ end
@@ -0,0 +1,8 @@
1
+ require "git/plan/version"
2
+ require "git/plan/cli"
3
+
4
+ module Git
5
+ module Plan
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,37 @@
1
+ require 'thor'
2
+ require 'pry'
3
+ require "git/plan/configfile"
4
+
5
+ module Git
6
+ module Plan
7
+ class CLI < Thor
8
+
9
+ def initialize(*)
10
+ @cfile = Git::Plan::ConfigFile.instance
11
+ super
12
+ end
13
+
14
+ desc 'add', 'add commands to use later by batch'
15
+ def add(command, group)
16
+ hash = {command => group}
17
+ @cfile.add_command(hash)
18
+ end
19
+
20
+ desc 'r', 'run set of git commands configured before'
21
+ def r(command, variables)
22
+ variable_count = 0
23
+ group = @cfile.run(command).split(',')
24
+ variables = variables.split(',')
25
+ group.each { |value|
26
+ if value.include? "#"
27
+ value.gsub! '#', variables[variable_count]
28
+ variable_count += 1
29
+ binding.pry
30
+ end
31
+ system "bash", "-c", value
32
+ }
33
+ end
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,61 @@
1
+ require 'singleton'
2
+ require 'pry'
3
+
4
+ module Git
5
+ module Plan
6
+ class ConfigFile
7
+ include Singleton
8
+ attr_reader :path
9
+ FILE_NAME = '.gitpath'.freeze
10
+
11
+ def initialize
12
+ @path = File.join(File.expand_path('~'), FILE_NAME)
13
+ @data = load_file
14
+ end
15
+
16
+ def add_command(hash)
17
+ @data['commands'].merge!(hash)
18
+ write
19
+ end
20
+
21
+ def run(command)
22
+ @data['commands'][command]
23
+ end
24
+
25
+ def delete
26
+ File.delete(@path) if File.exist?(@path)
27
+ end
28
+
29
+ def empty?
30
+ @data == default_structure
31
+ end
32
+
33
+ def load_file
34
+ require 'yaml'
35
+ YAML.load_file(@path)
36
+ rescue Errno::ENOENT
37
+ default_structure
38
+ end
39
+
40
+ def path=(path)
41
+ @path = path
42
+ @data = load_file
43
+ @path
44
+ end
45
+
46
+
47
+ private
48
+
49
+ def write
50
+ require 'yaml'
51
+ File.open(@path, File::RDWR | File::TRUNC | File::CREAT, 0o0600) do |cfile|
52
+ cfile.write @data.to_yaml
53
+ end
54
+ end
55
+
56
+ def default_structure
57
+ {'commands' => {}}
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,5 @@
1
+ module Git
2
+ module Plan
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-plan
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - DilumN
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-17 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.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.19.1
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: '2'
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 0.19.1
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '2'
75
+ - !ruby/object:Gem::Dependency
76
+ name: pry
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.10'
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.10'
89
+ description: Configure set of git commands to run at the same time
90
+ email:
91
+ - dilumnavanjana@gmail.com
92
+ executables:
93
+ - plan
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - LICENSE.txt
98
+ - README.md
99
+ - bin/plan
100
+ - git-plan.gemspec
101
+ - lib/git/plan.rb
102
+ - lib/git/plan/cli.rb
103
+ - lib/git/plan/configfile.rb
104
+ - lib/git/plan/version.rb
105
+ homepage: http://dilumn.github.io
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.5.1
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Plan your batch of Git commands
129
+ test_files: []