cenit_cmd 0.0.5 → 0.0.6
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 +4 -4
- data/.gitignore +82 -0
- data/Gemfile +3 -1
- data/README.md +132 -5
- data/lib/cenit_cmd/collection.rb +86 -23
- data/lib/cenit_cmd/templates/collection/Gemfile +15 -5
- data/lib/cenit_cmd/templates/collection/{LICENSE → LICENSE.tt} +2 -1
- data/lib/cenit_cmd/templates/collection/README.md.tt +330 -0
- data/lib/cenit_cmd/templates/collection/Rakefile.tt +78 -0
- data/lib/cenit_cmd/templates/collection/gitignore +51 -13
- data/lib/cenit_cmd/templates/collection/lib/cenit/collection/%collection_name%/build.rb.tt +14 -0
- data/lib/cenit_cmd/templates/collection/lib/cenit/collection/%collection_name%/index.json.tt +7 -0
- data/lib/cenit_cmd/templates/collection/lib/cenit/collection/%collection_name%/libraries/index.json +1 -0
- data/lib/cenit_cmd/templates/collection/lib/cenit/collection/%collection_name%.rb.tt +35 -0
- data/lib/cenit_cmd/templates/collection/spec/spec_helper.rb.tt +25 -7
- data/lib/cenit_cmd/version.rb +1 -1
- metadata +11 -13
- data/lib/cenit_cmd/templates/bin/console.tt +0 -10
- data/lib/cenit_cmd/templates/bin/setup.tt +0 -10
- data/lib/cenit_cmd/templates/collection/README.md +0 -15
- data/lib/cenit_cmd/templates/collection/Rakefile +0 -21
- data/lib/cenit_cmd/templates/collection/collection.gemspec +0 -26
- data/lib/cenit_cmd/templates/collection/lib/%file_name%/base.rb.tt +0 -9
- data/lib/cenit_cmd/templates/collection/lib/%file_name%/index.json +0 -8
- data/lib/cenit_cmd/templates/collection/lib/%file_name%/libraries/index.json +0 -1
- data/lib/cenit_cmd/templates/collection/lib/%file_name%/version.rb.tt +0 -3
- data/lib/cenit_cmd/templates/collection/lib/%file_name%.rb.tt +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1cd766f1ddfc4137aa0100a102d8b8a8924f3ab
|
4
|
+
data.tar.gz: 1ec63f7178a0bff008d277cb9b337e55e32d834f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f5ec4dd45dedf78528b00f13b758657bb1782a4cf9292a84b11f024d9fd6e92f43febebd339e03aeba04c647bfd30a23f3b8637ecdf3de8c3ac760d632fc85c
|
7
|
+
data.tar.gz: 2754138d8f1ad745efe80b70a7f6f3bcbc87f5d11424ded1bb656bdf35bacc4967257103432568b7c29002781483addaaffd028356226cdd61e09eabbc6b3e17
|
data/.gitignore
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Created by .ignore support plugin (hsz.mobi)
|
2
|
+
### Rails template
|
3
|
+
*.rbc
|
4
|
+
capybara-*.html
|
5
|
+
.rspec
|
6
|
+
/log
|
7
|
+
/tmp
|
8
|
+
/db/*.sqlite3
|
9
|
+
/db/*.sqlite3-journal
|
10
|
+
/public/system
|
11
|
+
/coverage/
|
12
|
+
/spec/tmp
|
13
|
+
**.orig
|
14
|
+
rerun.txt
|
15
|
+
pickle-email-*.html
|
16
|
+
|
17
|
+
# TODO Comment out these rules if you are OK with secrets being uploaded to the repo
|
18
|
+
config/initializers/secret_token.rb
|
19
|
+
config/secrets.yml
|
20
|
+
|
21
|
+
## Environment normalisation:
|
22
|
+
/.bundle
|
23
|
+
/vendor/bundle
|
24
|
+
|
25
|
+
# these should all be checked in to normalise the environment:
|
26
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
27
|
+
|
28
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
29
|
+
.rvmrc
|
30
|
+
|
31
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
32
|
+
/vendor/assets/bower_components
|
33
|
+
*.bowerrc
|
34
|
+
bower.json
|
35
|
+
|
36
|
+
# Ignore pow environment settings
|
37
|
+
.powenv
|
38
|
+
|
39
|
+
|
40
|
+
### TortoiseGit template
|
41
|
+
# Project-level settings
|
42
|
+
/.tgitconfig
|
43
|
+
|
44
|
+
|
45
|
+
### Ruby template
|
46
|
+
*.gem
|
47
|
+
*.rbc
|
48
|
+
/.config
|
49
|
+
/coverage/
|
50
|
+
/InstalledFiles
|
51
|
+
/pkg/
|
52
|
+
/spec/reports/
|
53
|
+
/test/tmp/
|
54
|
+
/test/version_tmp/
|
55
|
+
/tmp/
|
56
|
+
|
57
|
+
## Specific to RubyMotion:
|
58
|
+
.dat*
|
59
|
+
.repl_history
|
60
|
+
build/
|
61
|
+
|
62
|
+
## Documentation cache and generated files:
|
63
|
+
/.yardoc/
|
64
|
+
/_yardoc/
|
65
|
+
/doc/
|
66
|
+
/rdoc/
|
67
|
+
|
68
|
+
## Environment normalisation:
|
69
|
+
/.bundle/
|
70
|
+
/vendor/bundle
|
71
|
+
/lib/bundler/man/
|
72
|
+
|
73
|
+
# for a library or gem, you might want to ignore these files since the code is
|
74
|
+
# intended to run in multiple environments; otherwise, check them in:
|
75
|
+
# Gemfile.lock
|
76
|
+
# .ruby-version
|
77
|
+
# .ruby-gemset
|
78
|
+
|
79
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
80
|
+
.rvmrc
|
81
|
+
|
82
|
+
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,134 @@
|
|
1
|
-
Collections
|
2
|
-
-----------
|
1
|
+
# Collections
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
This gem build a new Shared Collection (integration settgings) to be use in Cenit.
|
4
|
+
|
5
|
+
Cenit is an open source social platform as a service for data and business integration.
|
6
|
+
|
7
|
+
## Using cenit cmd
|
8
|
+
|
9
|
+
$ cenit collection foo
|
10
|
+
|
11
|
+
|
12
|
+
By default its possible read the options from `./gitconfig`
|
13
|
+
|
14
|
+
### Bootstrap a new collection
|
15
|
+
|
16
|
+
Before proceeding, take a minute to setup your git environment, specifically setup your name and
|
17
|
+
email for git and your username and token for GitHub:
|
18
|
+
|
19
|
+
|
20
|
+
$ git config --global user.email johndoe@example.com
|
21
|
+
$ git config --global user.name 'John Doe'
|
22
|
+
$ git config --global github.user johndoe
|
23
|
+
$ git config --global github.token 55555555555555
|
24
|
+
|
25
|
+
|
26
|
+
If you prefer use explicit options then you can do
|
27
|
+
|
28
|
+
$ cenit collection foo --user-email=sanchojaf@gmail.com --github-username=sanchojaf
|
29
|
+
|
30
|
+
Other options are:
|
31
|
+
|
32
|
+
| Option | Descrition |
|
33
|
+
|-------------------------------------| ---------------------------------------------------------------------------------------------------|
|
34
|
+
| --user-name=[USER_NAME] | the user's name, ie that is credited in the LICENSE |
|
35
|
+
| --user-email=[USER_EMAIL] | the user's email, ie that is credited in the Gem specification |
|
36
|
+
| --github-username=[GITHUB_USERNAME] | username in Github |
|
37
|
+
| --summary=[SUMMARY] | specify a summary (defaults 'Shared Collection cenit-collection-foo to be use in Cenit') |
|
38
|
+
| --description=[DESCRIPTION] | specify a description (defaults 'Shared Collection cenit-collection-foo to be use in Cenit') |
|
39
|
+
| --homepage=[HOMEPAGE] | the homepage for your project (defaults to the GitHub repo) |
|
40
|
+
|
41
|
+
### Structure
|
42
|
+
|
43
|
+
```
|
44
|
+
% tree
|
45
|
+
.
|
46
|
+
├── cenit-collection-foo.gemspec
|
47
|
+
├── Gemfile
|
48
|
+
├── .gitignore
|
49
|
+
├── .rspec
|
50
|
+
├── README.md
|
51
|
+
├── Rakefile
|
52
|
+
├── LICENSE
|
53
|
+
└── lib
|
54
|
+
└── cenit
|
55
|
+
└── collection
|
56
|
+
└── foo
|
57
|
+
└── connections
|
58
|
+
└── webhooks
|
59
|
+
└── connection_sets
|
60
|
+
└── translators
|
61
|
+
└── events
|
62
|
+
└── flows
|
63
|
+
└── libraries
|
64
|
+
└── index.json
|
65
|
+
└── build.rb
|
66
|
+
└── version.rb
|
67
|
+
└── foo.rb
|
68
|
+
└── spec
|
69
|
+
└── cenit
|
70
|
+
└── collection
|
71
|
+
└── foo_spec.rb
|
72
|
+
└── spec_helper.rb
|
73
|
+
└── support
|
74
|
+
└── samples
|
7
75
|
```
|
76
|
+
|
77
|
+
### Consider the next steps in your new collection repo
|
78
|
+
|
79
|
+
Move to the new collection folder.
|
80
|
+
|
81
|
+
$ cd my_collection
|
82
|
+
|
83
|
+
Create a new git and related GitHub's repository
|
84
|
+
|
85
|
+
$ rake create_repo
|
86
|
+
|
87
|
+
Commit and push until you are happy with your changes, see a real example in https://github.com/cenit-hub/cenit-collection-twilio
|
88
|
+
|
89
|
+
Generate a version
|
90
|
+
|
91
|
+
$ rake version:write
|
92
|
+
|
93
|
+
Tag and push release to git
|
94
|
+
|
95
|
+
$ rake git:release
|
96
|
+
|
97
|
+
Shared your collection in https://rubygems.org
|
98
|
+
|
99
|
+
$ rake release
|
100
|
+
|
101
|
+
## About Cenit
|
102
|
+
|
103
|
+
### Why were doing this
|
104
|
+
|
105
|
+
A common story for companies is the blending of solutions around its core business value.
|
106
|
+
Features developed by them, third-party's adaptations and other SaaS to facilitate operations.
|
107
|
+
|
108
|
+
Once grown enough a new expansion requires a huge integration effort. But available integration
|
109
|
+
solutions are heavy process. Some of them also need B2B transactions using complex EDI standards
|
110
|
+
required for large companies or business sectors.
|
111
|
+
|
112
|
+
This facts overkill many companies that can’t overcome these challenges.
|
113
|
+
|
114
|
+
### General Features
|
115
|
+
|
116
|
+
* 100% Open Source platform as a service (Open-PaaS).
|
117
|
+
* Hub with a great design that provides powerful yet simple abstractions, making a complex problem tractable.
|
118
|
+
* Primary concepts are: Data Type, Webhook, Flow, Event, Connection and Transform.
|
119
|
+
* Dynamic load schemas: XSD, JSON and EDI grammars.
|
120
|
+
* Powerful transform to translates and modified any formats to any format.
|
121
|
+
* Full Stack HTTP API and incremental API's helper libraries in several languages.
|
122
|
+
* Export and import integration settings (collections), and automatically saves its as a repo on github.
|
123
|
+
* Social networking features to share collections.
|
124
|
+
|
125
|
+
### Shared Collections
|
126
|
+
|
127
|
+
There are now over 25 pre-built shared integration collections out the box for connecting
|
128
|
+
to internet services, fulfilment solutions, accounting, communications, ERP, multi-channels, etc.
|
129
|
+
|
130
|
+
### Join us
|
131
|
+
|
132
|
+
* Github project: https://github.com/openjaf/cenit
|
133
|
+
* Email: support@cenitsaas.com
|
134
|
+
* Website: http://www.cenitsaas.com
|
data/lib/cenit_cmd/collection.rb
CHANGED
@@ -1,29 +1,51 @@
|
|
1
|
-
|
1
|
+
require 'byebug'
|
2
|
+
require 'pathname'
|
3
|
+
require 'git'
|
2
4
|
|
5
|
+
module CenitCmd
|
3
6
|
class Collection < Thor::Group
|
4
7
|
include Thor::Actions
|
5
8
|
|
6
|
-
desc "builds a cenit_hub collection"
|
7
|
-
argument :file_name, :
|
8
|
-
|
9
|
+
desc "builds a cenit_hub shared collection"
|
10
|
+
argument :file_name, type: :string, desc: 'collection path', default: '.'
|
11
|
+
argument :collection_name, type: :string, desc: 'collection name', default: '.'
|
9
12
|
source_root File.expand_path('../templates/collection', __FILE__)
|
10
13
|
|
14
|
+
class_option :user_name
|
15
|
+
class_option :user_email
|
16
|
+
class_option :github_username
|
17
|
+
class_option :summary
|
18
|
+
class_option :description
|
19
|
+
class_option :homepage
|
20
|
+
|
21
|
+
@generated = false
|
11
22
|
def generate
|
12
|
-
|
23
|
+
@collection_name = @file_name
|
24
|
+
|
25
|
+
use_prefix 'cenit-collection-'
|
26
|
+
|
27
|
+
@user_name = options[:user_name] || git_config['user.name']
|
28
|
+
@user_email = options[:user_email] || git_config['user.email']
|
29
|
+
@github_username = options[:github_username] || git_config['github.user']
|
30
|
+
@summary = options[:summary] || "Shared Collection #{@file_name} to be use in Cenit"
|
31
|
+
@description = options[:description] || @summary
|
32
|
+
@homepage = options[:homepage] || "https://github.com/#{@github_username}/#{@file_name}"
|
33
|
+
|
34
|
+
return unless validate_argument
|
13
35
|
|
14
36
|
empty_directory file_name
|
15
|
-
|
37
|
+
|
16
38
|
directory 'lib', "#{file_name}/lib"
|
17
|
-
empty_directory
|
18
|
-
empty_directory
|
19
|
-
empty_directory
|
20
|
-
empty_directory
|
21
|
-
empty_directory
|
22
|
-
empty_directory
|
23
|
-
|
24
|
-
empty_directory "#{file_name}/
|
25
|
-
|
26
|
-
|
39
|
+
empty_directory "#{file_name}/lib/cenit/collection/#{collection_name}/connections"
|
40
|
+
empty_directory "#{file_name}/lib/cenit/collection/#{collection_name}/webhooks"
|
41
|
+
empty_directory "#{file_name}/lib/cenit/collection/#{collection_name}/connection_roles"
|
42
|
+
empty_directory "#{file_name}/lib/cenit/collection/#{collection_name}/events"
|
43
|
+
empty_directory "#{file_name}/lib/cenit/collection/#{collection_name}/flows"
|
44
|
+
empty_directory "#{file_name}/lib/cenit/collection/#{collection_name}/translators"
|
45
|
+
|
46
|
+
empty_directory "#{file_name}/spec/support"
|
47
|
+
empty_directory "#{file_name}/spec/support/sample"
|
48
|
+
|
27
49
|
template 'Gemfile', "#{file_name}/Gemfile"
|
28
50
|
template 'gitignore', "#{file_name}/.gitignore"
|
29
51
|
template 'LICENSE', "#{file_name}/LICENSE"
|
@@ -31,13 +53,35 @@ module CenitCmd
|
|
31
53
|
template 'README.md', "#{file_name}/README.md"
|
32
54
|
template 'rspec', "#{file_name}/.rspec"
|
33
55
|
template 'spec/spec_helper.rb.tt', "#{file_name}/spec/spec_helper.rb"
|
56
|
+
@generated = true
|
34
57
|
end
|
35
58
|
|
36
59
|
def final_banner
|
60
|
+
return unless @generated
|
37
61
|
say %Q{
|
38
62
|
#{'*' * 80}
|
39
|
-
|
40
|
-
Consider
|
63
|
+
|
64
|
+
Consider the next steps:
|
65
|
+
|
66
|
+
Move to the new collection folder.
|
67
|
+
$ cd #{file_name}
|
68
|
+
|
69
|
+
Create a new git and related GitHub's repository
|
70
|
+
$ rake create_repo
|
71
|
+
|
72
|
+
Commit and push until you are happy with your changes
|
73
|
+
...
|
74
|
+
|
75
|
+
Generate a version
|
76
|
+
$ rake version:write
|
77
|
+
|
78
|
+
Tag and push release to git
|
79
|
+
$ rake git:release
|
80
|
+
|
81
|
+
Shared your collection in https://rubygems.org
|
82
|
+
$ rake release
|
83
|
+
|
84
|
+
Visit README.md for more details.
|
41
85
|
|
42
86
|
#{'*' * 80}
|
43
87
|
}
|
@@ -45,15 +89,34 @@ module CenitCmd
|
|
45
89
|
|
46
90
|
no_tasks do
|
47
91
|
def class_name
|
48
|
-
Thor::Util.camel_case
|
92
|
+
Thor::Util.camel_case @collection_name
|
49
93
|
end
|
50
94
|
|
51
|
-
def
|
52
|
-
unless file_name =~
|
53
|
-
@file_name = Thor::Util.snake_case(file_name)
|
95
|
+
def use_prefix(prefix)
|
96
|
+
unless file_name =~ /^#{prefix}/
|
97
|
+
@file_name = prefix + Thor::Util.snake_case(file_name)
|
54
98
|
end
|
55
99
|
end
|
56
|
-
|
100
|
+
|
101
|
+
# Expose git config here, so we can stub it out for test environments
|
102
|
+
def git_config
|
103
|
+
@git_config ||= Pathname.new("~/.gitconfig").expand_path.exist? ? Git.global_config : {}
|
104
|
+
end
|
57
105
|
|
106
|
+
def validate_argument
|
107
|
+
if @user_name.nil?
|
108
|
+
$stderr.puts %Q{No user.name found in ~/.gitconfig. Please tell git about yourself (see http://help.github.com/git-email-settings/ for details). For example: git config --global user.name "mad voo"}
|
109
|
+
return false
|
110
|
+
elsif @user_email.nil?
|
111
|
+
$stderr.puts %Q{No user.email found in ~/.gitconfig. Please tell git about yourself (see http://help.github.com/git-email-settings/ for details). For example: git config --global user.email mad.vooo@gmail.com}
|
112
|
+
return false
|
113
|
+
elsif @github_username.nil?
|
114
|
+
$stderr.puts %Q{Please specify --github-username or set github.user in ~/.gitconfig (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt}
|
115
|
+
return false
|
116
|
+
end
|
117
|
+
true
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
58
121
|
end
|
59
122
|
end
|
@@ -1,10 +1,20 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
gem 'cenit-collection-base'
|
4
|
+
gem 'cenit-client'
|
5
|
+
gem 'activesupport'
|
2
6
|
|
3
|
-
|
4
|
-
gem '
|
7
|
+
# Include Cenit Collection Gem dependency
|
8
|
+
# gem 'cenit-collection-[My Dependency]'
|
5
9
|
|
6
|
-
gem
|
7
|
-
|
10
|
+
# Add dependencies to develop your gem here.
|
11
|
+
# Include everything needed to run rake, tests, features, etc.
|
12
|
+
group :development do
|
13
|
+
gem "rspec", "~> 2.8.0"
|
14
|
+
gem "rdoc", "~> 3.12"
|
15
|
+
gem "bundler", "~> 1.0"
|
16
|
+
gem "jeweler", "~> 2.0.1"
|
17
|
+
gem "simplecov", ">= 0"
|
18
|
+
end
|
8
19
|
|
9
|
-
gemspec
|
10
20
|
|
@@ -0,0 +1,330 @@
|
|
1
|
+
This is a new Shared Collection (integration settgings) to be use in Cenit, named <%= file_name %>.
|
2
|
+
|
3
|
+
Cenit is an open source social platform as a service for data and business integration.
|
4
|
+
|
5
|
+
# CenitCollection<%= class_name %>
|
6
|
+
|
7
|
+
You'll find the files you need to be able to package up your Collection library into a gem. To experiment with that collection use `rake console` for an interactive prompt.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem '<%= file_name %>'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install <%= file_name %>
|
24
|
+
|
25
|
+
### Structure
|
26
|
+
|
27
|
+
```
|
28
|
+
% tree
|
29
|
+
.
|
30
|
+
├── cenit-collection-'<%= file_name %>'.gemspec
|
31
|
+
├── Gemfile
|
32
|
+
├── .gitignore
|
33
|
+
├── .rspec
|
34
|
+
├── README.md
|
35
|
+
├── Rakefile
|
36
|
+
├── LICENSE
|
37
|
+
└── lib
|
38
|
+
└── cenit
|
39
|
+
└── collection
|
40
|
+
└── '<%= file_name %>'
|
41
|
+
└── connections
|
42
|
+
└── webhooks
|
43
|
+
└── connection_sets
|
44
|
+
└── translators
|
45
|
+
└── events
|
46
|
+
└── flows
|
47
|
+
└── libraries
|
48
|
+
└── index.json
|
49
|
+
└── build.rb
|
50
|
+
└── version.rb
|
51
|
+
└── '<%= file_name %>'.rb
|
52
|
+
└── spec
|
53
|
+
└── cenit
|
54
|
+
└── collection
|
55
|
+
└── '<%= file_name %>'_spec.rb
|
56
|
+
└── spec_helper.rb
|
57
|
+
└── support
|
58
|
+
└── samples
|
59
|
+
```
|
60
|
+
|
61
|
+
### Upload your Shared Collection to Cenit Hub.
|
62
|
+
|
63
|
+
run `rake console`
|
64
|
+
|
65
|
+
Configure your Cenithub Client API
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
config = {push_url: 'https://www.cenithub.com/api/v1/push',connection_key: 'My Conn Key',connection_token: 'My Conn Token'}
|
69
|
+
```
|
70
|
+
OR
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
config = {push_url: 'https://www.cenithub.com/api/v1/push',user_key: 'My User Key',user_token: 'My User Token'}
|
74
|
+
```
|
75
|
+
Show Hash Collection
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
Cenit::Collection::<%= class_name %>.show_collection(config)
|
79
|
+
```
|
80
|
+
|
81
|
+
Load Shared Collection into CenitHub
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
Cenit::Collection::<%= class_name %>.push_collection(config)
|
85
|
+
```
|
86
|
+
|
87
|
+
Setup Shared Collection into CenitHub
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
Cenit::Collection::<%= class_name %>.pull_collection(config)
|
91
|
+
```
|
92
|
+
Push sample data into Cenithub
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
Cenit::Collection::<%= class_name %>.push_sample(config)
|
96
|
+
```
|
97
|
+
## Hello, rake tasks
|
98
|
+
|
99
|
+
Beyond just editing source code, you'll be interacting with your gem using `rake` a lot. To see all the tasks available with a brief description, you can run:
|
100
|
+
|
101
|
+
$ rake -T
|
102
|
+
|
103
|
+
You'll need a version before you can start installing your gem locally. The easiest way is with the `version:write` Rake task. Let's imagine you start with 0.1.0
|
104
|
+
|
105
|
+
$ rake version:write MAJOR=0 MINOR=1 PATCH=0
|
106
|
+
|
107
|
+
You can now go forth and develop, now that there's an initial version defined. Eventually, you should install and test the gem:
|
108
|
+
|
109
|
+
$ rake install
|
110
|
+
|
111
|
+
The `install` rake task builds the gem and `gem install`s it. You're all set if you're using [RVM](http://rvm.beginrescueend.com/), but you may need to run it with sudo if you have a system-installed ruby:
|
112
|
+
|
113
|
+
$ sudo rake install
|
114
|
+
|
115
|
+
### Create Git and Github repos
|
116
|
+
|
117
|
+
$ rake create_git_and_github_repo
|
118
|
+
|
119
|
+
### Releasing
|
120
|
+
|
121
|
+
At last, it's time to [ship it](http://shipitsquirrel.github.com/)! Make sure you have everything committed and pushed, then go wild:
|
122
|
+
|
123
|
+
$ rake release
|
124
|
+
|
125
|
+
This will automatically:
|
126
|
+
|
127
|
+
* Generate `hello-gem.gemspec` and commit it
|
128
|
+
* Use `git` to tag `v0.1.0` and push it
|
129
|
+
* Build `hello-gem-0.1.0.gem` and push it to [rubygems.org](http://rubygems.org/gems/)
|
130
|
+
|
131
|
+
`rake release` accepts REMOTE(default: `origin`), LOCAL_BRANCH(default: `master`), REMOTE_BRANCH(default: `master`) and BRANCH(default: master)as options.
|
132
|
+
|
133
|
+
$ rake release REMOTE=upstream LOCAL_BRANCH=critical-security-fix REMOTE_BRANCH=v3
|
134
|
+
|
135
|
+
This will tag and push the commits on your local branch named `critical-security-fix` to branch named `v3` in remote named `upstream` (if you have commit rights
|
136
|
+
on `upstream`) and release the gem.
|
137
|
+
|
138
|
+
$ rake release BRANCH=v3
|
139
|
+
|
140
|
+
If both remote and local branches are the same, use `BRANCH` option to simplify.
|
141
|
+
This will tag and push the commits on your local branch named `v3` to branch named `v3` in remote named `origin` (if you have commit rights
|
142
|
+
on `origin`) and release the gem.
|
143
|
+
|
144
|
+
### Version bumping
|
145
|
+
|
146
|
+
It feels good to release code. Do it, do it often. But before that, bump the version. Then release it. There's a few ways to update the version:
|
147
|
+
|
148
|
+
# version:write like before
|
149
|
+
$ rake version:write MAJOR=0 MINOR=3 PATCH=0
|
150
|
+
|
151
|
+
# bump just major, ie 0.1.0 -> 1.0.0
|
152
|
+
$ rake version:bump:major
|
153
|
+
|
154
|
+
# bump just minor, ie 0.1.0 -> 0.2.0
|
155
|
+
$ rake version:bump:minor
|
156
|
+
|
157
|
+
# bump just patch, ie 0.1.0 -> 0.1.1
|
158
|
+
$ rake version:bump:patch
|
159
|
+
|
160
|
+
Then it's the same `release` we used before:
|
161
|
+
|
162
|
+
$ rake release
|
163
|
+
|
164
|
+
## Customizing your gem
|
165
|
+
|
166
|
+
If you've been following along so far, your gem is just a blank slate. You're going to need to make it colorful and full of metadata.
|
167
|
+
|
168
|
+
You can customize your gem by updating your `Rakefile`. With a newly generated project, it will look something like this:
|
169
|
+
|
170
|
+
require 'jeweler'
|
171
|
+
Jeweler::Tasks.new do |gem|
|
172
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
173
|
+
gem.name = "whatwhatwhat"
|
174
|
+
gem.summary = %Q{TODO: one-line summary of your gem}
|
175
|
+
gem.description = %Q{TODO: longer description of your gem}
|
176
|
+
gem.email = "josh@technicalpickles.com"
|
177
|
+
gem.homepage = "http://github.com/technicalpickles/whatwhatwhat"
|
178
|
+
gem.authors = ["Joshua Nichols"]
|
179
|
+
end
|
180
|
+
Jeweler::RubygemsDotOrgTasks.new
|
181
|
+
|
182
|
+
It's crucial to understand the `gem` object is just a Gem::Specification. You can read up about it at [guides.rubygems.org/specification-reference](http://guides.rubygems.org/specification-reference/). This is the most basic way of specifying a gem, Jeweler-managed or not. Jeweler just exposes this to you, in addition to providing some reasonable defaults, which we'll explore now.
|
183
|
+
|
184
|
+
### Project information
|
185
|
+
|
186
|
+
gem.name = "whatwhatwhat"
|
187
|
+
|
188
|
+
Every gem has a name. Among other things, the gem name is how you are able to `gem install` it. [Reference](http://guides.rubygems.org/specification-reference/#name)
|
189
|
+
|
190
|
+
gem.summary = %Q{TODO: one-line summary of your gem}
|
191
|
+
|
192
|
+
This is a one line summary of your gem. This is displayed, for example, when you use `gem list --details` or view it on [rubygems.org](http://rubygems.org/gems/).
|
193
|
+
|
194
|
+
gem.description = %Q{TODO: longer description of your gem}
|
195
|
+
|
196
|
+
Description is a longer description. Scholars ascertain that knowledge of where the description is used was lost centuries ago.
|
197
|
+
|
198
|
+
gem.email = "josh@technicalpickles.com"
|
199
|
+
|
200
|
+
This should be a way to get a hold of you regarding the gem.
|
201
|
+
|
202
|
+
gem.homepage = "http://github.com/technicalpickles/whatwhatwhat"
|
203
|
+
|
204
|
+
The homepage should have more information about your gem. The jeweler generator guesses this based on the assumption your code lives on [GitHub](http://github.com/), using your Git configuration to find your GitHub username. This is displayed by `gem list --details` and on rubygems.org.
|
205
|
+
|
206
|
+
gem.authors = ["Joshua Nichols"]
|
207
|
+
|
208
|
+
Hey, this is you, the author (or me in this case). The `jeweler` generator also guesses this from your Git configuration. This is displayed by `gem list --details` and on rubygems.org.
|
209
|
+
|
210
|
+
### Files
|
211
|
+
|
212
|
+
The quickest way to add more files is to `git add` them. Jeweler uses your Git repository to populate your gem's files by including added and committed and excluding `.gitignore`d. In most cases, this is reasonable enough.
|
213
|
+
|
214
|
+
If you need to tweak the files, that's cool. Jeweler populates `gem.files` as a `Rake::FileList`. It's like a normal array, except you can `include` and `exclude` file globs:
|
215
|
+
|
216
|
+
gem.files.exclude 'tmp' # exclude temporary directory
|
217
|
+
gem.files.include 'lib/foo/bar.rb' # explicitly include lib/foo/bar.rb
|
218
|
+
|
219
|
+
If that's not enough, you can just set `gem.files` outright
|
220
|
+
|
221
|
+
gem.files = Dir.glob('lib/**/*.rb')
|
222
|
+
|
223
|
+
### Dependencies
|
224
|
+
|
225
|
+
Dependencies let you define other gems that your gem needs to function. `gem install your-gem` will install your-gem's dependencies along with it, and when you use your-gem in an application, the dependencies will be made available. Use `gem.add_dependency` to register them. [Reference](http://guides.rubygems.org/specification-reference/#add_development_dependency)
|
226
|
+
|
227
|
+
gem.add_dependency 'nokogiri'
|
228
|
+
|
229
|
+
This will ensure a version of `nokogiri` is installed, but it doesn't require anything more than that. You can provide extra args to be more specific:
|
230
|
+
|
231
|
+
gem.add_dependency 'nokogiri', '= 1.2.1' # exactly version 1.2.1
|
232
|
+
gem.add_dependency 'nokogiri', '>= 1.2.1' # greater than or equal to 1.2.1, ie, 1.2.1, 1.2.2, 1.3.0, 2.0.0, etc
|
233
|
+
gem.add_dependency 'nokogiri', '>= 1.2.1', '< 1.3.0' # greater than or equal to 1.2.1, but less than 1.3.0
|
234
|
+
gem.add_dependency 'nokogiri', '~> 1.2.1' # same thing, but more concise
|
235
|
+
|
236
|
+
When specifying which version is required, there's a bit of the condunrum. You want to allow the most versions possible, but you want to be sure they are compatible. Using `>= 1.2.1` is fine most of the time, except until the point that 2.0.0 comes out and totally breaks backwards the API. That's when it's good to use `~> 1.2.1`, which requires any version in the `1.2` family, starting with `1.2.1`.
|
237
|
+
|
238
|
+
### Executables
|
239
|
+
|
240
|
+
Executables let your gem install shell commands. Just put any executable scripts in the `bin/` directory, make sure they are added using `git`, and Jeweler will take care of the rest.
|
241
|
+
|
242
|
+
When you need more finely grained control over it, you can set it yourself:
|
243
|
+
|
244
|
+
gem.executables = ['foo'] # note, it's the file name relative to `bin/`, not the project root
|
245
|
+
|
246
|
+
### Versioning
|
247
|
+
|
248
|
+
We discussed earlier how to bump the version. The rake tasks are really just convience methods for manipulating the `VERSION` file. It just contains a version string, like `1.2.3`.
|
249
|
+
|
250
|
+
`VERSION` is a convention used by Jeweler, and is used to populate `gem.version`. You can actually set this yourself, and Jeweler won't try to override it:
|
251
|
+
|
252
|
+
gem.version = '1.2.3'
|
253
|
+
|
254
|
+
A common pattern is to have this in a version constant in your library. This is convenient, because users of the library can query the version they are using at runtime.
|
255
|
+
|
256
|
+
# in lib/foo/version.rb
|
257
|
+
class Foo
|
258
|
+
module Version
|
259
|
+
MAJOR = 1
|
260
|
+
MINOR = 2
|
261
|
+
PATCH = 3
|
262
|
+
BUILD = 'pre3'
|
263
|
+
|
264
|
+
STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
# in Rakefile
|
269
|
+
require 'jeweler'
|
270
|
+
require './lib/foo/version.rb'
|
271
|
+
Jeweler::Tasks.new do |gem|
|
272
|
+
# snip
|
273
|
+
gem.version = Foo::Version::STRING
|
274
|
+
end
|
275
|
+
|
276
|
+
## Development
|
277
|
+
|
278
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
279
|
+
|
280
|
+
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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
281
|
+
|
282
|
+
## Contributing
|
283
|
+
|
284
|
+
1. Fork it ( https://github.com/[my-github-username]/<%= file_name %>/fork )
|
285
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
286
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
287
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
288
|
+
5. Create a new Pull Request
|
289
|
+
|
290
|
+
## Cenit
|
291
|
+
|
292
|
+
Cenit is an open source social platform as a service for data and business integration.
|
293
|
+
|
294
|
+
### What is
|
295
|
+
|
296
|
+
Cenit is a social platform as a service for data and business integration. It makes possible
|
297
|
+
the automation of all operational processes, connecting legacy apps and internet services.
|
298
|
+
|
299
|
+
### Why were doing this
|
300
|
+
|
301
|
+
A common story for companies is the blending of solutions around its core business value.
|
302
|
+
Features developed by them, third-party's adaptations and other SaaS to facilitate operations.
|
303
|
+
|
304
|
+
Once grown enough a new expansion requires a huge integration effort. But available integration
|
305
|
+
solutions are heavy process. Some of them also need B2B transactions using complex EDI standards
|
306
|
+
required for large companies or business sectors.
|
307
|
+
|
308
|
+
This facts overkill many companies that can’t overcome these challenges.
|
309
|
+
|
310
|
+
### General Feature
|
311
|
+
|
312
|
+
* 100% Open Source platform as a service (Open-PaaS).
|
313
|
+
* Hub with a great design that provides powerful yet simple abstractions, making a complex problem tractable.
|
314
|
+
* Primary concepts are: Data Type, Webhook, Flow, Event, Connection and Transform.
|
315
|
+
* Dynamic load schemas: XSD, JSON and EDI grammars.
|
316
|
+
* Powerful transform to translates and modified any formats to any format.
|
317
|
+
* Full Stack HTTP API and incremental API's helper libraries in several languages.
|
318
|
+
* Export and import integration settings (collections), and automatically saves its as a repo on github.
|
319
|
+
* Social networking features to share collections.
|
320
|
+
|
321
|
+
### Shared Collections
|
322
|
+
|
323
|
+
There are now over 25 pre-built shared integration collections out the box for connecting
|
324
|
+
to internet services, fulfilment solutions, accounting, communications, ERP, multi-channels, etc.
|
325
|
+
|
326
|
+
### Join us
|
327
|
+
|
328
|
+
* Github project: https://github.com/openjaf/cenit
|
329
|
+
* Email: support@cenitsaas.com
|
330
|
+
* Website: http://www.cenitsaas.com
|
@@ -0,0 +1,78 @@
|
|
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 = '<%= file_name %>'
|
18
|
+
gem.license = "MIT"
|
19
|
+
gem.summary = '<%= @summary -%>'
|
20
|
+
gem.description = '<%= @description -%>'
|
21
|
+
gem.author = '<%= @user_name -%>'
|
22
|
+
gem.email = '<%= @user_email -%>'
|
23
|
+
gem.homepage = '<%= @homepage -%>'
|
24
|
+
|
25
|
+
# dependencies defined in Gemfile
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
class Jeweler::Generator
|
30
|
+
def target_dir
|
31
|
+
'.'
|
32
|
+
end
|
33
|
+
def create_git_and_github_repo
|
34
|
+
create_version_control
|
35
|
+
create_and_push_repo
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "create a new git and related GitHub's repository'"
|
40
|
+
task :create_repo do
|
41
|
+
options = {
|
42
|
+
project_name: '<%= file_name -%>',
|
43
|
+
user_name: '<%= @user_name -%>',
|
44
|
+
user_email: '<%= @user_email -%>',
|
45
|
+
github_username: '<%= @github_username -%>',
|
46
|
+
summary: '<%= @summary -%>',
|
47
|
+
description: '<%= @description -%>',
|
48
|
+
homepage: '<%= @homepage -%>',
|
49
|
+
testing_framework: :rspec,
|
50
|
+
documentation_framework: :rdoc
|
51
|
+
}
|
52
|
+
g = Jeweler::Generator.new(options)
|
53
|
+
g.create_git_and_github_repo
|
54
|
+
end
|
55
|
+
|
56
|
+
require 'rspec/core'
|
57
|
+
require 'rspec/core/rake_task'
|
58
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
59
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "Code coverage detail"
|
63
|
+
task :simplecov do
|
64
|
+
ENV['COVERAGE'] = "true"
|
65
|
+
Rake::Task['spec'].execute
|
66
|
+
end
|
67
|
+
|
68
|
+
task :default => :spec
|
69
|
+
|
70
|
+
require 'rdoc/task'
|
71
|
+
Rake::RDocTask.new do |rdoc|
|
72
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
73
|
+
|
74
|
+
rdoc.rdoc_dir = 'rdoc'
|
75
|
+
rdoc.title = "<%= file_name -%> #{version}"
|
76
|
+
rdoc.rdoc_files.include('README*')
|
77
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
78
|
+
end
|
@@ -1,20 +1,58 @@
|
|
1
|
-
\#*
|
2
|
-
*~
|
3
|
-
.#*
|
4
1
|
.DS_Store
|
5
2
|
.idea
|
6
3
|
.project
|
7
4
|
.sass-cache
|
8
|
-
coverage
|
9
5
|
Gemfile.lock
|
10
6
|
tmp
|
11
7
|
nbproject
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
8
|
+
.bundle
|
9
|
+
spec/reports
|
10
|
+
tmp
|
11
|
+
|
12
|
+
# rcov generated
|
13
|
+
coverage
|
14
|
+
coverage.data
|
15
|
+
|
16
|
+
# rdoc generated
|
17
|
+
rdoc
|
18
|
+
|
19
|
+
# yard generated
|
20
|
+
doc
|
21
|
+
.yardoc
|
22
|
+
_yardoc/
|
23
|
+
|
24
|
+
# bundler
|
25
|
+
.bundle
|
26
|
+
|
27
|
+
# jeweler generated
|
28
|
+
pkg
|
29
|
+
|
30
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
31
|
+
#
|
32
|
+
# * Create a file at ~/.gitignore
|
33
|
+
# * Include files you want ignored
|
34
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
35
|
+
#
|
36
|
+
# After doing this, these files will be ignored in all your git projects,
|
37
|
+
# saving you from having to 'pollute' every project you touch with them
|
38
|
+
#
|
39
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
40
|
+
|
41
|
+
|
42
|
+
# For TextMate
|
43
|
+
#*.tmproj
|
44
|
+
#tmtags
|
45
|
+
|
46
|
+
# For emacs:
|
47
|
+
#*~
|
48
|
+
#\#*
|
49
|
+
#.\#*
|
50
|
+
|
51
|
+
# For vim:
|
52
|
+
#*.swp
|
53
|
+
|
54
|
+
# For redcar:
|
55
|
+
#.redcar
|
56
|
+
|
57
|
+
# For rubinius:
|
58
|
+
#*.rbc
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'cenit/collection/<%= collection_name %>/version'
|
2
|
+
require 'cenit/collection/base/build'
|
3
|
+
|
4
|
+
module Cenit
|
5
|
+
module Collection
|
6
|
+
module <%= class_name %>
|
7
|
+
class Build < Cenit::Collection::Base::Build
|
8
|
+
def initialize
|
9
|
+
super(__dir__)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/cenit_cmd/templates/collection/lib/cenit/collection/%collection_name%/libraries/index.json
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
[{"name": "Library Name","file": "library_dir"}]
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Cenit
|
2
|
+
module Collection
|
3
|
+
require "cenit/collection/<%= collection_name %>/build"
|
4
|
+
require "cenit/client"
|
5
|
+
|
6
|
+
# bundle exec irb -I lib -r 'cenit/collection/<%= collection_name %>'
|
7
|
+
# config = {:push_url => "https://www.cenithub.com/api/v1/push", :connection_token => "My Conn Token", :connection_key => "My Conn Key"}
|
8
|
+
# config = {:push_url => "https://www.cenithub.com/api/v1/push", :user_token => "My User Token", :user_key => "My User Key"}
|
9
|
+
# Cenit::Collection::<%= class_name %>.push_collection config
|
10
|
+
# Cenit::Collection::<%= class_name %>.shared_collection
|
11
|
+
|
12
|
+
@<%= collection_name %> = Cenit::Collection::<%= class_name %>::Build.new
|
13
|
+
|
14
|
+
# Include Collection Gem dependency
|
15
|
+
# require "cenit/collection/[My Dependency Collection]/build"
|
16
|
+
# Collection dependency
|
17
|
+
# @<%= collection_name %>.register_dep(Cenit::Collection::[My Dependency Collection]::Build.new)
|
18
|
+
|
19
|
+
def self.push_collection (config)
|
20
|
+
Cenit::Client.push(@<%= collection_name %>.shared_collection.to_json, config)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.show_collection
|
24
|
+
@<%= collection_name %>.shared_collection
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.pull_collection (parameters,config)
|
28
|
+
@<%= collection_name %>.shared_collection
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.push_sample(model, config)
|
32
|
+
Cenit::Client.push(@<%= collection_name %>.sample_data(model).to_json, config)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,13 +1,31 @@
|
|
1
|
-
# Run Coverage report
|
2
1
|
require 'simplecov'
|
3
|
-
|
4
|
-
|
2
|
+
|
3
|
+
module SimpleCov::Configuration
|
4
|
+
def clean_filters
|
5
|
+
@filters = []
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
SimpleCov.configure do
|
10
|
+
clean_filters
|
11
|
+
load_adapter 'test_frameworks'
|
5
12
|
end
|
6
13
|
|
14
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
15
|
+
add_filter "/.rvm/"
|
16
|
+
end
|
17
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
18
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
19
|
|
8
|
-
|
9
|
-
|
10
|
-
|
20
|
+
require 'rspec'
|
21
|
+
require 'hello-gem'
|
22
|
+
|
23
|
+
require "cenit/collection/<%= collection_name %>/build"
|
24
|
+
require 'cenit/client'
|
25
|
+
|
26
|
+
# Requires supporting files with custom matchers and macros, etc,
|
27
|
+
# in ./support/ and its subdirectories.
|
28
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
11
29
|
|
12
30
|
RSpec.configure do |config|
|
13
31
|
|
@@ -16,4 +34,4 @@ RSpec.configure do |config|
|
|
16
34
|
|
17
35
|
config.mock_with :rspec
|
18
36
|
config.color = true
|
19
|
-
end
|
37
|
+
end
|
data/lib/cenit_cmd/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cenit_cmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Sancho
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
12
|
+
date: 2015-05-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -63,6 +63,7 @@ executables:
|
|
63
63
|
extensions: []
|
64
64
|
extra_rdoc_files: []
|
65
65
|
files:
|
66
|
+
- ".gitignore"
|
66
67
|
- Gemfile
|
67
68
|
- Gemfile.lock
|
68
69
|
- LICENSE.txt
|
@@ -73,20 +74,16 @@ files:
|
|
73
74
|
- cenit_cmd.gemspec
|
74
75
|
- lib/cenit_cmd.rb
|
75
76
|
- lib/cenit_cmd/collection.rb
|
76
|
-
- lib/cenit_cmd/templates/bin/console.tt
|
77
|
-
- lib/cenit_cmd/templates/bin/setup.tt
|
78
77
|
- lib/cenit_cmd/templates/collection/CONTRIBUTING.md
|
79
78
|
- lib/cenit_cmd/templates/collection/Gemfile
|
80
|
-
- lib/cenit_cmd/templates/collection/LICENSE
|
81
|
-
- lib/cenit_cmd/templates/collection/README.md
|
82
|
-
- lib/cenit_cmd/templates/collection/Rakefile
|
83
|
-
- lib/cenit_cmd/templates/collection/collection.gemspec
|
79
|
+
- lib/cenit_cmd/templates/collection/LICENSE.tt
|
80
|
+
- lib/cenit_cmd/templates/collection/README.md.tt
|
81
|
+
- lib/cenit_cmd/templates/collection/Rakefile.tt
|
84
82
|
- lib/cenit_cmd/templates/collection/gitignore
|
85
|
-
- lib/cenit_cmd/templates/collection/lib/%
|
86
|
-
- lib/cenit_cmd/templates/collection/lib/%
|
87
|
-
- lib/cenit_cmd/templates/collection/lib/%
|
88
|
-
- lib/cenit_cmd/templates/collection/lib/%
|
89
|
-
- lib/cenit_cmd/templates/collection/lib/%file_name%/version.rb.tt
|
83
|
+
- lib/cenit_cmd/templates/collection/lib/cenit/collection/%collection_name%.rb.tt
|
84
|
+
- lib/cenit_cmd/templates/collection/lib/cenit/collection/%collection_name%/build.rb.tt
|
85
|
+
- lib/cenit_cmd/templates/collection/lib/cenit/collection/%collection_name%/index.json.tt
|
86
|
+
- lib/cenit_cmd/templates/collection/lib/cenit/collection/%collection_name%/libraries/index.json
|
90
87
|
- lib/cenit_cmd/templates/collection/rspec
|
91
88
|
- lib/cenit_cmd/templates/collection/spec/spec_helper.rb.tt
|
92
89
|
- lib/cenit_cmd/version.rb
|
@@ -115,3 +112,4 @@ signing_key:
|
|
115
112
|
specification_version: 4
|
116
113
|
summary: Cenit Hub command line utility
|
117
114
|
test_files: []
|
115
|
+
has_rdoc:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<%= class_name %>
|
2
|
-
<%= "=" * class_name.size %>
|
3
|
-
|
4
|
-
Introduction goes here.
|
5
|
-
|
6
|
-
Installation
|
7
|
-
------------
|
8
|
-
|
9
|
-
Install <%= file_name %> gem:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem install <%= file_name %>
|
13
|
-
```
|
14
|
-
|
15
|
-
Copyright (c) <%= Time.now.year %> [name of extension creator], released under the MIT License
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler::GemHelper.install_tasks
|
3
|
-
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
RSpec::Core::RakeTask.new
|
7
|
-
|
8
|
-
task :default do
|
9
|
-
Rake::Task[:spec].invoke
|
10
|
-
end
|
11
|
-
|
12
|
-
desc 'Run specs'
|
13
|
-
RSpec::Core::RakeTask.new do |t|
|
14
|
-
t.pattern = './spec/**/*_spec.rb'
|
15
|
-
end
|
16
|
-
|
17
|
-
desc 'Generate code coverage'
|
18
|
-
RSpec::Core::RakeTask.new(:coverage) do |t|
|
19
|
-
t.rcov = true
|
20
|
-
t.rcov_opts = ['--exclude', '/gems/,spec']
|
21
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '<%= file_name %>/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.platform = Gem::Platform::RUBY
|
8
|
-
s.name = '<%= file_name %>'
|
9
|
-
s.version = <%= class_name %>::VERSION
|
10
|
-
s.summary = 'TODO: Add gem summary here'
|
11
|
-
s.description = 'TODO: Add (optional) gem description here'
|
12
|
-
s.required_ruby_version = '>= 2.0.0'
|
13
|
-
|
14
|
-
# s.author = 'You'
|
15
|
-
# s.email = 'you@example.com'
|
16
|
-
# s.homepage = 'http://www.cenitsaas.com'
|
17
|
-
|
18
|
-
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
-
s.bindir = 'bin'
|
20
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
-
s.require_paths = ["lib"]
|
22
|
-
|
23
|
-
s.add_development_dependency "bundler", "~> 1.9"
|
24
|
-
s.add_development_dependency "rake", "~> 10.0"
|
25
|
-
s.requirements << 'none'
|
26
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
[{"name": "MyLibrary","file": "my_library"}]
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require '<%=file_name%>/version'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
module <%=class_name%>
|
5
|
-
|
6
|
-
require '<%=file_name%>/base'
|
7
|
-
require 'cenit_client/client'
|
8
|
-
require 'collection_base'
|
9
|
-
#require 'my_dependency_collection/base'
|
10
|
-
|
11
|
-
@c = <%=class_name%>::Collection.new
|
12
|
-
|
13
|
-
@collection_dep = []
|
14
|
-
# @collection_dep << MyDepCollection::Collection.new
|
15
|
-
|
16
|
-
def self.build_collection
|
17
|
-
shared = {}
|
18
|
-
models = ['flows','connection_roles','translators','events','connections','webhooks']
|
19
|
-
models.collect do |model|
|
20
|
-
hash =[]
|
21
|
-
@collection_dep.collect do |collection|
|
22
|
-
hash = hash + collection.process_model(model)
|
23
|
-
end
|
24
|
-
shared.merge!({model => hash + @c.process_model(model)})
|
25
|
-
end
|
26
|
-
hash =[]
|
27
|
-
@collection_dep.collect do |collection|
|
28
|
-
hash = hash + collection.process_libraries
|
29
|
-
end
|
30
|
-
shared.merge!({'libraries' => hash + @c.process_libraries})
|
31
|
-
{"data" => shared}
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.shared_collection
|
35
|
-
shared = @c.shared_base
|
36
|
-
shared.merge!(build_collection)
|
37
|
-
{"shared_collection" => shared}
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.push_collection (config)
|
41
|
-
Cenithub::Client.push(shared_collection.to_json, config)
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.push_sample(model, config)
|
45
|
-
sample_data = @c.sample_data(model)
|
46
|
-
Cenithub::Client.push(sample_data.to_json, config)
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|