zewo-dev 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b1fce2b95a2225f242cf7a04a289bc52f9f658a4
4
+ data.tar.gz: 185fef6e048f6e6eaf6a0b256b19fcb4becea201
5
+ SHA512:
6
+ metadata.gz: c1b89e01a06efaa73a4919648d0a86e77385f3c9a2ddad2107fa35953080852211d37e23d5c05cd4292a9ccb7cf7486f32e9c78627ffeee076cbd939f10ed191
7
+ data.tar.gz: 84c117c5ff55372ee4e87aab088b80a811046a1a84cb8a50febfdabfeb3339623dbb601dde38c28041d02695a2f03e1c8e6d2af503c95e18279809d39d9cfdf8
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
@@ -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, ethnicity, 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 zewo.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 David Ask
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/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "zewo"
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/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/zewo ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby -wU
2
+
3
+ require 'zewo'
4
+
5
+ $VERBOSE = nil
6
+
7
+ Zewo::App.start(ARGV)
8
+
@@ -0,0 +1,3 @@
1
+ module Zewo
2
+ VERSION = "0.1.0"
3
+ end
data/lib/zewo.rb ADDED
@@ -0,0 +1,160 @@
1
+ require "zewo/version"
2
+
3
+ require 'thor'
4
+ require 'rubygems'
5
+ require 'json'
6
+ require 'net/http'
7
+ require 'uri'
8
+ require 'fileutils'
9
+ require 'pathname'
10
+ require 'xcodeproj'
11
+ require 'colorize'
12
+
13
+
14
+
15
+ module Zewo
16
+ class App < Thor
17
+
18
+ class Repo
19
+ attr_reader :name
20
+ @name = nil
21
+ attr_reader :data
22
+ @data = nil
23
+
24
+ def initialize(name, data)
25
+ @name = name
26
+ @data = data
27
+ end
28
+ end
29
+
30
+ no_commands do
31
+ def each_repo
32
+ uri = URI.parse('https://api.github.com/orgs/ZewoFlux/repos?per_page=200')
33
+
34
+ http = Net::HTTP.new(uri.host, uri.port)
35
+ http.use_ssl = true
36
+ request = Net::HTTP::Get.new(uri.request_uri)
37
+
38
+ response = http.request(request)
39
+
40
+ if response.code == '200'
41
+ result = JSON.parse(response.body)
42
+
43
+ result.each do |doc|
44
+ repo = Repo.new(doc['name'], doc)
45
+ yield repo
46
+ end
47
+ else
48
+ puts 'Error loading repositories'
49
+ end
50
+ end
51
+
52
+ def prompt(question)
53
+ printf "#{question} - press 'y' to continue: "
54
+ p = STDIN.gets.chomp
55
+ if p == 'y'
56
+ true
57
+ else
58
+ puts 'Aborting..'
59
+ false
60
+ end
61
+ end
62
+
63
+ def uncommited_changes?(repo_name)
64
+ !system("cd #{repo_name}; git diff --exit-code --quiet")
65
+ end
66
+
67
+ def master_branch?(repo_name)
68
+ name = `cd #{repo_name}; git rev-parse --abbrev-ref HEAD`
69
+ end
70
+ end
71
+
72
+ desc :status, 'Intialize'
73
+ def status
74
+ each_repo do |repo|
75
+ str = repo.name
76
+ if uncommited_changes?(repo.name)
77
+ str = str.red
78
+ else
79
+ str = str.green
80
+ end
81
+
82
+ tag = `cd #{repo.name}; git describe --abbrev=0 --tags` || 'No tag'
83
+ str += " (#{tag})"
84
+ puts str.gsub("\n", '')
85
+ end
86
+ end
87
+
88
+ desc :pull, 'git pull on all repos'
89
+ def pull
90
+ each_repo do |repo|
91
+ puts "Updating #{repo.name}...".green
92
+ if uncommited_changes?(repo.name)
93
+ puts "Uncommitted changes in #{repo.name}. Not updating.".red
94
+ next
95
+ end
96
+ system("cd #{repo.name}; git pull")
97
+ end
98
+ end
99
+
100
+ desc :push, 'git push on all repos'
101
+ def push
102
+ each_repo do |repo|
103
+ if uncommited_changes?(repo.name)
104
+ puts "Uncommitted changes in #{repo.name}. Skipping.."
105
+ next
106
+ end
107
+ puts "Pushing #{repo.name}...".green
108
+ system("cd #{repo.name}; git push")
109
+ end
110
+ end
111
+
112
+ desc :init, 'Clones all Zewo repositories'
113
+ def init
114
+ each_repo do |repo|
115
+ unless File.directory?(repo.name)
116
+ puts "Cloning #{repo.name}...".green
117
+ system("git clone #{repo.data['ssh_url']} > /dev/null 2>&1")
118
+ end
119
+ end
120
+ end
121
+
122
+ desc :build, 'Clones all Zewo repositories'
123
+ def build
124
+ each_repo do |repo|
125
+ puts "Building #{repo.name}...".green
126
+
127
+ if system("cd #{repo.name}/Xcode; set -o pipefail && xcodebuild -scheme \"#{repo.name}\" -sdk \"macosx\" -toolchain /Library/Developer/Toolchains/swift-latest.xctoolchain | xcpretty") == false
128
+ puts "Error building. Maybe you're using the wrong Xcode? Try `sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer` if you have a beta-version of Xcode installed.".red
129
+
130
+ end
131
+ end
132
+ end
133
+
134
+ desc 'commit MESSAGE', 'Commits changes to all repos with the same commit message'
135
+ def commit(message)
136
+
137
+ each_repo do |repo|
138
+ next unless uncommited_changes?(repo.name)
139
+ puts repo.name
140
+ puts '--------------------------------------------------------------'
141
+ if uncommited_changes?(repo.name)
142
+ puts 'Status:'.yellow
143
+ system("cd #{repo.name}; git status")
144
+ return unless prompt("Proceed with #{repo.name}?")
145
+ puts 'Diff (press q to exit):'.yellow
146
+ system("cd #{repo.name}; git diff")
147
+ end
148
+
149
+ puts "Warning. You're not in the master branch".yellow unless master_branch?(repo.name)
150
+ puts "\n"
151
+
152
+ return unless prompt('Changes look ok?')
153
+ system("cd #{repo.name}; git add --all; git commit -am #{message}")
154
+ puts "Commited #{repo.name}\n".green
155
+
156
+ end
157
+ self.push if prompt('Push changes?')
158
+ end
159
+ end
160
+ end
data/zewo.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'zewo/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "zewo-dev"
8
+ spec.version = Zewo::VERSION
9
+ spec.authors = ["David Ask"]
10
+ spec.email = ["david@formbound.com"]
11
+
12
+ spec.summary = %q{Summary}
13
+ spec.description = %q{Description}
14
+ spec.homepage = "http://github.com/Zewo"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "xcodeproj", "~> 0.28"
22
+ spec.add_dependency "thor", "~> 0.19"
23
+ spec.add_dependency "xcpretty", "~> 0.2"
24
+ spec.add_dependency "colorize"
25
+
26
+
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.10"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zewo-dev
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - David Ask
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: xcodeproj
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.28'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.28'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.19'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.19'
41
+ - !ruby/object:Gem::Dependency
42
+ name: xcpretty
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: colorize
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
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: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.10'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.10'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ description: Description
98
+ email:
99
+ - david@formbound.com
100
+ executables:
101
+ - console
102
+ - setup
103
+ - zewo
104
+ extensions: []
105
+ extra_rdoc_files: []
106
+ files:
107
+ - ".gitignore"
108
+ - ".travis.yml"
109
+ - CODE_OF_CONDUCT.md
110
+ - Gemfile
111
+ - LICENSE.txt
112
+ - Rakefile
113
+ - bin/console
114
+ - bin/setup
115
+ - bin/zewo
116
+ - lib/zewo.rb
117
+ - lib/zewo/version.rb
118
+ - zewo.gemspec
119
+ homepage: http://github.com/Zewo
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 2.4.8
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: Summary
143
+ test_files: []