Skip to content

Commit

Permalink
Merge pull request #34 from BigKeeper/fix_feature_list
Browse files Browse the repository at this point in the history
Fix feature list
  • Loading branch information
sfmDev authored Jun 26, 2019
2 parents 808b313 + a869213 commit 1c0e35b
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 53 deletions.
5 changes: 0 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@ gemspec
group :test do
gem 'rake'
end

if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
34 changes: 17 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bigkeeper (0.9.9)
bigkeeper (0.9.11)
big_resources
big_stash (~> 0.1)
cocoapods
Expand All @@ -18,7 +18,7 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
ast (2.3.0)
ast (2.4.0)
atomos (0.1.3)
big_resources (0.1.2)
chunky_png
Expand All @@ -30,26 +30,26 @@ GEM
gli (~> 2.16)
chunky_png (1.3.11)
claide (1.0.2)
cocoapods (1.6.1)
cocoapods (1.5.0)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.6.1)
cocoapods-core (= 1.5.0)
cocoapods-deintegrate (>= 1.0.2, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-downloader (>= 1.2.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-trunk (>= 1.3.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.2.0, < 3.0)
fourflusher (~> 2.0.1)
gh_inspector (~> 1.0)
molinillo (~> 0.6.6)
molinillo (~> 0.6.5)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.8.1, < 2.0)
cocoapods-core (1.6.1)
ruby-macho (~> 1.1)
xcodeproj (>= 1.5.7, < 2.0)
cocoapods-core (1.5.0)
activesupport (>= 4.0.2, < 6)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
Expand All @@ -67,7 +67,7 @@ GEM
colorize (0.8.1)
concurrent-ruby (1.1.5)
escape (0.0.4)
fourflusher (2.2.0)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
gli (2.18.0)
Expand All @@ -78,11 +78,11 @@ GEM
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
parallel (1.12.0)
parser (2.4.0.0)
ast (~> 2.2)
parallel (1.12.1)
parser (2.5.1.2)
ast (~> 2.4.0)
plist (3.5.0)
powerpack (0.1.1)
powerpack (0.1.2)
rainbow (2.2.2)
rake
rake (10.5.0)
Expand All @@ -98,7 +98,7 @@ GEM
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.3.0)
unicode-display_width (1.4.0)
xcodeproj (1.8.2)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
Expand Down
2 changes: 1 addition & 1 deletion bin/big
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby

require "bundler/setup"
#require "bundler/setup"
require "big_keeper"

# You can add fixtures and/or initialization code here to make experimenting
Expand Down
25 changes: 14 additions & 11 deletions lib/big_keeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
require 'big_keeper/command/spec'
require 'big_keeper/command/image'
require 'big_keeper/command/init'
require 'big_keeper/command/client'
require 'big_keeper/service/git_service'
require 'big_keeper/util/leancloud_logger'

Expand All @@ -40,17 +41,17 @@ module BigKeeper
exit
end

pre do |global_options, command, options, args|
LeanCloudLogger.instance.start_log(global_options, args)
end

post do |global_options, command, options, args|
is_show_log = true
if global_options[:log] == 'false'
is_show_log = false
end
LeanCloudLogger.instance.end_log(true, is_show_log)
end
# pre do |global_options, command, options, args|
# LeanCloudLogger.instance.start_log(global_options, args)
# end
#
# post do |global_options, command, options, args|
# is_show_log = true
# if global_options[:log] == 'true'
# is_show_log = false
# end
# LeanCloudLogger.instance.end_log(true, is_show_log)
# end

feature_and_hotfix_command(GitflowType::FEATURE)

Expand All @@ -66,6 +67,8 @@ module BigKeeper

init_command

client_command

desc 'Show version of bigkeeper'
command :version do |version|
version.action do |global_options, options, args|
Expand Down
50 changes: 50 additions & 0 deletions lib/big_keeper/command/client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
require 'big_keeper/util/leancloud_logger'
require 'big_keeper/command/pod/podfile'
require 'big_keeper/command/spec/list'
require 'big_keeper/util/list_generator'

module BigKeeper

def self.client_command
desc 'API for bigkeeper-client.'
command :client do | c |
c.desc 'Commands about operate modules.'
c.command :modules do |modules|
modules.desc 'Get modules list from Bigkeeper file.'
modules.command :list do |list|
list.action do |global_options, options, args|
LeanCloudLogger.instance.set_command("spec/list")
path = File.expand_path(global_options[:path])
version = global_options[:ver]
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
spec_list(path, user, options)
end
end
modules.desc 'Update modules.'
modules.command :update do |update|
update.action do |global_options, options, args|
LeanCloudLogger.instance.set_command("spec/list")
path = File.expand_path(global_options[:path])
version = global_options[:ver]
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
spec_list(path, user, options)
end
end
end
c.desc 'Commands about features.'
c.command :feature do |feature|
feature.desc "List all the features including origin."
feature.command :list do | list |
list.flag %i[v version] , default_value: 'all versions'
list.action do |global_options, options, args|
LeanCloudLogger.instance.set_command("feature/list/json")
options[:json] = true
path = File.expand_path(global_options[:path])
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
list(path, user, GitflowType::FEATURE, options)
end
end
end
end
end
end
2 changes: 1 addition & 1 deletion lib/big_keeper/command/feature&hotfix/delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def self.delete(path, user, name, type)
# Parse Bigkeeper file
BigkeeperParser.parse("#{path}/Bigkeeper")
branch_name = "#{GitflowType.name(type)}/#{name}"
version = 'all version'

modules = BigkeeperParser.module_names

modules.each do |module_name|
module_full_path = BigkeeperParser.module_full_path(path, user, module_name)

Expand Down
2 changes: 1 addition & 1 deletion lib/big_keeper/command/feature&hotfix/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.list(path, user, type, options)
begin
#get cache file path
FileUtils.mkdir_p(cache_path) unless File.exist?(cache_path)
file = File.new(json_path, 'w')
file = File.new(json_path, 'w', :encoding => 'UTF-8')
begin
#get all modules info
module_list_dic = get_module_info(path, user, type, version, branches, is_print_log)
Expand Down
6 changes: 3 additions & 3 deletions lib/big_keeper/dependency/dep_pod_operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def recover

def update_module_config(module_name, module_operate_type)
file = "#{@path}/Podfile"
temp_file = Tempfile.new('.Podfile.tmp')
temp_file = Tempfile.new('.Podfile.tmp', :encoding => 'UTF-8')

begin
File.open(file, 'r') do |file|
File.open(file, 'r', :encoding => 'UTF-8') do |file|
file.each_line do |line|
temp_file.puts generate_module_config(line, module_name, module_operate_type)
end
Expand Down Expand Up @@ -84,7 +84,7 @@ def generate_module_config(line, module_name, module_operate_type)
def origin_config_of_module(module_name)
origin_config = ''

File.open("#{@path}/.bigkeeper/Podfile", 'r') do |file|
File.open("#{@path}/.bigkeeper/Podfile", 'r', :encoding => 'UTF-8') do |file|
file.each_line do |line|
if line =~ /(\s*)pod(\s*)('|")#{module_name}('|")([\s\S]*)/
origin_config = line
Expand Down
3 changes: 2 additions & 1 deletion lib/big_keeper/service/git_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ def current_branch_type(path)
def branchs_with_type(path, type)
branchs = []
Dir.chdir(path) do
IO.popen('git branch -r') do | io |
IO.popen('git branch -a') do | io |
io.each do | line |
branchs << line.gsub('\n', '') if line.include?('develop')
branchs << line.gsub(/\s/, '') if line =~ /[\s\S]*#{GitflowType.name(type)}*/
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/big_keeper/util/cache_operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def initialize(path)
FileUtils.mkdir_p(@cache_path) unless File.exist?(@cache_path)

if File.exist?("#{@cache_path}/module.cache")
file = File.open("#{@cache_path}/module.cache", 'r')
file = File.open("#{@cache_path}/module.cache", 'r', :encoding => 'UTF-8')
@modules = JSON.load(file.read(), :encoding => 'UTF-8')
file.close
else
Expand Down Expand Up @@ -110,7 +110,7 @@ def clean_modules
end

def cache_modules
file = File.new("#{@cache_path}/module.cache", 'w')
file = File.new("#{@cache_path}/module.cache", 'w', :encoding => 'UTF-8')
file << @modules.to_json
file.close
end
Expand Down
2 changes: 1 addition & 1 deletion lib/big_keeper/util/file_operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ def find_all_code_file(path)
return header_file_list+m_file_list
end
end

end
10 changes: 5 additions & 5 deletions lib/big_keeper/util/gradle_file_operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def update_module_settings(module_name, settings_file, depend_modules)

dest_path = File.dirname(big_settings_file)
FileUtils.mkdir_p(dest_path) unless File.exist?(dest_path)
file = File.new(big_settings_file, 'w')
file = File.new(big_settings_file, 'w', :encoding => 'UTF-8')
begin
file << result
file.close
Expand All @@ -58,9 +58,9 @@ def update_module_settings(module_name, settings_file, depend_modules)
return
end

temp_file = Tempfile.new('.settings.gradle.tmp')
temp_file = Tempfile.new('.settings.gradle.tmp', :encoding => 'UTF-8')
begin
File.open(settings_file, 'r') do |file|
File.open(settings_file, 'r', :encoding => 'UTF-8') do |file|
file.each_line do |line|
temp_file.puts(line)
end
Expand Down Expand Up @@ -92,7 +92,7 @@ def update_module_build(build_file, module_name, depend_modules, version_name)

dest_path = File.dirname(big_build_file)
FileUtils.mkdir_p(dest_path) unless File.exist?(dest_path)
file = File.new(big_build_file, 'w')
file = File.new(big_build_file, 'w', :encoding => 'UTF-8')
begin
file << result
file.close
Expand Down Expand Up @@ -295,7 +295,7 @@ def recover_bigkeeper_config_file(bigkeeper_config_file)
if !File.exist?(bigkeeper_config_file)
return
end
temp_file = Tempfile.new('.bigkeeper_config.tmp')
temp_file = Tempfile.new('.bigkeeper_config.tmp', :encoding => 'UTF-8')
isBigkeeperScript = false
isBigkeeperBackupScript = false
begin
Expand Down
10 changes: 5 additions & 5 deletions lib/big_keeper/util/podfile_operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def replace_all_module_release(path, user, module_names, version)
end

def find_and_lock(podfile, dictionary)
temp_file = Tempfile.new('.Podfile.tmp')
temp_file = Tempfile.new('.Podfile.tmp', :encoding => 'UTF-8')
begin
File.open(podfile, 'r') do |file|
file.each_line do |line|
Expand Down Expand Up @@ -65,9 +65,9 @@ def find_and_lock(podfile, dictionary)
end

def find_and_upgrade(podfile, dictionary)
temp_file = Tempfile.new('.Podfile.tmp')
temp_file = Tempfile.new('.Podfile.tmp', :encoding => 'UTF-8')
begin
File.open(podfile, 'r') do |file|
File.open(podfile, 'r', :encoding => 'UTF-8') do |file|
file.each_line do |line|
pod_model = PodfileParser.get_pod_model(line)
if pod_model != nil && pod_model.name != nil && dictionary[pod_model.name] != nil
Expand All @@ -87,10 +87,10 @@ def find_and_upgrade(podfile, dictionary)
end

def podspec_change(podspec_file, version, module_name)
temp_file = Tempfile.new(".#{module_name}.podspec")
temp_file = Tempfile.new(".#{module_name}.podspec", :encoding => 'UTF-8')
has_change = false
begin
File.open(podspec_file, 'r') do |file|
File.open(podspec_file, 'r', :encoding => 'UTF-8') do |file|
file.each_line do |line|
if line.include?("s.version")
temp_line = line
Expand Down

0 comments on commit 1c0e35b

Please sign in to comment.