molflow 0.3.0 → 0.3.1
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/.rubocop.yml +35 -0
- data/Gemfile +8 -1
- data/Guardfile +22 -0
- data/README.md +32 -3
- data/bin/mf +5 -0
- data/lib/molflow.rb +4 -7
- data/lib/molflow/cli.rb +8 -27
- data/lib/molflow/command_options.rb +55 -0
- data/lib/molflow/commands/install.rb +42 -0
- data/lib/molflow/commands/install/molflow +19 -0
- data/lib/molflow/commands/jira.rb +37 -0
- data/lib/molflow/commands/jira/client.rb +26 -0
- data/lib/molflow/commands/jira/issue.rb +31 -0
- data/lib/molflow/commands/jira/issues.rb +32 -0
- data/lib/molflow/commands/jira/projects.rb +19 -0
- data/lib/molflow/{cli → commands}/task.rb +1 -1
- data/lib/molflow/error.rb +21 -0
- data/lib/molflow/version.rb +1 -1
- data/molflow +19 -0
- data/molflow.gemspec +1 -1
- data/spec/molflow/cli/install_spec.rb +15 -0
- data/spec/molflow/cli/jira_spec.rb +11 -0
- data/spec/molflow/cli_spec.rb +0 -0
- data/spec/spec_helper.rb +23 -2
- metadata +19 -9
- data/lib/Rakefile +0 -2
- data/lib/molflow/cli/install.rb +0 -30
- data/lib/molflow/cli/install/molflow +0 -3
- data/lib/molflow/cli/jira_issues.rb +0 -20
- data/lib/molflow/cli/jira_projects.rb +0 -18
- data/lib/molflow/jira.rb +0 -22
- data/spec/molflow_spec.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea5019f29cd9ff335ed1d4d8d30d868a7609fe35
|
4
|
+
data.tar.gz: 3ad23900634dd78b993b42d5504ddc729f9dac83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbe6b51dc69912b2e6ce3f146da0006dfc47c2f4857aeef4a88329585d3d232b9f0a8f10d07eb00f1dd124b25827e30c248b5dd22e11dd2487a7cfe8cd000118
|
7
|
+
data.tar.gz: 32fbad506e3cc1f7ff04875a6c17a090c3a25399203a7ee367434920f3d8d947220de50fc223e3da30637fdf9b2e9a7316da43af846eee36ba44c4e001d657cc
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
Style/AsciiComments:
|
2
|
+
Enabled: false
|
3
|
+
Metrics/LineLength:
|
4
|
+
Max: 120
|
5
|
+
Documentation:
|
6
|
+
Enabled: false
|
7
|
+
Style/ClassAndModuleChildren:
|
8
|
+
SupportedStyles:
|
9
|
+
- nested
|
10
|
+
- compact
|
11
|
+
SingleSpaceBeforeFirstArg:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
AllCops:
|
15
|
+
Includes:
|
16
|
+
- Gemfile
|
17
|
+
- Rakefile
|
18
|
+
Excludes:
|
19
|
+
- bin/**
|
20
|
+
- vendor/**
|
21
|
+
- .bundle/**
|
22
|
+
|
23
|
+
SymbolArray:
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
CollectionMethods:
|
27
|
+
PreferredMethods:
|
28
|
+
collect: 'map'
|
29
|
+
inject: 'reduce'
|
30
|
+
detect: 'find'
|
31
|
+
find_all: 'select'
|
32
|
+
|
33
|
+
SpaceInsideHashLiteralBraces:
|
34
|
+
EnforcedStyleIsWithSpaces: false
|
35
|
+
|
data/Gemfile
CHANGED
@@ -5,7 +5,14 @@ gemspec
|
|
5
5
|
|
6
6
|
gem 'molflow', path: '../molflow'
|
7
7
|
gem 'pry'
|
8
|
+
gem 'rest-client'
|
8
9
|
|
9
10
|
group :test do
|
10
|
-
gem
|
11
|
+
gem 'generator_spec'
|
12
|
+
gem 'guard-rspec', require: false
|
13
|
+
gem 'simplecov', require: false
|
14
|
+
gem 'simplecov-console', require: false
|
15
|
+
gem 'pry'
|
16
|
+
gem 'genspec', require: false
|
17
|
+
gem 'mocha'
|
11
18
|
end
|
data/Guardfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
2
|
+
require "guard/rspec/dsl"
|
3
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
4
|
+
|
5
|
+
# Feel free to open issues for suggestions and improvements
|
6
|
+
|
7
|
+
# RSpec files
|
8
|
+
rspec = dsl.rspec
|
9
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
10
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
11
|
+
watch(rspec.spec_files)
|
12
|
+
|
13
|
+
# Ruby files
|
14
|
+
ruby = dsl.ruby
|
15
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
16
|
+
|
17
|
+
# Turnip features and steps
|
18
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
19
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
20
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
21
|
+
end
|
22
|
+
end
|
data/README.md
CHANGED
@@ -9,12 +9,41 @@
|
|
9
9
|
|
10
10
|
Затем нужно сконфигурировать
|
11
11
|
|
12
|
-
$ molflow install
|
12
|
+
$ molflow install [-p 'PATH']
|
13
|
+
|
14
|
+
**Важно!**: Если выбран не стандартный путь `~/.molflow`, тогда нужно добавить в `~/.bashrc` или `~/.zshrc`
|
15
|
+
следующую строчку:
|
16
|
+
|
17
|
+
export MOLFLOW_BASE_CONFIG = /custom/path/to/config/.file
|
13
18
|
|
14
19
|
Адрес для atlassian molinos: https://molinos.atlassian.net
|
15
20
|
|
16
21
|
|
17
22
|
## Использование
|
18
23
|
|
19
|
-
|
20
|
-
|
24
|
+
mf help [COMMAND] # Describe available commands or one specific command
|
25
|
+
mf install # molflow setup
|
26
|
+
mf jira help [COMMAND] # Describe subcommands or one specific subcommand
|
27
|
+
mf jira jira i ISSUE_KEY # show issue
|
28
|
+
mf jira jira is # list issues
|
29
|
+
mf jira jira ps # list projects
|
30
|
+
|
31
|
+
## Планы
|
32
|
+
|
33
|
+
|
34
|
+
mf jira fs # list all filters
|
35
|
+
# ? надо с фильтрами разобраться, к каким есть доступ
|
36
|
+
|
37
|
+
|
38
|
+
mf jira i:start REN-215 # change status "to do" > "in progress"
|
39
|
+
# --branch -b : 'git checkout master; git checkout -b REN-215'
|
40
|
+
|
41
|
+
|
42
|
+
mf jira i:verify REN-215 # change status "to do" > "in progress"
|
43
|
+
# --commit -c [:message] - 'git add . ; git commit -m "REN-215: Task name"' #TODO: description
|
44
|
+
# --merge -m :branch - 'git checkout :branch; git rebase REN-215'
|
45
|
+
# --log -l :time - logwork issue
|
46
|
+
|
47
|
+
mf jira i:delegate
|
48
|
+
|
49
|
+
mf init_project # configuration file in directory
|
data/bin/mf
ADDED
data/lib/molflow.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
require 'rake'
|
2
2
|
|
3
|
-
Rake.application.options.trace = true
|
4
|
-
|
5
|
-
require 'molflow/application'
|
6
|
-
require 'molflow/jira_client'
|
7
|
-
require 'molflow/version'
|
8
|
-
|
9
3
|
module Molflow
|
10
|
-
|
4
|
+
|
5
|
+
def self.root
|
6
|
+
File.dirname __dir__
|
7
|
+
end
|
11
8
|
end
|
data/lib/molflow/cli.rb
CHANGED
@@ -1,38 +1,19 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'pry'
|
3
|
+
require 'molflow/command_options'
|
4
|
+
require 'molflow/commands/jira'
|
3
5
|
|
4
6
|
module Molflow
|
5
7
|
class CLI < Thor
|
6
|
-
|
7
|
-
|
8
|
-
desc 'install', 'Install Figaro'
|
9
|
-
|
10
|
-
method_option 'path',
|
11
|
-
aliases: ['-p'],
|
12
|
-
default: "#{ENV['HOME']}/.molflow",
|
13
|
-
desc: 'Specify a configuration file path'
|
8
|
+
extend CommandOptions
|
9
|
+
register(Commands::Jira, 'jira', 'jira <resource>', 'show info jira resource')
|
14
10
|
|
11
|
+
# molflow install
|
12
|
+
method_option 'path', install_options('path')
|
13
|
+
desc 'install', 'molflow setup'
|
15
14
|
def install
|
16
|
-
require 'molflow/
|
15
|
+
require 'molflow/commands/install'
|
17
16
|
Install.start
|
18
17
|
end
|
19
|
-
|
20
|
-
# molflow jira:ps
|
21
|
-
|
22
|
-
desc 'jira:ps', 'The list of projects in jira'
|
23
|
-
|
24
|
-
define_method 'jira:ps' do
|
25
|
-
require 'molflow/cli/jira_projects'
|
26
|
-
JiraProjects.run(options)
|
27
|
-
end
|
28
|
-
|
29
|
-
# molflow jira:is
|
30
|
-
|
31
|
-
desc 'jira:is', 'The list of projects in jira'
|
32
|
-
|
33
|
-
define_method 'jira:is' do
|
34
|
-
require 'molflow/cli/jira_issues'
|
35
|
-
JiraIssues.run(options)
|
36
|
-
end
|
37
18
|
end
|
38
19
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Molflow
|
2
|
+
module CommandOptions
|
3
|
+
|
4
|
+
# molflow install
|
5
|
+
def install_options(key)
|
6
|
+
case key
|
7
|
+
when 'path'
|
8
|
+
{
|
9
|
+
aliases: ['-p'],
|
10
|
+
type: :string,
|
11
|
+
default: "#{ENV['HOME']}/.molflow",
|
12
|
+
desc: 'Specify a configuration file path.'
|
13
|
+
}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def jira_options(key)
|
18
|
+
case key
|
19
|
+
when 'user'
|
20
|
+
{
|
21
|
+
aliases: ['-u'],
|
22
|
+
type: :string,
|
23
|
+
default: 'currentUser()',
|
24
|
+
desc: 'show user issues'
|
25
|
+
}
|
26
|
+
when 'project'
|
27
|
+
{
|
28
|
+
aliases: ['-p'],
|
29
|
+
type: :string,
|
30
|
+
desc: 'show project issues'
|
31
|
+
}
|
32
|
+
when 'status'
|
33
|
+
{
|
34
|
+
type: :string,
|
35
|
+
default: 'To Do,In Progress',
|
36
|
+
desc: 'status filter'
|
37
|
+
}
|
38
|
+
when 'order'
|
39
|
+
{
|
40
|
+
type: :string,
|
41
|
+
aliases: ['-o'],
|
42
|
+
default: 'updatedDate DESC',
|
43
|
+
desc: 'order issues'
|
44
|
+
}
|
45
|
+
when 'issue_key'
|
46
|
+
{
|
47
|
+
type: :string,
|
48
|
+
aliases: [''],
|
49
|
+
default: '',
|
50
|
+
desc: 'order issues'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module Molflow
|
4
|
+
module Commands
|
5
|
+
# Class is used to customize the environment of the OS that will work with this gem.
|
6
|
+
# Default settings for all heme is written to the file ~/.molflow, or as --path parameter
|
7
|
+
class Install < Thor::Group
|
8
|
+
include Thor::Actions
|
9
|
+
extend CommandOptions
|
10
|
+
|
11
|
+
class_option 'path', install_options('path')
|
12
|
+
|
13
|
+
def self.source_root
|
14
|
+
File.expand_path('../install', __FILE__)
|
15
|
+
end
|
16
|
+
|
17
|
+
def init_variables
|
18
|
+
say('')
|
19
|
+
say('Enter your Atlassian credentials.')
|
20
|
+
@site = ask('URL: ')
|
21
|
+
@username = ask('Username: ')
|
22
|
+
@password = ask('Password: ')
|
23
|
+
say('')
|
24
|
+
end
|
25
|
+
|
26
|
+
def copy_configuration
|
27
|
+
template('molflow', options[:path])
|
28
|
+
say('')
|
29
|
+
end
|
30
|
+
|
31
|
+
def enviroment_variable_warning
|
32
|
+
say("IMPORTANT!!! Add 'export MOLFLOW_BASE_CONFIG=#{options[:path]}' to you shell rc file(~/.bashrc or ~/.zshrc)", :yellow)
|
33
|
+
say('')
|
34
|
+
end
|
35
|
+
|
36
|
+
def complete
|
37
|
+
say('COMPLETE!', :green)
|
38
|
+
say('')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# atlassian options for client of jira-ruby gem: https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/client.rb
|
2
|
+
atlassian:
|
3
|
+
site: '<%= @site %>'
|
4
|
+
username: '<%= @username %>'
|
5
|
+
password: '<%= @password %>'
|
6
|
+
auth_type: :basic
|
7
|
+
context_path: ''
|
8
|
+
#signature_method: 'RSA-SHA1',
|
9
|
+
#request_token_path: '/plugins/servlet/oauth/request-token'
|
10
|
+
#authorize_path: '/plugins/servlet/oauth/authorize'
|
11
|
+
#access_token_path: '/plugins/servlet/oauth/access-token'
|
12
|
+
#private_key_file: 'rsakey.pem'
|
13
|
+
#rest_base_path: '/rest/api/2'
|
14
|
+
#consumer_key: nil
|
15
|
+
#consumer_secret: nil
|
16
|
+
#ssl_verify_mode: OpenSSL::SSL::VERIFY_PEER
|
17
|
+
#use_ssl: true,
|
18
|
+
#proxy_address: nil
|
19
|
+
#proxy_port: nil
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'molflow/error'
|
2
|
+
require 'molflow/commands/jira/projects'
|
3
|
+
require 'molflow/commands/jira/issues'
|
4
|
+
require 'molflow/commands/jira/client'
|
5
|
+
require 'molflow/commands/jira/issue'
|
6
|
+
require 'molflow/command_options'
|
7
|
+
require 'thor'
|
8
|
+
|
9
|
+
module Molflow
|
10
|
+
module Commands
|
11
|
+
class Jira < Thor
|
12
|
+
extend Client
|
13
|
+
extend CommandOptions
|
14
|
+
|
15
|
+
method_option 'path', install_options('path')
|
16
|
+
desc 'jira ps', 'list projects'
|
17
|
+
def ps
|
18
|
+
Projects.run
|
19
|
+
end
|
20
|
+
|
21
|
+
method_option 'user', jira_options('user')
|
22
|
+
method_option 'project', jira_options('project')
|
23
|
+
method_option 'status', jira_options('status')
|
24
|
+
method_option 'order', jira_options('order')
|
25
|
+
desc 'jira is', 'list issues'
|
26
|
+
def is
|
27
|
+
Issues.run(options)
|
28
|
+
end
|
29
|
+
|
30
|
+
method_option 'issue_key', jira_options('issue_key')
|
31
|
+
desc 'jira i ISSUE_KEY', 'show issue'
|
32
|
+
def i(issue_key)
|
33
|
+
Issue.run(options.merge issue_key: issue_key)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'jira'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Molflow
|
5
|
+
module Commands
|
6
|
+
class Jira < Thor
|
7
|
+
module Client
|
8
|
+
def client
|
9
|
+
@client ||= JIRA::Client.new(atlassian_configuration)
|
10
|
+
end
|
11
|
+
|
12
|
+
def atlassian_configuration
|
13
|
+
@atlassian_configuration ||= base_config['atlassian'].symbolize_keys
|
14
|
+
end
|
15
|
+
|
16
|
+
def base_config
|
17
|
+
path = ENV['MOLFLOW_BASE_CONFIG'].present? ? ENV['MOLFLOW_BASE_CONFIG'] : "#{ENV['HOME']}/.molflow"
|
18
|
+
|
19
|
+
@base_config ||= YAML.load_file(path)
|
20
|
+
rescue
|
21
|
+
raise BaseConfigurationLoadError, path
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "molflow/commands/jira"
|
2
|
+
require "molflow/commands/task"
|
3
|
+
|
4
|
+
module Molflow
|
5
|
+
module Commands
|
6
|
+
class Jira < Thor
|
7
|
+
class Issue < Task
|
8
|
+
|
9
|
+
def run
|
10
|
+
client = Jira.client
|
11
|
+
issue = client.Issue.find(options["issue_key"])
|
12
|
+
|
13
|
+
puts "#{issue.key} : #{issue.summary} : #{issue.status.name}"
|
14
|
+
puts "creator : #{issue.creator['name']}"
|
15
|
+
puts ""
|
16
|
+
puts issue.description
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def actions
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Actions
|
27
|
+
include Thor::Actions
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "molflow/commands/jira"
|
2
|
+
require "molflow/commands/task"
|
3
|
+
|
4
|
+
module Molflow
|
5
|
+
module Commands
|
6
|
+
class Jira < Thor
|
7
|
+
class Issues < Task
|
8
|
+
def run
|
9
|
+
client = Jira.client
|
10
|
+
jql = "assignee = #{options['user']}"
|
11
|
+
jql += " AND project = '#{options['project']}'" unless options["project"].nil?
|
12
|
+
if options['status'].present?
|
13
|
+
jql += ' AND ('
|
14
|
+
statuses = options['status'].split(',')
|
15
|
+
statuses.each do |status|
|
16
|
+
jql += " OR" if status != statuses.first
|
17
|
+
jql += " status = '#{status}'"
|
18
|
+
end
|
19
|
+
jql += ')'
|
20
|
+
end
|
21
|
+
|
22
|
+
jql += " ORDER BY #{options['order']}"
|
23
|
+
issues = client.Issue.jql(jql)
|
24
|
+
|
25
|
+
issues.each do |issue|
|
26
|
+
puts "#{issue.key} : #{issue.summary}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "molflow/commands/jira"
|
2
|
+
require "molflow/commands/task"
|
3
|
+
|
4
|
+
module Molflow
|
5
|
+
module Commands
|
6
|
+
class Jira < Thor
|
7
|
+
class Projects < Task
|
8
|
+
def run
|
9
|
+
client = Jira.client
|
10
|
+
@projects = client.Project.all
|
11
|
+
|
12
|
+
@projects.each do |project|
|
13
|
+
puts("#{project.key} : #{project.name}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Molflow
|
2
|
+
class Error < StandardError; end
|
3
|
+
|
4
|
+
class BaseConfigurationLoadError < LoadError
|
5
|
+
def initialize(path)
|
6
|
+
message = if File.exist?(path)
|
7
|
+
"Sorry, but the configuration file has an incorrect format. Try `molflow install`.\nPath: #{path}"
|
8
|
+
else
|
9
|
+
"Sorry, but the configuration file is missing on this path: #{path}. Try `molflow install`"
|
10
|
+
end
|
11
|
+
|
12
|
+
super(message)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class MissingKey < Error
|
17
|
+
def initialize(key)
|
18
|
+
super("Missing required configuration key: #{key.inspect}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/molflow/version.rb
CHANGED
data/molflow
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# atlassian options for client of jira-ruby gem: https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/client.rb
|
2
|
+
atlassian:
|
3
|
+
site: 'true'
|
4
|
+
username: 'true'
|
5
|
+
password: 'true'
|
6
|
+
auth_type: :basic
|
7
|
+
context_path: ''
|
8
|
+
#signature_method: 'RSA-SHA1',
|
9
|
+
#request_token_path: '/plugins/servlet/oauth/request-token'
|
10
|
+
#authorize_path: '/plugins/servlet/oauth/authorize'
|
11
|
+
#access_token_path: '/plugins/servlet/oauth/access-token'
|
12
|
+
#private_key_file: 'rsakey.pem'
|
13
|
+
#rest_base_path: '/rest/api/2'
|
14
|
+
#consumer_key: nil
|
15
|
+
#consumer_secret: nil
|
16
|
+
#ssl_verify_mode: OpenSSL::SSL::VERIFY_PEER
|
17
|
+
#use_ssl: true,
|
18
|
+
#proxy_address: nil
|
19
|
+
#proxy_port: nil
|
data/molflow.gemspec
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'molflow/commands/install'
|
3
|
+
|
4
|
+
describe Molflow::Commands::Install do
|
5
|
+
subject(:install) { Molflow::Commands::Install }
|
6
|
+
|
7
|
+
it '#install: generate base configuration file' do
|
8
|
+
install.any_instance.stubs(:ask).returns(true)
|
9
|
+
|
10
|
+
path = "#{Molflow.root}/tmp/.molflow"
|
11
|
+
install.start(['-p', path].compact)
|
12
|
+
|
13
|
+
expect(File.exist?(path)).to be true
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'molflow/cli/jira'
|
3
|
+
|
4
|
+
describe Molflow::CLI::Jira do
|
5
|
+
subject(:jira) { Molflow::CLI::Jira }
|
6
|
+
|
7
|
+
it '#client: get jira client with base config' do
|
8
|
+
jira_client = jira.client
|
9
|
+
expect(jira_client.is_a?(JIRA::Client)).to be true
|
10
|
+
end
|
11
|
+
end
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,25 @@
|
|
1
|
-
require
|
1
|
+
require 'molflow'
|
2
|
+
|
3
|
+
require 'bundler'
|
2
4
|
Bundler.setup
|
5
|
+
Bundler.require(:test)
|
6
|
+
|
7
|
+
require 'rspec/support/spec'
|
8
|
+
require 'mocha/setup'
|
9
|
+
|
10
|
+
if ENV['COVERAGE']
|
11
|
+
require 'simplecov'
|
12
|
+
|
13
|
+
SimpleCov.start do
|
14
|
+
add_filter '/spec/'
|
15
|
+
add_filter '/bin/'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.mock_with :mocha
|
3
21
|
|
4
|
-
|
22
|
+
config.after(:all) do
|
23
|
+
FileUtils.rm_rf(Dir.glob("#{Molflow.root}/tmp"))
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: molflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Silaev
|
@@ -71,29 +71,39 @@ email:
|
|
71
71
|
- dmsilaev@yandex.ru
|
72
72
|
executables:
|
73
73
|
- molflow
|
74
|
+
- mf
|
74
75
|
extensions: []
|
75
76
|
extra_rdoc_files: []
|
76
77
|
files:
|
77
78
|
- ".gitignore"
|
79
|
+
- ".rubocop.yml"
|
78
80
|
- ".travis.yml"
|
79
81
|
- CODE_OF_CONDUCT.md
|
80
82
|
- Gemfile
|
83
|
+
- Guardfile
|
81
84
|
- LICENSE.txt
|
82
85
|
- README.md
|
83
86
|
- Rakefile
|
87
|
+
- bin/mf
|
84
88
|
- bin/molflow
|
85
|
-
- lib/Rakefile
|
86
89
|
- lib/molflow.rb
|
87
90
|
- lib/molflow/cli.rb
|
88
|
-
- lib/molflow/
|
89
|
-
- lib/molflow/
|
90
|
-
- lib/molflow/
|
91
|
-
- lib/molflow/
|
92
|
-
- lib/molflow/
|
93
|
-
- lib/molflow/jira.rb
|
91
|
+
- lib/molflow/command_options.rb
|
92
|
+
- lib/molflow/commands/install.rb
|
93
|
+
- lib/molflow/commands/install/molflow
|
94
|
+
- lib/molflow/commands/jira.rb
|
95
|
+
- lib/molflow/commands/jira/client.rb
|
96
|
+
- lib/molflow/commands/jira/issue.rb
|
97
|
+
- lib/molflow/commands/jira/issues.rb
|
98
|
+
- lib/molflow/commands/jira/projects.rb
|
99
|
+
- lib/molflow/commands/task.rb
|
100
|
+
- lib/molflow/error.rb
|
94
101
|
- lib/molflow/version.rb
|
102
|
+
- molflow
|
95
103
|
- molflow.gemspec
|
96
|
-
- spec/
|
104
|
+
- spec/molflow/cli/install_spec.rb
|
105
|
+
- spec/molflow/cli/jira_spec.rb
|
106
|
+
- spec/molflow/cli_spec.rb
|
97
107
|
- spec/spec_helper.rb
|
98
108
|
homepage:
|
99
109
|
licenses:
|
data/lib/Rakefile
DELETED
data/lib/molflow/cli/install.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'thor/group'
|
2
|
-
|
3
|
-
module Molflow
|
4
|
-
class CLI < Thor
|
5
|
-
class Install < Thor::Group
|
6
|
-
include Thor::Actions
|
7
|
-
|
8
|
-
class_option 'path',
|
9
|
-
aliases: ['-p'],
|
10
|
-
default: "#{ENV['HOME']}/.molflow",
|
11
|
-
desc: 'Specify a configuration file path'
|
12
|
-
|
13
|
-
def self.source_root
|
14
|
-
File.expand_path('../install', __FILE__)
|
15
|
-
end
|
16
|
-
|
17
|
-
def create_configuration
|
18
|
-
@site = ask('Atlassian site: ')
|
19
|
-
@username = ask('Atlassian username: ')
|
20
|
-
@password = ask('Atlassian password: ')
|
21
|
-
|
22
|
-
template('molflow', options[:path])
|
23
|
-
end
|
24
|
-
|
25
|
-
def complete
|
26
|
-
say('COMPLETE!', :green)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'molflow/jira'
|
2
|
-
require 'molflow/cli/task'
|
3
|
-
|
4
|
-
module Molflow
|
5
|
-
class CLI < Thor
|
6
|
-
class JiraIssues < Task
|
7
|
-
|
8
|
-
def run
|
9
|
-
client = Jira.client
|
10
|
-
jql = 'assignee = currentUser() AND (status = "To Do" OR status = "In Progress") AND (labels not in (Приостановлен) OR labels is EMPTY) ORDER BY updatedDate DESC'
|
11
|
-
|
12
|
-
issues = client.Issue.jql(jql)
|
13
|
-
|
14
|
-
issues.each do |issue|
|
15
|
-
puts "#{issue.key} : #{issue.summary}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require "molflow/jira"
|
2
|
-
require "molflow/cli/task"
|
3
|
-
|
4
|
-
module Molflow
|
5
|
-
class CLI < Thor
|
6
|
-
class JiraProjects < Task
|
7
|
-
|
8
|
-
def run
|
9
|
-
client = Jira.client
|
10
|
-
@projects = client.Project.all
|
11
|
-
|
12
|
-
@projects.each do |project|
|
13
|
-
puts("#{project.key} : #{project.name}")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/molflow/jira.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'jira'
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
module Molflow
|
5
|
-
class Jira
|
6
|
-
def self.client
|
7
|
-
config_path = "#{ENV['HOME']}/.molflow"
|
8
|
-
config_of_file = YAML.load_file(config_path)
|
9
|
-
|
10
|
-
options = {
|
11
|
-
username: config_of_file['username'],
|
12
|
-
password: config_of_file['password'],
|
13
|
-
site: config_of_file['site'],
|
14
|
-
auth_type: :basic,
|
15
|
-
context_path: '',
|
16
|
-
use_ssl: true
|
17
|
-
}
|
18
|
-
|
19
|
-
JIRA::Client.new(options)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|