citizen-scripts 1.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 +7 -0
- data/.document +5 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +117 -0
- data/LICENSE.txt +20 -0
- data/README.md +108 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/bin/citizen +26 -0
- data/citizen.yml +5 -0
- data/citizen_code_scripts.gemspec +90 -0
- data/lib/citizen_code_scripts/base.rb +95 -0
- data/lib/citizen_code_scripts/begin.rb +195 -0
- data/lib/citizen_code_scripts/colorize.rb +39 -0
- data/lib/citizen_code_scripts/doctor.rb +179 -0
- data/lib/citizen_code_scripts/help.rb +53 -0
- data/lib/citizen_code_scripts/heroku_doctor.rb +58 -0
- data/lib/citizen_code_scripts/kill_db_sessions.rb +22 -0
- data/lib/citizen_code_scripts/levenstein.rb +40 -0
- data/lib/citizen_code_scripts/pushit.rb +23 -0
- data/lib/citizen_code_scripts/rspec.rb +19 -0
- data/lib/citizen_code_scripts/test.rb +17 -0
- data/lib/citizen_code_scripts/todayi.rb +29 -0
- data/lib/citizen_code_scripts/update.rb +63 -0
- data/lib/citizen_code_scripts.rb +7 -0
- data/spec/passing_spec.rb +5 -0
- data/spec/spec_helper.rb +62 -0
- metadata +190 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8c89849274aefd68e883346cdb94aeb9289555c3
|
4
|
+
data.tar.gz: f155dfc38930de0349392f2b156322cb1b2b485a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e9c90258cedd73c61cf35f9cae954b4c2c7861cac6b1f343121cab2773181bf0a74a379661b494b78c162136fa7d0adad79a4eaea32fb70ce2edd710816be73f
|
7
|
+
data.tar.gz: 9bd71aeb2ac38a93e1441c42aec0f6a51a4a4acce400890117796336e3afc0f023155902164f06eb4fb4e305ef9fc2e081aef6f31b36fc6d45f299566dc7c3d1
|
data/.document
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (5.0.0.1)
|
5
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
+
i18n (~> 0.7)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
tzinfo (~> 1.1)
|
9
|
+
addressable (2.5.0)
|
10
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
11
|
+
binding_of_caller (0.7.2)
|
12
|
+
debug_inspector (>= 0.0.1)
|
13
|
+
builder (3.2.2)
|
14
|
+
coderay (1.1.1)
|
15
|
+
concurrent-ruby (1.0.2)
|
16
|
+
debug_inspector (0.0.2)
|
17
|
+
descendants_tracker (0.0.4)
|
18
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
19
|
+
diff-lcs (1.2.5)
|
20
|
+
docile (1.1.5)
|
21
|
+
faraday (0.9.2)
|
22
|
+
multipart-post (>= 1.2, < 3)
|
23
|
+
git (1.3.0)
|
24
|
+
github_api (0.11.3)
|
25
|
+
addressable (~> 2.3)
|
26
|
+
descendants_tracker (~> 0.0.1)
|
27
|
+
faraday (~> 0.8, < 0.10)
|
28
|
+
hashie (>= 1.2)
|
29
|
+
multi_json (>= 1.7.5, < 2.0)
|
30
|
+
nokogiri (~> 1.6.0)
|
31
|
+
oauth2
|
32
|
+
hashie (3.4.6)
|
33
|
+
highline (1.7.8)
|
34
|
+
i18n (0.7.0)
|
35
|
+
jeweler (2.1.2)
|
36
|
+
builder
|
37
|
+
bundler (>= 1.0)
|
38
|
+
git (>= 1.2.5)
|
39
|
+
github_api (~> 0.11.0)
|
40
|
+
highline (>= 1.6.15)
|
41
|
+
nokogiri (>= 1.5.10)
|
42
|
+
rake
|
43
|
+
rdoc
|
44
|
+
semver
|
45
|
+
json (1.8.3)
|
46
|
+
jwt (1.5.6)
|
47
|
+
method_source (0.8.2)
|
48
|
+
mini_portile2 (2.1.0)
|
49
|
+
minitest (5.9.0)
|
50
|
+
multi_json (1.12.1)
|
51
|
+
multi_xml (0.5.5)
|
52
|
+
multipart-post (2.0.0)
|
53
|
+
nokogiri (1.6.8.1)
|
54
|
+
mini_portile2 (~> 2.1.0)
|
55
|
+
oauth2 (1.2.0)
|
56
|
+
faraday (>= 0.8, < 0.10)
|
57
|
+
jwt (~> 1.0)
|
58
|
+
multi_json (~> 1.3)
|
59
|
+
multi_xml (~> 0.5)
|
60
|
+
rack (>= 1.2, < 3)
|
61
|
+
pry (0.10.3)
|
62
|
+
coderay (~> 1.1.0)
|
63
|
+
method_source (~> 0.8.1)
|
64
|
+
slop (~> 3.4)
|
65
|
+
pry-stack_explorer (0.4.9.2)
|
66
|
+
binding_of_caller (>= 0.7)
|
67
|
+
pry (>= 0.9.11)
|
68
|
+
public_suffix (2.0.4)
|
69
|
+
rack (2.0.1)
|
70
|
+
rake (11.3.0)
|
71
|
+
rdoc (3.12.2)
|
72
|
+
json (~> 1.4)
|
73
|
+
rspec (3.2.0)
|
74
|
+
rspec-core (~> 3.2.0)
|
75
|
+
rspec-expectations (~> 3.2.0)
|
76
|
+
rspec-mocks (~> 3.2.0)
|
77
|
+
rspec-core (3.2.3)
|
78
|
+
rspec-support (~> 3.2.0)
|
79
|
+
rspec-expectations (3.2.1)
|
80
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
+
rspec-support (~> 3.2.0)
|
82
|
+
rspec-mocks (3.2.1)
|
83
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
+
rspec-support (~> 3.2.0)
|
85
|
+
rspec-support (3.2.2)
|
86
|
+
semver (1.0.1)
|
87
|
+
shoulda (3.5.0)
|
88
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
89
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
90
|
+
shoulda-context (1.2.1)
|
91
|
+
shoulda-matchers (2.8.0)
|
92
|
+
activesupport (>= 3.0.0)
|
93
|
+
simplecov (0.10.0)
|
94
|
+
docile (~> 1.1.0)
|
95
|
+
json (~> 1.8)
|
96
|
+
simplecov-html (~> 0.10.0)
|
97
|
+
simplecov-html (0.10.0)
|
98
|
+
slop (3.6.0)
|
99
|
+
thread_safe (0.3.5)
|
100
|
+
tzinfo (1.2.2)
|
101
|
+
thread_safe (~> 0.1)
|
102
|
+
|
103
|
+
PLATFORMS
|
104
|
+
ruby
|
105
|
+
|
106
|
+
DEPENDENCIES
|
107
|
+
bundler (~> 1.0)
|
108
|
+
jeweler (~> 2)
|
109
|
+
pry
|
110
|
+
pry-stack_explorer
|
111
|
+
rdoc (~> 3.12)
|
112
|
+
rspec
|
113
|
+
shoulda
|
114
|
+
simplecov
|
115
|
+
|
116
|
+
BUNDLED WITH
|
117
|
+
1.13.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2016 Citizen Code, LLC
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
# citizen_code_scripts
|
2
|
+
|
3
|
+
Handy scripts for any client project.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add to your project's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'citizen_code_scripts', git: 'git@github.com:citizencode/citizen_code_scripts.git'
|
11
|
+
```
|
12
|
+
|
13
|
+
## Staging Heroku Setup
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git -rstaging
|
17
|
+
```
|
18
|
+
|
19
|
+
## Getting help
|
20
|
+
|
21
|
+
You can run `citizen help` at any time for a list of commands.
|
22
|
+
|
23
|
+
Running `citizen help [command name]` will print specific help for that
|
24
|
+
command.
|
25
|
+
|
26
|
+
## Extending/adding commands to your project
|
27
|
+
|
28
|
+
Any files in `.citizen/scripts/**/*.rb` will be automatically required
|
29
|
+
by the `citizen` command on a per-project basis. Any overrides/extensions
|
30
|
+
can be added in that directory.
|
31
|
+
|
32
|
+
## Example of adding a project-specific command
|
33
|
+
|
34
|
+
If you have a custom command you'd like to add, just put it in
|
35
|
+
`.citizen/scripts/custom_command.rb`
|
36
|
+
|
37
|
+
Each command needs to subclass `CitizenCodeScripts::Base` and implement
|
38
|
+
a `run` method.
|
39
|
+
|
40
|
+
As an example, here's how you might override the `citizen test` command to
|
41
|
+
add ESLint as a step:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
class CustomTest < CitizenCodeScripts::Test
|
45
|
+
# override the default 'test' command by naming it
|
46
|
+
# the same
|
47
|
+
def self.name
|
48
|
+
"test"
|
49
|
+
end
|
50
|
+
|
51
|
+
def run
|
52
|
+
# Other scripts can be reused by calling .run
|
53
|
+
CitizenCodeScripts::Rspec.run
|
54
|
+
|
55
|
+
# Adding a custom step to run eslint after RSpec runs
|
56
|
+
step "Running eslint" do
|
57
|
+
system! "bin/eslint"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
```
|
62
|
+
|
63
|
+
## Extending doctor
|
64
|
+
|
65
|
+
Create a file called `.citizen/scripts/doctor.rb`, and as an example:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
class Doctor < CitizenCodeScripts::Doctor
|
69
|
+
def run_checks
|
70
|
+
# Use built-in default checks, if still desired
|
71
|
+
run_default_checks
|
72
|
+
|
73
|
+
# Add a custom check
|
74
|
+
check_aws_configured
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def check_aws_configured
|
80
|
+
check(
|
81
|
+
name: "AWS env configured",
|
82
|
+
command: "cat .envrc | grep AWS_ACCESS_KEY_ID",
|
83
|
+
remedy: "cp .envrc .env # and edit"
|
84
|
+
)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
```
|
88
|
+
|
89
|
+
If you want to cherry pick some of the default checks, you'll need
|
90
|
+
to call each of their methods manually. For a list of default checks,
|
91
|
+
run `citizen doctor list`. Then, create a `.citizen/scripts/doctor.rb`
|
92
|
+
file that looks something like this:
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
class Doctor < CitizenCodeScripts::Doctor
|
96
|
+
def run_checks
|
97
|
+
# Only run these two defaults
|
98
|
+
check_envrc_file_exists
|
99
|
+
check_phantomjs_installed
|
100
|
+
|
101
|
+
# Add any custom checks here...
|
102
|
+
end
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
106
|
+
## Copyright
|
107
|
+
|
108
|
+
Copyright (c) 2016 Citizen Code. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "citizen-scripts"
|
18
|
+
gem.homepage = "http://github.com/citizencode/citizen_code_scripts"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Citizen Code command-line scripts for easy testing and deployment}
|
21
|
+
gem.description = %Q{Citizen Code tools for easy building, testing, and deploying RoR/Android/iOS apps into teh cloudz}
|
22
|
+
gem.email = "opensource@citizencode.io"
|
23
|
+
gem.authors = ["Glenn Jahnke", "Erik Hanson", "Bion Johnson", "David Balatero"]
|
24
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
25
|
+
gem.require_paths = ["lib"]
|
26
|
+
# dependencies defined in Gemfile
|
27
|
+
end
|
28
|
+
Jeweler::RubygemsDotOrgTasks.new
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
Rake::TestTask.new(:test) do |test|
|
32
|
+
test.libs << 'lib' << 'test'
|
33
|
+
test.pattern = 'test/**/test_*.rb'
|
34
|
+
test.verbose = true
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Code coverage detail"
|
38
|
+
task :simplecov do
|
39
|
+
ENV['COVERAGE'] = "true"
|
40
|
+
Rake::Task['test'].execute
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rdoc/task'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "citizen_code_scripts #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.1.0
|
data/bin/citizen
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../lib/citizen_code_scripts'
|
4
|
+
|
5
|
+
# Require any overrides or additional hooks for citizen here
|
6
|
+
Dir.glob(".citizen/scripts/**/*.rb").each do |file|
|
7
|
+
require File.expand_path(file)
|
8
|
+
end
|
9
|
+
|
10
|
+
script = ARGV.first
|
11
|
+
|
12
|
+
if ARGV.size == 0
|
13
|
+
CitizenCodeScripts::Help.run
|
14
|
+
elsif CitizenCodeScripts::Base.script_names.include?(script)
|
15
|
+
CitizenCodeScripts::Base
|
16
|
+
.scripts[script]
|
17
|
+
.run(*ARGV[1 .. -1])
|
18
|
+
else
|
19
|
+
puts "Script '#{script}' not recognized"
|
20
|
+
CitizenCodeScripts::Help.run
|
21
|
+
|
22
|
+
similar_commands = Levenstein.closest_match(script, CitizenCodeScripts::Base.script_names)
|
23
|
+
puts
|
24
|
+
puts "Did you mean #{similar_commands.map{|c|"`#{c}`"}.join(' or ')} ?"
|
25
|
+
puts
|
26
|
+
end
|
data/citizen.yml
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: citizen_code_scripts 1.0.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "citizen_code_scripts"
|
9
|
+
s.version = "1.0.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Glenn Jahnke", "Erik Hanson", "Bion Johnson", "David Balatero"]
|
14
|
+
s.date = "2016-11-10"
|
15
|
+
s.description = "Citizen Code tools for easy building, testing, and deploying RoR/Android/iOS apps into teh cloudz"
|
16
|
+
s.email = "accounts+rubygems@citizencode.io"
|
17
|
+
s.executables = ["citizen"]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE.txt",
|
20
|
+
"README.md"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".document",
|
24
|
+
".rspec",
|
25
|
+
".ruby-version",
|
26
|
+
"Gemfile",
|
27
|
+
"Gemfile.lock",
|
28
|
+
"LICENSE.txt",
|
29
|
+
"README.md",
|
30
|
+
"Rakefile",
|
31
|
+
"VERSION",
|
32
|
+
"bin/citizen",
|
33
|
+
"citizen.yml",
|
34
|
+
"citizen_code_scripts.gemspec",
|
35
|
+
"lib/citizen_code_scripts.rb",
|
36
|
+
"lib/citizen_code_scripts/base.rb",
|
37
|
+
"lib/citizen_code_scripts/begin.rb",
|
38
|
+
"lib/citizen_code_scripts/colorize.rb",
|
39
|
+
"lib/citizen_code_scripts/doctor.rb",
|
40
|
+
"lib/citizen_code_scripts/help.rb",
|
41
|
+
"lib/citizen_code_scripts/heroku_doctor.rb",
|
42
|
+
"lib/citizen_code_scripts/kill_db_sessions.rb",
|
43
|
+
"lib/citizen_code_scripts/levenstein.rb",
|
44
|
+
"lib/citizen_code_scripts/pushit.rb",
|
45
|
+
"lib/citizen_code_scripts/rspec.rb",
|
46
|
+
"lib/citizen_code_scripts/test.rb",
|
47
|
+
"lib/citizen_code_scripts/todayi.rb",
|
48
|
+
"lib/citizen_code_scripts/update.rb",
|
49
|
+
"spec/passing_spec.rb",
|
50
|
+
"spec/spec_helper.rb"
|
51
|
+
]
|
52
|
+
s.homepage = "http://github.com/citizencode/citizen_code_scripts"
|
53
|
+
s.licenses = ["MIT"]
|
54
|
+
s.rubygems_version = "2.5.1"
|
55
|
+
s.summary = "Citizen Code command-line scripts for easy testing and deployment"
|
56
|
+
|
57
|
+
if s.respond_to? :specification_version then
|
58
|
+
s.specification_version = 4
|
59
|
+
|
60
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
61
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
62
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2"])
|
63
|
+
s.add_development_dependency(%q<pry>, [">= 0"])
|
64
|
+
s.add_development_dependency(%q<pry-stack_explorer>, [">= 0"])
|
65
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
66
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
67
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
68
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
71
|
+
s.add_dependency(%q<jeweler>, ["~> 2"])
|
72
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
73
|
+
s.add_dependency(%q<pry-stack_explorer>, [">= 0"])
|
74
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
75
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
76
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
77
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
78
|
+
end
|
79
|
+
else
|
80
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
81
|
+
s.add_dependency(%q<jeweler>, ["~> 2"])
|
82
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
83
|
+
s.add_dependency(%q<pry-stack_explorer>, [">= 0"])
|
84
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
85
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
86
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
87
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
class CitizenCodeScripts::Base
|
6
|
+
include CitizenCodeScripts::Colorize
|
7
|
+
include FileUtils
|
8
|
+
|
9
|
+
attr_reader :argv
|
10
|
+
|
11
|
+
def initialize(*argv)
|
12
|
+
@argv = argv
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.name
|
16
|
+
self
|
17
|
+
.to_s
|
18
|
+
.split('::')
|
19
|
+
.last
|
20
|
+
.gsub(/[A-Z]/, "-\\0")
|
21
|
+
.downcase[1..-1]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.inherited(klass)
|
25
|
+
CitizenCodeScripts::Base.script_classes << klass
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.script_classes
|
29
|
+
@script_classes ||= []
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.scripts
|
33
|
+
@scripts ||= load_scripts_deferred
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.load_scripts_deferred
|
37
|
+
script_classes.reduce(Hash.new) do |result, klass|
|
38
|
+
result[klass.name] = klass
|
39
|
+
result
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.script_names
|
44
|
+
scripts.keys
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.help
|
48
|
+
msg = <<-HELP
|
49
|
+
Help has not been implemented for "#{name}". Please implement a help method like so:
|
50
|
+
|
51
|
+
class #{self} < CitizenCodeScripts::Base
|
52
|
+
def self.help
|
53
|
+
<<-EOF
|
54
|
+
My awesome help message here.
|
55
|
+
|
56
|
+
This will be so useful for people.
|
57
|
+
EOF
|
58
|
+
end
|
59
|
+
end
|
60
|
+
HELP
|
61
|
+
|
62
|
+
puts msg
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.description
|
66
|
+
""
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.run(*args)
|
70
|
+
new(*args).run
|
71
|
+
end
|
72
|
+
|
73
|
+
# path to your application root.
|
74
|
+
def app_root
|
75
|
+
Pathname.new(Dir.pwd)
|
76
|
+
end
|
77
|
+
|
78
|
+
def system!(*args)
|
79
|
+
puts colorize(:command, args.join(" "))
|
80
|
+
system(*args) || abort(colorize(:error, "\n== Command #{args} failed =="))
|
81
|
+
end
|
82
|
+
|
83
|
+
def step(name)
|
84
|
+
puts colorize(:info, "\n== #{name} ==")
|
85
|
+
yield
|
86
|
+
end
|
87
|
+
|
88
|
+
def app_names
|
89
|
+
YAML.load_file('citizen.yml')['heroku_app_names']
|
90
|
+
end
|
91
|
+
|
92
|
+
def staging_app_name
|
93
|
+
app_names['staging']
|
94
|
+
end
|
95
|
+
end
|