cide 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5a4fe8da41d9c191605ec959cf7c333cf14f170
4
- data.tar.gz: b62108bf438c8cbc65ae418014bec5a6f572362f
3
+ metadata.gz: f7abefe36a37940197b6aadd1fcb7df51562fde0
4
+ data.tar.gz: 5a4c14225d5fa5a7a3331c2c4eede54f0a1ad661
5
5
  SHA512:
6
- metadata.gz: 23171d6c97f0b00a3dcbb9931a098f276c15784e985fe4f05dd6a45013a464fbede08752cbf2d700139d251188cde6cd6361d288a5b338facff86206742627d3
7
- data.tar.gz: 882a92b8e9e3b3b0905f5c22e6889c42040191757f770bbe47dc7e349330895efebf12fb78ea81d4a3bebce363e38fd9cd280dcc51da38ca9deb117ed51139d6
6
+ metadata.gz: 6610a43e9ed60f4f8e2addfdf7ae204b82ef082971b1555e333d69e88afb51ebcb8a04b576b080cbb3172dc7215613a48d8e2bb17e2f62fc7e0e47b544984bd6
7
+ data.tar.gz: 4f294c94689281c3195997dd036c0f1ca66a63b5f05e489e3d99cef09539d035d6197391d23975ace077cde710f7558a7ea5ca0be3d9ce4398508f7f4521863e
data/.gitignore CHANGED
@@ -1 +1,4 @@
1
1
  *.gem
2
+ man/*.1
3
+ man/*.css
4
+ man/*.html
data/.nojekyll ADDED
File without changes
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ 0.5.0 / 2015-06-19
3
+ ==================
4
+
5
+ * NEW: man pages and doc !
6
+ * CHANGE: config file is `cide.yml` instead of `.cide.yml`
7
+
2
8
  0.4.1 / 2015-06-02
3
9
  ==================
4
10
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cide (0.4.1)
4
+ cide (0.5.0)
5
5
  thor (~> 0.19)
6
6
  virtus (~> 1.0)
7
7
 
@@ -21,6 +21,8 @@ GEM
21
21
  descendants_tracker (~> 0.0.4)
22
22
  ice_nine (~> 0.11.0)
23
23
  thread_safe (~> 0.3, >= 0.3.1)
24
+ binman (4.0.0)
25
+ opener (>= 0.1.0, < 1)
24
26
  coercible (1.0.0)
25
27
  descendants_tracker (~> 0.0.1)
26
28
  descendants_tracker (0.0.4)
@@ -30,12 +32,17 @@ GEM
30
32
  i18n (0.7.0)
31
33
  ice_nine (0.11.1)
32
34
  json (1.8.1)
35
+ md2man (4.0.0)
36
+ binman (~> 4.0)
37
+ redcarpet (~> 3.0)
33
38
  minitest (5.4.3)
39
+ opener (0.1.0)
34
40
  parser (2.2.0.3)
35
41
  ast (>= 1.1, < 3.0)
36
42
  powerpack (0.1.0)
37
43
  rainbow (2.0.0)
38
44
  rake (10.4.2)
45
+ redcarpet (3.3.1)
39
46
  rspec (3.2.0)
40
47
  rspec-core (~> 3.2.0)
41
48
  rspec-expectations (~> 3.2.0)
@@ -72,6 +79,10 @@ PLATFORMS
72
79
  DEPENDENCIES
73
80
  activesupport
74
81
  cide!
82
+ md2man
75
83
  rake
76
84
  rspec
77
85
  rubocop
86
+
87
+ BUNDLED WITH
88
+ 1.10.3
File without changes
data/README.md CHANGED
@@ -1,21 +1,21 @@
1
- *cide* - Continuous Integration Docker Environment
2
- ================================================
1
+ *cide* - Isolated test runner with Docker
2
+ =========================================
3
3
 
4
4
  *cide* is a command-line tool that runs tests in an isolated (docker)
5
5
  environment. It solves a problem where Jenkins workers need all the project's
6
6
  dependencies (possibly conflicting) to be installed on the boxes. With *cide*
7
7
  each run gets it's own set of temporary docker containers which are scratched
8
- at the end. Incidentally it's also possible to the the same `cide` command on
9
- the developer machine and get the same build environent as on the CI. This
10
- makes configuration iterations much shorter and allow to converge on a working
11
- configuration faster.
8
+ at the end. Incidentally it's also possible to run the same `cide` command on
9
+ the developer machine and get the same build environment as on the CI. This
10
+ makes configuration iterations much shorter and allows to converge on a
11
+ working configuration faster.
12
12
 
13
13
  Usage
14
14
  -----
15
15
 
16
16
  Go to the target project's root and run `cide init` to populate a default
17
- `.cide.yml`. This file contains all the instruction to build your project with
18
- cide.
17
+ `cide.yml`. This file contains all the instruction to build your project with
18
+ cide and is [documented here](docs/cide.yml.md).
19
19
 
20
20
  Once the file is configure run `cide` to execute the build. All the output
21
21
  will appear in the console.
@@ -23,7 +23,7 @@ will appear in the console.
23
23
  Example
24
24
  -------
25
25
 
26
- `.cide.yml`
26
+ `cide.yml`
27
27
  ```yaml
28
28
  ---
29
29
  from: "ruby:2.1"
@@ -55,6 +55,7 @@ Missing features
55
55
  current format might be a bit daunting for non-experts.
56
56
  * Build matrix: run variations of the tests, for example with different
57
57
  versions of ruby to make sure all are supported (useful for libraries).
58
+ * Support for local docker machine
58
59
 
59
60
  PR welcome !
60
61
 
@@ -89,8 +90,6 @@ Similar projects
89
90
  TODO
90
91
  ----
91
92
 
92
- * Document the `.cide.yml` format. Look into `lib/cide/build/config_loader.rb`
93
- for now
94
93
  * Explain how to use *cide* with Jenkins
95
94
  * Explain Travis CI vs *cide* + Jenkins
96
95
 
data/Rakefile CHANGED
@@ -1,7 +1,8 @@
1
- require 'rubocop/rake_task'
1
+ require 'md2man/rakefile'
2
2
  require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
3
4
 
4
- task default: [:spec, :rubocop]
5
+ task default: [:spec, :rubocop, 'md2man:man']
5
6
 
6
7
  RuboCop::RakeTask.new
7
8
  RSpec::Core::RakeTask.new
data/bin/cide CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # cide - Continuous Integration Docker Environment
3
+ # cide - Isolated test runner with Docker
4
4
  #
5
5
 
6
6
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
7
- require 'cide'
7
+ require 'cide/cli'
8
8
  CIDE::CLI.start
data/cide.gemspec CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'cide'
5
- s.version = '0.4.1'
5
+ s.version = '0.5.0'
6
6
  s.authors = ['zimbatm']
7
7
  s.email = ['zimbatm@zimbatm.com']
8
- s.summary = 'CI docker runner'
8
+ s.summary = 'Isolated test runner with Docker'
9
9
  s.description = <<DESC
10
- cide makes it easy to reproduce CI builds on the developer computer by
11
- providing the same docker environment.
10
+ cide is a command-line tool that runs tests in an isolated (docker)
11
+ environment. It allows to run the same command on the developer and CI
12
+ machines.
12
13
  DESC
13
14
  s.homepage = 'https://github.com/zimbatm/cide'
14
15
  s.license = 'MIT'
@@ -22,8 +23,9 @@ DESC
22
23
 
23
24
  s.add_runtime_dependency 'thor', '~> 0.19'
24
25
  s.add_runtime_dependency 'virtus', '~> 1.0'
26
+ s.add_development_dependency 'activesupport'
27
+ s.add_development_dependency 'md2man'
25
28
  s.add_development_dependency 'rake'
26
- s.add_development_dependency 'rubocop'
27
29
  s.add_development_dependency 'rspec'
28
- s.add_development_dependency 'activesupport'
30
+ s.add_development_dependency 'rubocop'
29
31
  end
@@ -8,5 +8,4 @@ before:
8
8
  - Gemfile.lock
9
9
  - cide.gemspec
10
10
  run: bundle install --jobs=3 --retry=3 --deployment
11
- use_ssh: false
12
11
  run: bundle exec rake
data/docs/cide.yml.md ADDED
@@ -0,0 +1,154 @@
1
+ CIDE.YML 1 "JUNE 2015" cide.yml "Cide Manual"
2
+ =============================================
3
+
4
+ NAME
5
+ ----
6
+
7
+ cide.yml - file format that directs the `cide build` execution
8
+
9
+ DESCRIPTION
10
+ -----------
11
+
12
+ The `cide.yml` file is encoded in the [YAML markup language](http://yaml.org/)
13
+ and describes mostly how the Dockerfile will be generated.
14
+
15
+ It has the following semantic:
16
+
17
+ Root document
18
+ -------------
19
+
20
+ ```yaml
21
+ ---
22
+ # Image to base the build on
23
+ #
24
+ # required
25
+ # type: string
26
+ from: 'ubuntu'
27
+
28
+ # A step executed as root. See the Step definition.
29
+ as_root: {}
30
+
31
+ # If set to true, inject the invoker's SSH key into the image.
32
+ # This is used for shared github access for example.
33
+ #
34
+ # type: boolean
35
+ use_ssh: no
36
+
37
+ # A step executed as the "cide" user. See the Step definition.
38
+ before: {}
39
+
40
+ # Environment variables set at runtime. See the ENV definition.
41
+ env: {}
42
+
43
+ # Selects a file or directory to export. When set and cide is invoked with
44
+ # --export the same directory will be copied back into the project's root.
45
+ #
46
+ # type: string
47
+ export_dir:
48
+
49
+ # When defined, executes and attaches the defined linked containers to the
50
+ # CI runtime. See the Link definition.
51
+ links: []
52
+
53
+ # Determines what script to run to execute the tests. This is the main command
54
+ # that is used to run the CI.
55
+ #
56
+ # The script has to exit with an exit-status of zero to succeed.
57
+ #
58
+ # default: "script/ci"
59
+ # type: string
60
+ run: rake
61
+ ```
62
+
63
+ Step definition
64
+ ---------------
65
+
66
+ Here is the format for a step.
67
+
68
+ ```yaml
69
+ # An array or hash of files to add
70
+ #
71
+ # In the hash form, the target is on the left-hand side and source on the
72
+ # right-hand side. If multiple values are passed on to the right then they are
73
+ # all added to the same folder.
74
+ #
75
+ # If a URL is provided in the source it is fetched during the build.
76
+ #
77
+ # Note that source files should either come from a URL or from a file within
78
+ # the project's directory.
79
+ add:
80
+ /etc/cacert.pem: http://curl.se/cacert.pem
81
+ /src:
82
+ - Gemfile
83
+ - Gemfile.lock
84
+ # or
85
+ add:
86
+ - one
87
+ - two
88
+
89
+ # Sets environment variables in this step (and next ones). See the ENV
90
+ # definition.
91
+ env: {}
92
+
93
+ # A list of commands to run in that stage
94
+ #
95
+ # type: string or array of string
96
+ run:
97
+ - bundle exec
98
+ - npm install
99
+ # or
100
+ run: go get ./...
101
+ ```
102
+
103
+ If the step is defined as a string or array, those are interpreted as commands
104
+ to add to that step.
105
+
106
+ ENV definition
107
+ --------------
108
+
109
+ An array or hash of environment variables to load
110
+
111
+ In the hash for, the left-hand side is the key and the right-hand side the
112
+ value.
113
+
114
+ If a hash value is nil or the array form is used, the environment variables
115
+ are loaded from the cide invoker environment.
116
+
117
+ ```yaml
118
+ env:
119
+ HOME: /cide
120
+ AWS_ACCESS_KEY_ID:
121
+ # or
122
+ env:
123
+ - AWS_ACCESS_SECRET_KEY
124
+ ```
125
+
126
+ Link definition
127
+ ---------------
128
+
129
+ A hash that describes a linked containers. Linked containers are automatically
130
+ started before executing the main command and destroyed after that.
131
+
132
+ ```yaml
133
+ # Gives a name to the container to execute. This also determines the hostname
134
+ # the main container will be able to address this container with.
135
+ #
136
+ # If the name is missing, the name is extracted from the `from` key. For
137
+ # example if the `from` value is "foobar/redis:2.6" the name will be "redis"
138
+ #
139
+ # type: string
140
+ name: 'mysql'
141
+
142
+ # Name of the image to pull and base the container on.
143
+ #
144
+ # type: string
145
+ name: 'redis:2.6'
146
+
147
+ # Environment variables for that container. See the ENV definition.
148
+ env: {}
149
+
150
+ # Single command to execute the container with.
151
+ #
152
+ # type: string
153
+ run: 'redis-server'
154
+ ```
data/docs/sidebar.md ADDED
@@ -0,0 +1,22 @@
1
+ # cide
2
+
3
+ [ditto:searchbar]
4
+ - [Home]()
5
+ - [CHANGELOG](#/CHANGELOG)
6
+ - [LICENSE (MIT)](#/LICENSE)
7
+
8
+ ## Github
9
+
10
+ - [Repo](https://github.com/zimbatm/cide)
11
+ - [Issues](https://github.com/zimbatm/cide/issues)
12
+ - [Releases](https://github.com/zimbatm/cide/releases)
13
+ - [Wiki](https://github.com/zimbatm/cide/wiki)
14
+
15
+ ## Man pages
16
+ - [man 1 cide](#man/cide.1)
17
+ - [man 1 cide-build](#man/cide-build.1)
18
+ - [man 1 cide-clean](#man/cide-clean.1)
19
+ - [man 1 cide-debug](#man/cide-debug.1)
20
+ - [man 1 cide-init](#man/cide-init.1)
21
+ - [man 1 cide.yml](#man/cide.yml.1)
22
+
data/index.html ADDED
@@ -0,0 +1,53 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>cide - Isolated test runner with Docker</title>
6
+
7
+ <!-- jQuery -->
8
+ <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
9
+ <script src="//code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
10
+
11
+ <!-- marked -->
12
+ <script src="//chutsu.github.io/ditto/ver/0.12/marked.js"></script>
13
+
14
+ <!-- highlight -->
15
+ <link rel="stylesheet" href="//chutsu.github.io/ditto/ver/0.12/github.css">
16
+ <script src="//chutsu.github.io/ditto/ver/0.12/highlight.js"></script>
17
+
18
+ <!-- ditto -->
19
+ <link rel="stylesheet" href="//chutsu.github.io/ditto/ver/0.12/ditto.css">
20
+ <script src="//chutsu.github.io/ditto/ver/0.12/ditto.js"></script>
21
+ </head>
22
+ <body>
23
+ <!-- essential -->
24
+ <div id="sidebar"></div>
25
+ <div id="content"></div>
26
+ <div id="hide"></div>
27
+
28
+ <!-- optional -->
29
+ <div id="back_to_top">back to top</div>
30
+ <div id="edit">edit</div>
31
+ <div id="loading">Loading ...</div>
32
+ <div id="error"></div>
33
+
34
+ <script>
35
+ $(function($) {
36
+ // essential settings
37
+ ditto.index = "README.md";
38
+ ditto.sidebar_file = "docs/sidebar.md";
39
+
40
+ // optional settings if you want github search
41
+ ditto.github_username = "zimbatm";
42
+ ditto.github_repo = "cide";
43
+ ditto.highlight_code = true;
44
+
45
+ // where the docs are actually stored on github - so you can edit
46
+ ditto.base_url = "https://github.com/zimbatm/cide/edit/master";
47
+
48
+ // run
49
+ ditto.run();
50
+ });
51
+ </script>
52
+ </body>
53
+ </html>
@@ -70,6 +70,11 @@ module CIDE
70
70
  ERB.new(File.read(DOCKERFILE_TEMPLATE), nil, '<>-').result(binding)
71
71
  end
72
72
 
73
+ def self.load(dir = Dir.pwd, output = $stderr)
74
+ file_path = find_config(dir)
75
+ load_file(file_path, output)
76
+ end
77
+
73
78
  def self.load_file(file_path, output = $stderr)
74
79
  obj = new
75
80
  loader = ConfigLoader.new(obj)
@@ -86,6 +91,13 @@ module CIDE
86
91
  return obj if obj.errors.empty?
87
92
  nil
88
93
  end
94
+
95
+ def self.find_config(dir)
96
+ paths = CONFIG_FILES.map { |name| File.expand_path(name, dir) }
97
+ paths
98
+ .find { |path| File.exist?(path) } ||
99
+ fail("Config not found among these paths: #{paths.inspect}")
100
+ end
89
101
  end
90
102
  end
91
103
  end
data/lib/cide/cli.rb CHANGED
@@ -21,7 +21,7 @@ module CIDE
21
21
 
22
22
  method_option 'name',
23
23
  desc: 'Name of the build',
24
- aliases: %w(n t),
24
+ aliases: %w(-n -t),
25
25
  default: File.basename(Dir.pwd)
26
26
 
27
27
  method_option 'export',
@@ -31,13 +31,13 @@ module CIDE
31
31
 
32
32
  method_option 'export_dir',
33
33
  desc: 'Change the ouput directory on the host',
34
- aliases: %w(o host_export_dir),
34
+ aliases: %w(-o --host_export_dir),
35
35
  default: nil
36
36
 
37
37
  method_option 'run',
38
38
  desc: 'Override the script to run',
39
39
  type: :array,
40
- aliases: ['r'],
40
+ aliases: ['-r'],
41
41
  default: []
42
42
 
43
43
  method_option 'pull',
@@ -47,7 +47,7 @@ module CIDE
47
47
 
48
48
  method_option 'ssh_key',
49
49
  desc: 'Path to a ssh key to import into the docker image',
50
- aliases: ['s'],
50
+ aliases: ['-s'],
51
51
  default: '~/.ssh/id_rsa'
52
52
 
53
53
  def build
@@ -57,7 +57,7 @@ module CIDE
57
57
 
58
58
  ## Config ##
59
59
  banner 'Config'
60
- build = Build::Config.load_file CONFIG_FILE
60
+ build = Build::Config.load(Dir.pwd)
61
61
  exit 1 if build.nil?
62
62
  export_dir = options.export_dir
63
63
  export_dir ||= File.dirname(build.export_dir) if build.export_dir
@@ -161,7 +161,7 @@ module CIDE
161
161
  desc 'debug', 'Opens a debug console in the last project image'
162
162
  method_option 'name',
163
163
  desc: 'Name of the build',
164
- aliases: %w(n t),
164
+ aliases: %w(-n -t),
165
165
  default: File.basename(Dir.pwd)
166
166
  method_option 'user',
167
167
  desc: 'User to run under',
@@ -173,7 +173,7 @@ module CIDE
173
173
 
174
174
  ## Config ##
175
175
  banner 'Config'
176
- build = Build::Config.load_file CONFIG_FILE
176
+ build = Build::Config.load
177
177
  exit 1 if build.nil?
178
178
  name = CIDE::Docker.id options.name
179
179
  tag = "cide/#{name}"
@@ -270,10 +270,10 @@ module CIDE
270
270
  docker('rmi', '--force', *old_cide_images)
271
271
  end
272
272
 
273
- desc 'init', "Creates a blank #{CONFIG_FILE} into the project"
273
+ desc 'init', "Creates a blank #{CONFIG_FILES.first} into the project"
274
274
  def init
275
- puts "Creating #{CONFIG_FILE} with default values"
276
- create_file CONFIG_FILE, File.read(DEFAULT_CIDEFILE)
275
+ puts "Creating #{CONFIG_FILES.first} with default values"
276
+ create_file CONFIG_FILES.first, File.read(DEFAULT_CIDEFILE)
277
277
  end
278
278
 
279
279
  private
@@ -5,7 +5,7 @@ module CIDE
5
5
  TEMP_SSH_KEY = 'id_rsa.tmp'
6
6
  SSH_CONFIG_FILE = 'ssh_config'
7
7
  SSH_CONFIG_PATH = File.join(dir, SSH_CONFIG_FILE)
8
- CONFIG_FILE = '.cide.yml'
8
+ CONFIG_FILES = ['cide.yml', '.cide.yml']
9
9
  CIDE_DIR = '/cide'
10
10
  CIDE_SRC_DIR = File.join(CIDE_DIR, 'src')
11
11
  CIDE_SSH_DIR = File.join(CIDE_DIR, '.ssh')
@@ -0,0 +1,62 @@
1
+ CIDE-BUILD 1 "JUNE 2015" cide-build "Cide Manual"
2
+ =================================================
3
+
4
+ NAME
5
+ ----
6
+
7
+ cide-build - Builds an image and executes the run script
8
+
9
+ SYNOPSIS
10
+ --------
11
+
12
+ *cide build* [`-n`|`--name`=<*name*>] [`--export`|`--no-export`]
13
+ [`-o`|`--export-dir`=<*path*>] [`-r`|`--run`=<*command*>]
14
+ [`--pull`|`--no-pull`] [`-s`|`--ssh-key`=<*path*>]
15
+
16
+ DESCRIPTION
17
+ -----------
18
+
19
+ This is the default command that does most of the work and is invoked 99% of
20
+ the command.
21
+
22
+ When invoked it will read the `cide.yml` file, generate a temporary
23
+ `Dockerfile.cide` file, build it with *docker build*, start all the linked
24
+ containers and finally run the selected script. When that script exits all the
25
+ running containers are torn down. This loop guarantees a blank slate for every
26
+ CI run with isolated dependencies.
27
+
28
+ OPTIONS
29
+ -------
30
+
31
+ `-n`, `--name`=<*name*>
32
+ Name of the built image. This can be used to differentiate between branches
33
+ or others in a CI environment. By default the name is the basename(1) of the
34
+ current directory.
35
+
36
+ `--export`, `--no-export`
37
+ Whenever to export artifacts. If `--export` is passed and the `export:`
38
+ directive is set in the `cide.yml` file, artifacts from that directory are
39
+ transfered back outside of the container and into the current directory.
40
+
41
+ `-o`, `--export-dir`=<*path*>
42
+ By default the export directory is the same as the one given in the
43
+ `export:` directive in the `cide.yml` file. It's possible to change that
44
+ target folder outside of the container.
45
+
46
+ `-r`, `--run`=<*command*>
47
+ Override the script to run. Usually the `run:` directive in the `cide.yml`
48
+ is defining what to run but this could be used for a quick one-off.
49
+
50
+ `--pull`, `--no-pull`
51
+ Whenever to pull for new images on build. If set it will try to fetch new
52
+ versions of the `from:` directive. It can be useful to get new versions of
53
+ an image but also invalidates all the cache.
54
+
55
+ `-s`, `--ssh-key`=<*path*>
56
+ When the `use_ssh:` directive is set to true, where to get the ssh key to
57
+ inject into the container. Defaults to `~/.ssh/id_rsa`.
58
+
59
+ SEE ALSO
60
+ --------
61
+
62
+ cide(1), cide.yml(1)
@@ -0,0 +1,34 @@
1
+ CIDE-CLEAN 1 "JUNE 2015" cide-clean "Cide Manual"
2
+ =================================================
3
+
4
+ NAME
5
+ ----
6
+
7
+ cide-clean - Removes old containers
8
+
9
+ SYNOPSIS
10
+ --------
11
+
12
+ *cide clean* [`--days`=<*n*>] [`--count`=<*n*>]
13
+
14
+ DESCRIPTION
15
+ -----------
16
+
17
+ `cide` can generate a lot of data on the box in terms of docker images and
18
+ containers. This command tries to removes old images with a simple heuristic.
19
+
20
+ *NOTE*: This command might interfer with other users of the docker daemon.
21
+
22
+ OPTIONS
23
+ -------
24
+
25
+ `--days`=<*n*>
26
+ Number of days to keep the images. Defaults to 7
27
+
28
+ `--count`=<*n*>
29
+ Maximum number of images to keep. Defaults to 10
30
+
31
+ SEE ALSO
32
+ --------
33
+
34
+ cide(1)
@@ -0,0 +1,42 @@
1
+ CIDE-DEBUG 1 "JUNE 2015" cide-debug "Cide Manual"
2
+ =================================================
3
+
4
+ NAME
5
+ ----
6
+
7
+ cide-debug - Opens a debug console in the last project image
8
+
9
+ SYNOPSIS
10
+ --------
11
+
12
+ *cide debug* [`-n`|`--name`=<*name*>] [`--user`=<*username*>]
13
+
14
+ DESCRIPTION
15
+ -----------
16
+
17
+ Sometimes it's useful to run commands inside of the same environment where the
18
+ CI tests are run from. For example if an error doesn't reproduce on the
19
+ developer's machine.
20
+
21
+ *cide debug* starts a new temporary container (and linked containers) in the
22
+ previously generated container. This requires the user to have run *cide
23
+ build* previously.
24
+
25
+ OPTIONS
26
+ -------
27
+
28
+ `-n`, `--name`=<*name*>
29
+ Name of the image. This is generally not required unless a name has been
30
+ given during the *cide build* phase as well.
31
+
32
+ Defaults to the basename(1) of the current directory.
33
+
34
+ `--user`=<*username*>
35
+ Selects the user to run the container under. By default the `cide` user is
36
+ selected. In some situations it's useful to run the container as `root`
37
+ (when poking at system dependencies)
38
+
39
+ SEE ALSO
40
+ --------
41
+
42
+ cide(1)
@@ -0,0 +1,29 @@
1
+ CIDE-INIT 1 "JUNE 2015" cide-init "Cide Manual"
2
+ =================================================
3
+
4
+ NAME
5
+ ----
6
+
7
+ cide-init - Creates a blank `cide.yml` into the project
8
+
9
+ SYNOPSIS
10
+ --------
11
+
12
+ *cide init*
13
+
14
+ DESCRIPTION
15
+ -----------
16
+
17
+ It's useful to get a basic skeleton when adding *cide* to a new project. If
18
+ the file already exists a confirmation is asked.
19
+
20
+ FILES
21
+ -----
22
+
23
+ *cide.yml*
24
+ Per project build and test settings. See cide.yml(1)
25
+
26
+ SEE ALSO
27
+ --------
28
+
29
+ cide(1), cide.yml(1)
data/man/cide.1.md ADDED
@@ -0,0 +1,113 @@
1
+ CIDE 1 "JUNE 2015" cide "Cide Manual"
2
+ ======================================
3
+
4
+ NAME
5
+ ----
6
+
7
+ cide - Isolated test runner with Docker
8
+
9
+ SYNOPSIS
10
+ --------
11
+
12
+ *cide* [`-f`|`--force`] [`-p`|`--pretend`|`--no-pretend`]
13
+ [`-q`|`--quiet`|`--no-quiet`] [`-s`|`--skip`|`--no-skip`]
14
+ <*command*> [<*args*>]
15
+
16
+ DESCRIPTION
17
+ -----------
18
+
19
+ *cide* is a command-line tool that executes tests in isolation using a
20
+ container (through Docker).
21
+
22
+ The default *cide build* command reads a `.cide.yml` file in the current
23
+ folder and takes it's content to build a temporary Dockerfile that imports all
24
+ of the current directory's structure, builds an image with it and then runs a
25
+ container from it that executes the specified tests. See the cide.yml(1) man
26
+ page for the structure of that file.
27
+
28
+ OPTIONS
29
+ -------
30
+
31
+ These are global options that set the behavior of all commands.
32
+
33
+ `-f`, `--force`
34
+ Overwrite files that already exist
35
+
36
+ `-p`, `--pretend`, `--no-pretend`
37
+ Run but do not make any changes
38
+
39
+ `-q`, `--quiet`, `--no-quiet`
40
+ Suppress status output
41
+
42
+ `-s`, `--skip`, `--no-skip`
43
+ Skip files that already exist
44
+
45
+ COMMANDS
46
+ --------
47
+
48
+ *cide build* [<*options*>]
49
+ Builds an image and executes the run script. This is the default command
50
+ when none is provided.
51
+
52
+ See cide-build(1)
53
+
54
+ *cide clean* [<*options*>]
55
+ Removes old containers.
56
+
57
+ See cide-clean(1)
58
+
59
+ *cide debug* [<*options*>]
60
+ Opens a debug console in the last project image
61
+
62
+ See cide-debug(1)
63
+
64
+ *cide help* [<*command*>]
65
+ Shows the general help or the one for the given *command*
66
+
67
+ *cide init*
68
+ Creates a blank `cide.yml` file into the project.
69
+
70
+ See cide-init(1)
71
+
72
+ FILES
73
+ -----
74
+
75
+ *cide.yml*
76
+ Per project build and test settings. See cide.yml(1)
77
+
78
+ ENVIRONMENT
79
+ -----------
80
+
81
+ The following environment variables are used by the `docker` client to connect
82
+ to the `docker` daemon. See also
83
+ https://docs.docker.com/docker/reference/commandline/cli/#environment-variables:b659b046131d4024ab5e2d3675716bf0
84
+
85
+ *DOCKER_HOST*
86
+ Daemon socket to connect to.
87
+
88
+ *DOCKER_CERT_PATH*
89
+ The location of your authentication keys.
90
+
91
+ *DOCKER_TLS_VERIFY*
92
+ When set Docker uses TLS and verifies the remote.
93
+
94
+ CONTRIBUTE
95
+ ----------
96
+
97
+ Bug reports, contributions and forks are welcome.
98
+
99
+ All bugs or other forms of discussion happen on
100
+ <http://github.com/zimbatm/cide/issues>
101
+
102
+ There is also a wiki available where you can share your usage patterns or
103
+ other tips and tricks <https://github.com/zimbatm/cide/wiki>
104
+
105
+ COPYRIGHT
106
+ ---------
107
+
108
+ Copyright (C) 2015 zimbatm and contributors under the MIT licence.
109
+
110
+ SEE ALSO
111
+ --------
112
+
113
+ cide.yml(1)
data/man/cide.yml.1.md ADDED
@@ -0,0 +1,154 @@
1
+ CIDE.YML 1 "JUNE 2015" cide.yml "Cide Manual"
2
+ =============================================
3
+
4
+ NAME
5
+ ----
6
+
7
+ cide.yml - file format that directs the `cide build` execution
8
+
9
+ DESCRIPTION
10
+ -----------
11
+
12
+ The `cide.yml` file is encoded in the [YAML markup language](http://yaml.org/)
13
+ and describes mostly how the Dockerfile will be generated.
14
+
15
+ It has the following semantic:
16
+
17
+ Root document
18
+ -------------
19
+
20
+ ```yaml
21
+ ---
22
+ # Image to base the build on
23
+ #
24
+ # required
25
+ # type: string
26
+ from: 'ubuntu'
27
+
28
+ # A step executed as root. See the Step definition.
29
+ as_root: {}
30
+
31
+ # If set to true, inject the invoker's SSH key into the image.
32
+ # This is used for shared github access for example.
33
+ #
34
+ # type: boolean
35
+ use_ssh: no
36
+
37
+ # A step executed as the "cide" user. See the Step definition.
38
+ before: {}
39
+
40
+ # Environment variables set at runtime. See the ENV definition.
41
+ env: {}
42
+
43
+ # Selects a file or directory to export. When set and cide is invoked with
44
+ # --export the same directory will be copied back into the project's root.
45
+ #
46
+ # type: string
47
+ export_dir:
48
+
49
+ # When defined, executes and attaches the defined linked containers to the
50
+ # CI runtime. See the Link definition.
51
+ links: []
52
+
53
+ # Determines what script to run to execute the tests. This is the main command
54
+ # that is used to run the CI.
55
+ #
56
+ # The script has to exit with an exit-status of zero to succeed.
57
+ #
58
+ # default: "script/ci"
59
+ # type: string
60
+ run: rake
61
+ ```
62
+
63
+ Step definition
64
+ ---------------
65
+
66
+ Here is the format for a step.
67
+
68
+ ```yaml
69
+ # An array or hash of files to add
70
+ #
71
+ # In the hash form, the target is on the left-hand side and source on the
72
+ # right-hand side. If multiple values are passed on to the right then they are
73
+ # all added to the same folder.
74
+ #
75
+ # If a URL is provided in the source it is fetched during the build.
76
+ #
77
+ # Note that source files should either come from a URL or from a file within
78
+ # the project's directory.
79
+ add:
80
+ /etc/cacert.pem: http://curl.se/cacert.pem
81
+ /src:
82
+ - Gemfile
83
+ - Gemfile.lock
84
+ # or
85
+ add:
86
+ - one
87
+ - two
88
+
89
+ # Sets environment variables in this step (and next ones). See the ENV
90
+ # definition.
91
+ env: {}
92
+
93
+ # A list of commands to run in that stage
94
+ #
95
+ # type: string or array of string
96
+ run:
97
+ - bundle exec
98
+ - npm install
99
+ # or
100
+ run: go get ./...
101
+ ```
102
+
103
+ If the step is defined as a string or array, those are interpreted as commands
104
+ to add to that step.
105
+
106
+ ENV definition
107
+ --------------
108
+
109
+ An array or hash of environment variables to load
110
+
111
+ In the hash for, the left-hand side is the key and the right-hand side the
112
+ value.
113
+
114
+ If a hash value is nil or the array form is used, the environment variables
115
+ are loaded from the cide invoker environment.
116
+
117
+ ```yaml
118
+ env:
119
+ HOME: /cide
120
+ AWS_ACCESS_KEY_ID:
121
+ # or
122
+ env:
123
+ - AWS_ACCESS_SECRET_KEY
124
+ ```
125
+
126
+ Link definition
127
+ ---------------
128
+
129
+ A hash that describes a linked containers. Linked containers are automatically
130
+ started before executing the main command and destroyed after that.
131
+
132
+ ```yaml
133
+ # Gives a name to the container to execute. This also determines the hostname
134
+ # the main container will be able to address this container with.
135
+ #
136
+ # If the name is missing, the name is extracted from the `from` key. For
137
+ # example if the `from` value is "foobar/redis:2.6" the name will be "redis"
138
+ #
139
+ # type: string
140
+ name: 'mysql'
141
+
142
+ # Name of the image to pull and base the container on.
143
+ #
144
+ # type: string
145
+ name: 'redis:2.6'
146
+
147
+ # Environment variables for that container. See the ENV definition.
148
+ env: {}
149
+
150
+ # Single command to execute the container with.
151
+ #
152
+ # type: string
153
+ run: 'redis-server'
154
+ ```
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - zimbatm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-02 00:00:00.000000000 Z
11
+ date: 2015-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,21 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rubocop
56
+ name: md2man
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
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: rake
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -81,7 +95,7 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: activesupport
98
+ name: rubocop
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -95,8 +109,9 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  description: |
98
- cide makes it easy to reproduce CI builds on the developer computer by
99
- providing the same docker environment.
112
+ cide is a command-line tool that runs tests in an isolated (docker)
113
+ environment. It allows to run the same command on the developer and CI
114
+ machines.
100
115
  email:
101
116
  - zimbatm@zimbatm.com
102
117
  executables:
@@ -104,22 +119,25 @@ executables:
104
119
  extensions: []
105
120
  extra_rdoc_files: []
106
121
  files:
107
- - ".cide.yml"
108
122
  - ".editorconfig"
109
123
  - ".gitignore"
124
+ - ".nojekyll"
110
125
  - ".rspec"
111
126
  - ".rubocop.yml"
112
127
  - ".travis.yml"
113
128
  - CHANGELOG.md
114
129
  - Gemfile
115
130
  - Gemfile.lock
116
- - LICENSE
131
+ - LICENSE.md
117
132
  - README.md
118
133
  - Rakefile
119
134
  - bin/cide
120
135
  - cide
121
136
  - cide.gemspec
122
- - lib/cide.rb
137
+ - cide.yml
138
+ - docs/cide.yml.md
139
+ - docs/sidebar.md
140
+ - index.html
123
141
  - lib/cide/build.rb
124
142
  - lib/cide/build/config.rb
125
143
  - lib/cide/build/config_loader.rb
@@ -128,6 +146,12 @@ files:
128
146
  - lib/cide/default_cide.yml
129
147
  - lib/cide/docker.rb
130
148
  - lib/cide/dockerfile_template.erb
149
+ - man/cide-build.1.md
150
+ - man/cide-clean.1.md
151
+ - man/cide-debug.1.md
152
+ - man/cide-init.1.md
153
+ - man/cide.1.md
154
+ - man/cide.yml.1.md
131
155
  - spec/build_config_loader_spec.rb
132
156
  - spec/spec_helper.rb
133
157
  homepage: https://github.com/zimbatm/cide
@@ -150,10 +174,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
174
  version: '0'
151
175
  requirements: []
152
176
  rubyforge_project:
153
- rubygems_version: 2.4.6
177
+ rubygems_version: 2.4.7
154
178
  signing_key:
155
179
  specification_version: 4
156
- summary: CI docker runner
180
+ summary: Isolated test runner with Docker
157
181
  test_files:
158
182
  - spec/build_config_loader_spec.rb
159
183
  - spec/spec_helper.rb
data/lib/cide.rb DELETED
@@ -1,7 +0,0 @@
1
- # CIDE is a Continuous Integration Docker Environment runner
2
- #
3
- # The juicy bits are defined in CIDE::CLI
4
- module CIDE
5
- end
6
-
7
- require 'cide/cli'